/** * construct an RSA key from a private key info object. */ BCRSAPrivateCrtKey( PrivateKeyInfo info) throws IOException { this(RSAPrivateKey.getInstance(info.parsePrivateKey())); }
/** * construct an RSA key from a private key info object. */ JCERSAPrivateCrtKey( PrivateKeyInfo info) throws IOException { this(org.spongycastle.asn1.pkcs.RSAPrivateKey.getInstance(info.parsePrivateKey())); }
public static RSAPrivateKey getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
/** * construct an RSA key from a private key info object. */ JCERSAPrivateCrtKey( PrivateKeyInfo info) throws IOException { this(org.spongycastle.asn1.pkcs.RSAPrivateKey.getInstance(info.parsePrivateKey())); }
public static RSAPrivateKey getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
/** * construct an RSA key from a private key info object. */ BCRSAPrivateCrtKey( PrivateKeyInfo info) throws IOException { this(RSAPrivateKey.getInstance(info.parsePrivateKey())); }
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException { ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm(); if (RSAUtil.isRsaOid(algOid)) { RSAPrivateKey rsaPrivKey = RSAPrivateKey.getInstance(keyInfo.parsePrivateKey()); if (rsaPrivKey.getCoefficient().intValue() == 0) { return new BCRSAPrivateKey(rsaPrivKey); } else { return new BCRSAPrivateCrtKey(keyInfo); } } else { throw new IOException("algorithm identifier " + algOid + " in key not recognised"); } }
RSAPrivateKey.getInstance(((PKCS8EncodedKeySpec)keySpec).getEncoded()));
RSAPrivateKey.getInstance(((PKCS8EncodedKeySpec)keySpec).getEncoded()));
public PEMKeyPair parse(byte[] encoding) throws IOException { try { ASN1Sequence seq = ASN1Sequence.getInstance(encoding); if (seq.size() != 9) { throw new PEMException("malformed sequence in RSA private key"); } org.spongycastle.asn1.pkcs.RSAPrivateKey keyStruct = org.spongycastle.asn1.pkcs.RSAPrivateKey.getInstance(seq); RSAPublicKey pubSpec = new RSAPublicKey( keyStruct.getModulus(), keyStruct.getPublicExponent()); AlgorithmIdentifier algId = new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE); return new PEMKeyPair(new SubjectPublicKeyInfo(algId, pubSpec), new PrivateKeyInfo(algId, keyStruct)); } catch (IOException e) { throw e; } catch (Exception e) { throw new PEMException( "problem creating RSA private key: " + e.toString(), e); } } }
public PEMKeyPair parse(byte[] encoding) throws IOException { try { ASN1Sequence seq = ASN1Sequence.getInstance(encoding); if (seq.size() != 9) { throw new PEMException("malformed sequence in RSA private key"); } org.spongycastle.asn1.pkcs.RSAPrivateKey keyStruct = org.spongycastle.asn1.pkcs.RSAPrivateKey.getInstance(seq); RSAPublicKey pubSpec = new RSAPublicKey( keyStruct.getModulus(), keyStruct.getPublicExponent()); AlgorithmIdentifier algId = new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE); return new PEMKeyPair(new SubjectPublicKeyInfo(algId, pubSpec), new PrivateKeyInfo(algId, keyStruct)); } catch (IOException e) { throw e; } catch (Exception e) { throw new PEMException( "problem creating RSA private key: " + e.toString(), e); } } }
RSAPrivateKey keyStructure = RSAPrivateKey.getInstance(keyInfo.parsePrivateKey());
RSAPrivateKey keyStructure = RSAPrivateKey.getInstance(keyInfo.parsePrivateKey());