Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 646
Eugenio Cuevas Avatar asked Mar 31 '26 05:03

Eugenio Cuevas


1 Answers

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));
like image 193
Artjom B. Avatar answered Apr 02 '26 19:04

Artjom B.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!