RSAPrivateKeyImpl cannot be accessed from outside package

Viewed 835

I try to create JWTVerifier with RSA algorithm:

    JWTVerifier jwtVerifier = JWT.require(Algorithm.RSA512(rsaPublicKey, rsaPrivateKey)).build();

I want to create RSAPublicKey and RSAPrivateKey instance with help their implementations RSAPublicKeyImpl and RSAPrivateKeyImpl and have problem with second instance, error context:

    'RSAPrivateKeyImpl(java.math.BigInteger, java.math.BigInteger)' is not public in 
    'sun.security.rsa.RSAPrivateKeyImpl'. Cannot be accessed from outside package.

Libraries:

import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import sun.security.rsa.RSAPrivateKeyImpl;
import sun.security.rsa.RSAPublicKeyImpl;

Code in Intellij Idea:

    private RSAPublicKey rsaPublicKey;
    private RSAPrivateKey rsaPrivateKey;

    public JwtFilter() throws InvalidKeyException {
        this.rsaPublicKey = new RSAPublicKeyImpl(BigInteger.valueOf(1147), BigInteger.valueOf(7));
        this.rsaPrivateKey = new RSAPrivateKeyImpl(BigInteger.valueOf(1147), BigInteger.valueOf(463));
    }

RSAPublicKey is ok. Methods and classes are public. I cleaned and rebuilt my project, invalidated caches and restart.

0 Answers
Related