public static ASN1Primitive fromExtensionValue( byte[] encodedValue) throws IOException { ASN1OctetString octs = (ASN1OctetString)ASN1Primitive.fromByteArray(encodedValue); return ASN1Primitive.fromByteArray(octs.getOctets()); }
public static ASN1Primitive fromExtensionValue( byte[] encodedValue) throws IOException { ASN1OctetString octs = (ASN1OctetString)ASN1Primitive.fromByteArray(encodedValue); return ASN1Primitive.fromByteArray(octs.getOctets()); }
public ASN1Encodable parsePrivateKey() throws IOException { return ASN1Primitive.fromByteArray(privKey.getOctets()); }
/** * Return the enclosed object assuming explicit tagging. * * @return the resulting object * @throws IOException if reconstruction fails. */ public ASN1Primitive getObject() throws IOException { return ASN1Primitive.fromByteArray(getContents()); }
private static ASN1Primitive decodeObject(String oValue) { try { return ASN1Primitive.fromByteArray(Hex.decode(oValue.substring(1))); } catch (IOException e) { throw new IllegalStateException("unknown encoding in name: " + e); } }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); this.configuration = BouncyCastleProvider.CONFIGURATION; populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); populateFromPubKeyInfo(SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); }
private static CsrAttrs parseBytes(byte[] responseEncoding) throws ESTException { try { return CsrAttrs.getInstance(ASN1Primitive.fromByteArray(responseEncoding)); } catch (Exception e) { throw new ESTException("malformed data: " + e.getMessage(), e); } }
/** * If the public key is an encoded object this will return the ASN.1 primitives encoded - if the bitstring * can't be decoded this routine throws an IOException. * * @exception IOException - if the bit string doesn't represent a DER encoded object. * @return the public key as an ASN.1 primitive. */ public ASN1Primitive parsePublicKey() throws IOException { return ASN1Primitive.fromByteArray(getSubjectPublicKey().getOctets()); }
/** * Create a private key parameter from a PKCS8 PrivateKeyInfo encoding. * * @param privateKeyInfoData the PrivateKeyInfo encoding * @return a suitable private key parameter * @throws IOException on an error decoding the key */ public static AsymmetricKeyParameter createKey(byte[] privateKeyInfoData) throws IOException { return createKey(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(privateKeyInfoData))); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); this.attrCarrier = new PKCS12BagAttributeCarrierImpl(); }
/** * Return the ASN.1 object contained in a byte[] returned by a getExtensionValue() call. * * @param encExtValue DER encoded OCTET STRING containing the DER encoded extension object. * @return an ASN.1 object * @throws java.io.IOException on a parsing error. */ public static ASN1Primitive parseExtensionValue(byte[] encExtValue) throws IOException { return ASN1Primitive.fromByteArray(ASN1OctetString.getInstance(encExtValue).getOctets()); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); byte[] enc = (byte[])in.readObject(); populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); this.configuration = BouncyCastleProvider.CONFIGURATION; this.attrCarrier = new PKCS12BagAttributeCarrierImpl(); }
private void readObject( ObjectInputStream in) throws IOException, ClassNotFoundException { byte[] enc = (byte[])in.readObject(); populateFromPrivKeyInfo(PrivateKeyInfo.getInstance(ASN1Primitive.fromByteArray(enc))); this.algorithm = (String)in.readObject(); this.withCompression = in.readBoolean(); this.attrCarrier = new PKCS12BagAttributeCarrierImpl(); attrCarrier.readObject(in); }
protected void engineInit( byte[] params, String format) throws IOException { if (this.isASN1FormatString(format)) { engineInit(params); return; } throw new IOException("Unknown parameters format in PWRIKEK parameters object"); }
protected void engineInit( byte[] params, String format) throws IOException { if (this.isASN1FormatString(format)) { engineInit(params); return; } throw new IOException("Unknown parameters format in PKCS12 PBE parameters object"); }
private DERBitString getPublicKeyDetails(BCECPublicKey pub) { try { SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(pub.getEncoded())); return info.getPublicKeyData(); } catch (IOException e) { // should never happen return null; } }
/** * @param in the stream to read the packet from. */ protected ECPublicBCPGKey( BCPGInputStream in) throws IOException { this.oid = ASN1ObjectIdentifier.getInstance(ASN1Primitive.fromByteArray(readBytesOfEncodedLength(in))); this.point = new MPInteger(in).getValue(); }