Code example for RSAPrivateKey

Methods: getModulus, getPrivateExponent

0
      } 
      return new OpenSSLRSAPrivateKey(key, params);
    } 
 
    static OpenSSLKey getInstance(RSAPrivateKey rsaPrivateKey) throws InvalidKeyException {
        final BigInteger modulus = rsaPrivateKey.getModulus();
        final BigInteger privateExponent = rsaPrivateKey.getPrivateExponent();
 
        if (modulus == null) {
            throw new InvalidKeyException("modulus == null");
        } else if (privateExponent == null) {
            throw new InvalidKeyException("privateExponent == null");
        } 
 
        try { 
            return new OpenSSLKey(NativeCrypto.EVP_PKEY_new_RSA( 
                    modulus.toByteArray(),
                    null, 
                    privateExponent.toByteArray(),
                    null, 
                    null,