Eugenio Cuevas
Eugenio Cuevas

Reputation: 11078

Open source replacement for sun.security.rsa.RSAPublicKeyImpl

I get some warnings due to use of RSAPublicKeyImpl:

warning: RSAPublicKeyImpl is internal proprietary API and may be removed in a future release import sun.security.rsa.RSAPublicKeyImpl;

I have tried to find a replacement, but with no luck. What is the open source alternative for this class?

Upvotes: 2

Views: 5031

Answers (2)

Artjom B.
Artjom B.

Reputation: 61952

class RSAPublicKeySpec supports at least a part of the implementation that you're looking for. Namely it can be created from the exponent and modulus as BigInteger.

You can use this to get an RSAPublicKey from an encoded byte[]:

RSAPublicKey publicKey = (RSAPublicKey)KeyFactory.getInstance("RSA").generatePublic(
        new X509EncodedKeySpec(bytes));

Upvotes: 9

user2858470
user2858470

Reputation: 133

I am not sure, but try Bouncy castle library https://www.bouncycastle.org/java.html

Several mounth ago I also had same issue as you, and I successfully solved it by using AES cryptyng alghoritm

Upvotes: 0

Related Questions