Example usage for org.bouncycastle.asn1.eac RSAPublicKey getModulus

List of usage examples for org.bouncycastle.asn1.eac RSAPublicKey getModulus

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.eac RSAPublicKey getModulus.

Prototype

public BigInteger getModulus() 

Source Link

Usage

From source file:org.psl.fidouaf.core.crypto.KeyCodec.java

License:Apache License

public static PublicKey getRSAPublicKey(byte[] encodedPubKey)
        throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
    RSAPublicKey pubKey8 = (RSAPublicKey) RSAPublicKey.getInstance(encodedPubKey);
    SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(
            new RSAKeyParameters(false, pubKey8.getModulus(), pubKey8.getPublicExponent()));
    X509EncodedKeySpec spec = new X509EncodedKeySpec(info.getEncoded());
    KeyFactory keyFactory = KeyFactory.getInstance("RSA");
    return keyFactory.generatePublic(spec);
}