Java的RSA实现nopadding

java.security包下的算法默认是带有OAEP的padding的,如果想要使用nopadding,需要引入额外的provider,比如bouncycastle

Security
     .addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

Cipher.getInstance("RSA/NONE/NoPadding", "BC");

这样就可以了。

One thought on “Java的RSA实现nopadding

Leave a Reply

Your email address will not be published. Required fields are marked *