private byte[] getExtensionValue(X509Certificate cert, String oid) { try { byte[] bytes = cert.getExtensionValue(oid); if (bytes == null) { return null; } return (byte[]) ASN1OctetString.getInstance().decode(bytes); } catch (IOException e) { return null; } }
@Override public byte[] getEncoded() { if (encoding == null) { encoding = ASN1OctetString.getInstance().encode(keyIdentifier); } return encoding; }
@Override public Object getDecodedObject(BerInputStream in) throws IOException { // first - decoded octet string, // second - raw encoding of octet string return new Object[] {super.getDecodedObject(in), in.getEncoded()}; } }
throw new SecurityException("Too many MessageDigest attributes"); Collection<?> entries = a.getValue().getValues(ASN1OctetString.getInstance()); if (entries.size() != 1) { throw new SecurityException("Too many values for MessageDigest attribute");
throw new SecurityException("Too many MessageDigest attributes"); Collection<?> entries = a.getValue().getValues(ASN1OctetString.getInstance()); if (entries.size() != 1) { throw new SecurityException("Too many values for MessageDigest attribute");
/** * Creates an object on the base of its encoded form. */ public static SubjectKeyIdentifier decode(byte[] encoding) throws IOException { SubjectKeyIdentifier res = new SubjectKeyIdentifier((byte[]) ASN1OctetString.getInstance().decode(encoding)); res.encoding = encoding; return res; }
/** * Returns the raw (undecoded octet string) value of extnValue * field of the structure. */ public byte[] getRawExtnValue() { if (rawExtnValue == null) { rawExtnValue = ASN1OctetString.getInstance().encode(extnValue); } return rawExtnValue; }
@Override public Object decode(BerInputStream in) throws IOException { in.readOctetString(); if (in.isVerify) { return null; } return getDecodedObject(in); }
throw new SecurityException("Too many MessageDigest attributes"); Collection<?> entries = a.getValue().getValues(ASN1OctetString.getInstance()); if (entries.size() != 1) { throw new SecurityException("Too many values for MessageDigest attribute");
/** * Returns the value of certificate extension */ private byte[] getExtensionValue(X509Certificate cert, String OID) { try { byte[] bytes = cert.getExtensionValue(OID); if (bytes == null) { return null; } return (byte[]) ASN1OctetString.getInstance().decode(bytes); } catch (IOException e) { return null; } }
@Override protected void getValues(Object object, Object[] values) { ContentInfo ci = (ContentInfo) object; values[0] = ci.oid; if (ci.content != null) { if (Arrays.equals(ci.oid, DATA)) { if (ci.content != null) { values[1] = ASN1OctetString.getInstance().encode(ci.content); } } else if (ci.content instanceof SignedData) { values[1] = SignedData.ASN1.encode(ci.content); } else { values[1] = ci.content; } } }
@Override public Object decode(BerInputStream in) throws IOException { in.readOctetString(); if (in.isVerify) { return null; } return getDecodedObject(in); }
throw new SecurityException("Too many MessageDigest attributes"); Collection<?> entries = a.getValue().getValues(ASN1OctetString.getInstance()); if (entries.size() != 1) { throw new SecurityException("Too many values for MessageDigest attribute");
bytes = (byte[]) ASN1OctetString.getInstance().decode(bytes); BigInteger crlNumber = new BigInteger((byte[]) ASN1Integer.getInstance().decode(bytes));
@Override public byte[] getEncoded() { if (encoding == null) { encoding = ASN1OctetString.getInstance().encode(keyIdentifier); } return encoding; }
@Override public Object getDecodedObject(BerInputStream in) throws IOException { // first - decoded octet string, // second - raw encoding of octet string return new Object[] {super.getDecodedObject(in), in.getEncoded()}; } }
throw new SecurityException("Too many MessageDigest attributes"); Collection<?> entries = a.getValue().getValues(ASN1OctetString.getInstance()); if (entries.size() != 1) { throw new SecurityException("Too many values for MessageDigest attribute");
@Override protected Object getDecodedObject(BerInputStream in) throws IOException { Object[] values = (Object[]) in.content; int[] oid = (int[]) values[0]; if (Arrays.equals(oid, DATA)) { if (values[1] != null) { return new ContentInfo(oid, ASN1OctetString.getInstance().decode((byte[])values[1]), in.getEncoded()); } else { return new ContentInfo((int[])values[0], null, in.getEncoded()); } } if (Arrays.equals(oid, SIGNED_DATA)) { return new ContentInfo((int[])values[0], SignedData.ASN1.decode((byte[])values[1]), in.getEncoded()); } return new ContentInfo((int[]) values[0], values[1], in.getEncoded()); } };
/** * Returns the raw (undecoded octet string) value of extnValue * field of the structure. */ public byte[] getRawExtnValue() { if (rawExtnValue == null) { rawExtnValue = ASN1OctetString.getInstance().encode(extnValue); } return rawExtnValue; }
@Override public Object getDecodedObject(BerInputStream in) throws IOException { // first - decoded octet string, // second - raw encoding of octet string return new Object[] {super.getDecodedObject(in), in.getEncoded()}; } }