JCERSAPublicKey( SubjectPublicKeyInfo info) { try { org.spongycastle.asn1.pkcs.RSAPublicKey pubKey = org.spongycastle.asn1.pkcs.RSAPublicKey.getInstance(info.parsePublicKey()); this.modulus = pubKey.getModulus(); this.publicExponent = pubKey.getPublicExponent(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in RSA public key"); } }
BCRSAPublicKey( SubjectPublicKeyInfo info) { try { org.spongycastle.asn1.pkcs.RSAPublicKey pubKey = org.spongycastle.asn1.pkcs.RSAPublicKey.getInstance(info.parsePublicKey()); this.modulus = pubKey.getModulus(); this.publicExponent = pubKey.getPublicExponent(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in RSA public key"); } }
JCERSAPublicKey( SubjectPublicKeyInfo info) { try { RSAPublicKeyStructure pubKey = new RSAPublicKeyStructure((ASN1Sequence)info.parsePublicKey()); this.modulus = pubKey.getModulus(); this.publicExponent = pubKey.getPublicExponent(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in RSA public key"); } }
private void populateFromPublicKeyInfo(SubjectPublicKeyInfo info) { try { org.spongycastle.asn1.pkcs.RSAPublicKey pubKey = org.spongycastle.asn1.pkcs.RSAPublicKey.getInstance(info.parsePublicKey()); this.algorithmIdentifier = info.getAlgorithm(); this.modulus = pubKey.getModulus(); this.publicExponent = pubKey.getPublicExponent(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in RSA public key"); } }
BCGOST3410PublicKey( SubjectPublicKeyInfo info) { GOST3410PublicKeyAlgParameters params = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); DEROctetString derY; try { derY = (DEROctetString)info.parsePublicKey(); byte[] keyEnc = derY.getOctets(); byte[] keyBytes = new byte[keyEnc.length]; for (int i = 0; i != keyEnc.length; i++) { keyBytes[i] = keyEnc[keyEnc.length - 1 - i]; // was little endian } this.y = new BigInteger(1, keyBytes); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in GOST3410 public key"); } this.gost3410Spec = GOST3410ParameterSpec.fromPublicKeyAlg(params); }
BCGOST3410PublicKey( SubjectPublicKeyInfo info) { GOST3410PublicKeyAlgParameters params = new GOST3410PublicKeyAlgParameters((ASN1Sequence)info.getAlgorithmId().getParameters()); DEROctetString derY; try { derY = (DEROctetString)info.parsePublicKey(); byte[] keyEnc = derY.getOctets(); byte[] keyBytes = new byte[keyEnc.length]; for (int i = 0; i != keyEnc.length; i++) { keyBytes[i] = keyEnc[keyEnc.length - 1 - i]; // was little endian } this.y = new BigInteger(1, keyBytes); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in GOST3410 public key"); } this.gost3410Spec = GOST3410ParameterSpec.fromPublicKeyAlg(params); }
BCElGamalPublicKey( SubjectPublicKeyInfo info) { ElGamalParameter params = ElGamalParameter.getInstance(info.getAlgorithm().getParameters()); ASN1Integer derY = null; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); }
JCEElGamalPublicKey( SubjectPublicKeyInfo info) { ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); DERInteger derY = null; try { derY = (DERInteger)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); }
BCElGamalPublicKey( SubjectPublicKeyInfo info) { ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); DERInteger derY = null; try { derY = (DERInteger)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); }
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) throws IOException { RainbowPublicKey pKey = RainbowPublicKey.getInstance(keyInfo.parsePublicKey()); return new BCRainbowPublicKey(pKey.getDocLength(), pKey.getCoeffQuadratic(), pKey.getCoeffSingular(), pKey.getCoeffScalar()); } }
JCEElGamalPublicKey( SubjectPublicKeyInfo info) { ElGamalParameter params = ElGamalParameter.getInstance(info.getAlgorithm().getParameters()); ASN1Integer derY = null; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); }
public PublicKey generatePublic(SubjectPublicKeyInfo pki) throws IOException { // get the inner type inside the BIT STRING ASN1Primitive innerType = pki.parsePublicKey(); McEliecePublicKey key = McEliecePublicKey.getInstance(innerType); return new BCMcEliecePublicKey(new McEliecePublicKeyParameters(key.getN(), key.getT(), key.getG())); }
public BCDSAPublicKey( SubjectPublicKeyInfo info) { ASN1Integer derY; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); if (isNotNull(info.getAlgorithm().getParameters())) { DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters()); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); } }
JDKDSAPublicKey( SubjectPublicKeyInfo info) { DERInteger derY; try { derY = (DERInteger)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); if (isNotNull(info.getAlgorithmId().getParameters())) { DSAParameter params = new DSAParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); } }
JDKDSAPublicKey( SubjectPublicKeyInfo info) { ASN1Integer derY; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); if (isNotNull(info.getAlgorithm().getParameters())) { DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters()); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); } }
public PublicKey generatePublic(SubjectPublicKeyInfo pki) throws IOException { // get the inner type inside the BIT STRING ASN1Primitive innerType = pki.parsePublicKey(); McElieceCCA2PublicKey key = McElieceCCA2PublicKey.getInstance(innerType); return new BCMcElieceCCA2PublicKey(new McElieceCCA2PublicKeyParameters(key.getN(), key.getT(), key.getG(), Utils.getDigest(key.getDigest()).getAlgorithmName())); }
public BCDSAPublicKey( SubjectPublicKeyInfo info) { ASN1Integer derY; try { derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { throw new IllegalArgumentException("invalid info structure in DSA public key"); } this.y = derY.getValue(); if (isNotNull(info.getAlgorithm().getParameters())) { DSAParameter params = DSAParameter.getInstance(info.getAlgorithm().getParameters()); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); } else { this.dsaSpec = null; } this.lwKeyParams = new DSAPublicKeyParameters(y, DSAUtil.toDSAParameters(dsaSpec)); }
public BCXMSSPublicKey(SubjectPublicKeyInfo keyInfo) throws IOException { XMSSKeyParams keyParams = XMSSKeyParams.getInstance(keyInfo.getAlgorithm().getParameters()); this.treeDigest = keyParams.getTreeDigest().getAlgorithm(); XMSSPublicKey xmssPublicKey = XMSSPublicKey.getInstance(keyInfo.parsePublicKey()); this.keyParams = new XMSSPublicKeyParameters .Builder(new XMSSParameters(keyParams.getHeight(), DigestUtil.getDigest(treeDigest))) .withPublicSeed(xmssPublicKey.getPublicSeed()) .withRoot(xmssPublicKey.getRoot()).build(); }
try derY = (ASN1Integer)info.parsePublicKey();
public BCXMSSMTPublicKey(SubjectPublicKeyInfo keyInfo) throws IOException { XMSSMTKeyParams keyParams = XMSSMTKeyParams.getInstance(keyInfo.getAlgorithm().getParameters()); this.treeDigest = keyParams.getTreeDigest().getAlgorithm(); XMSSPublicKey xmssMtPublicKey = XMSSPublicKey.getInstance(keyInfo.parsePublicKey()); this.keyParams = new XMSSMTPublicKeyParameters .Builder(new XMSSMTParameters(keyParams.getHeight(), keyParams.getLayers(), DigestUtil.getDigest(treeDigest))) .withPublicSeed(xmssMtPublicKey.getPublicSeed()) .withRoot(xmssMtPublicKey.getRoot()).build(); }