The getEncoded() method in the public keys in the JCE produces a DER encoded one of these.
this.keyData = new DERBitString(publicKey); this.algId = algId;
Enumeration e = seq.getObjects(); this.algId = AlgorithmIdentifier.getInstance(e.nextElement()); this.keyData = (DERBitString)e.nextElement();
return algId;
Produce an object suitable for an ASN1OutputStream. SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, publicKey BIT STRING } ASN1EncodableVector v = new ASN1EncodableVector(); v.add(algId); v.add(keyData); return new DERSequence(v);
SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, publicKey BIT STRING }
ASN1EncodableVector v = new ASN1EncodableVector(); v.add(algId); v.add(keyData); return new DERSequence(v);
return getInstance(ASN1Sequence.getInstance(obj, explicit));
if (obj instanceof SubjectPublicKeyInfo) { return (SubjectPublicKeyInfo)obj; } else if (obj instanceof ASN1Sequence) { return new SubjectPublicKeyInfo((ASN1Sequence)obj); } throw new IllegalArgumentException("unknown object in factory");
for when the public key is an encoded object - if the bitstring can't be decoded this routine throws an IOException.exceptionIOException - if the bit string doesn't represent a DER encoded object. ByteArrayInputStream bIn = new ByteArrayInputStream(keyData.getBytes()); DERInputStream dIn = new DERInputStream(bIn); return dIn.readObject();
ByteArrayInputStream bIn = new ByteArrayInputStream(keyData.getBytes()); DERInputStream dIn = new DERInputStream(bIn); return dIn.readObject();
for when the public key is raw bits... return keyData;
return keyData;