/** * Constructs the instance on the base of ASN.1 encoded * form of X.509 certificate provided via array of bytes. * @param encoding byte array containing ASN.1 encoded form of certificate. * @throws IOException if some decoding problems occur. */ public X509CertImpl(byte[] encoding) throws IOException { this((Certificate) Certificate.ASN1.decode(encoding)); }
/** * Returns ASN.1 encoded form of this X.509 OtherName value. */ public byte[] getEncoded() { if (encoding == null) { encoding = ASN1.encode(this); } return encoding; }
public Object decode(BerInputStream in) throws IOException { in.readSequence(this); if (in.isVerify) { return null; } return getDecodedObject(in); }
ASN1PrivateKeyInfo.verify(decryptedData); } catch (IOException e1) { throw invalidKey();
@Override public void getSequenceLength(ASN1Sequence sequence) { ASN1Type[] type = sequence.type; Object[] values = new Object[type.length]; int[] compLens = new int[type.length]; sequence.getValues(content, values); push(compLens, values); int seqLen = 0; for (int i = 0; i < type.length; i++) { // check optional types if (values[i] == null) { if (sequence.OPTIONAL[i]) { continue; } else { throw new RuntimeException();//FIXME type & message } } if (Objects.equal(sequence.DEFAULT[i], values[i])) { values[i] = null; continue; } content = values[i]; type[i].setEncodingContent(this); compLens[i] = length; // in case if we get content bytes while getting its length // FIXME what about remove it: need redesign values[i] = content; seqLen += type[i].getEncodedLength(this); } length = seqLen; }
ASN1PrivateKeyInfo.verify(decryptedData); } catch (IOException e1) { throw invalidKey();
@Override public void getSequenceLength(ASN1Sequence sequence) { ASN1Type[] type = sequence.type; Object[] values = new Object[type.length]; int[] compLens = new int[type.length]; sequence.getValues(content, values); push(compLens, values); int seqLen = 0; for (int i = 0; i < type.length; i++) { // check optional types if (values[i] == null) { if (sequence.OPTIONAL[i]) { continue; } else { throw new RuntimeException();//FIXME type & message } } if (Objects.equal(sequence.DEFAULT[i], values[i])) { values[i] = null; continue; } content = values[i]; type[i].setEncodingContent(this); compLens[i] = length; // in case if we get content bytes while getting its length // FIXME what about remove it: need redesign values[i] = content; seqLen += type[i].getEncodedLength(this); } length = seqLen; }
/** * Returns ASN.1 encoded form of this X.509 PolicyConstraints value. */ @Override public byte[] getEncoded() { if (encoding == null) { encoding = ASN1.encode(this); } return encoding; }
public PolicyConstraints(byte[] encoding) throws IOException { super(encoding); PolicyConstraints pc = (PolicyConstraints) ASN1.decode(encoding); this.requireExplicitPolicy = pc.requireExplicitPolicy; this.inhibitPolicyMapping = pc.inhibitPolicyMapping; }
ASN1PrivateKeyInfo.verify(decryptedData); } catch (IOException e1) { throw invalidKey();
public Object decode(BerInputStream in) throws IOException { in.readSequence(this); if (in.isVerify) { return null; } return getDecodedObject(in); }
@Override public void getSequenceLength(ASN1Sequence sequence) { ASN1Type[] type = sequence.type; Object[] values = new Object[type.length]; int[] compLens = new int[type.length]; sequence.getValues(content, values); push(compLens, values); int seqLen = 0; for (int i = 0; i < type.length; i++) { // check optional types if (values[i] == null) { if (sequence.OPTIONAL[i]) { continue; } else { throw new RuntimeException();//FIXME type & message } } if (Objects.equal(sequence.DEFAULT[i], values[i])) { values[i] = null; continue; } content = values[i]; type[i].setEncodingContent(this); compLens[i] = length; // in case if we get content bytes while getting its length // FIXME what about remove it: need redesign values[i] = content; seqLen += type[i].getEncodedLength(this); } length = seqLen; }
public byte[] getEncoded() { if (encoding == null) { encoding = ASN1.encode(this); } return encoding; }
/** * Creates X.509 CRL on the base of ASN.1 DER encoded form of * the CRL (CertificateList structure described in RFC 3280) * provided via array of bytes. * @throws IOException if decoding errors occur. */ public X509CRLImpl(byte[] encoding) throws IOException { this((CertificateList) CertificateList.ASN1.decode(encoding)); }
byte[] decryptedData = cipher.doFinal(encryptedData); try { ASN1PrivateKeyInfo.verify(decryptedData); } catch (IOException e1) { throw new InvalidKeySpecException("Decrypted data does not represent valid PKCS#8 PrivateKeyInfo");
public Object decode(BerInputStream in) throws IOException { in.readSequence(this); if (in.isVerify) { return null; } return getDecodedObject(in); }
@Override public void getSequenceLength(ASN1Sequence sequence) { ASN1Type[] type = sequence.type; Object[] values = new Object[type.length]; int[] compLens = new int[type.length]; sequence.getValues(content, values); push(compLens, values); int seqLen = 0; for (int i = 0; i < type.length; i++) { // check optional types if (values[i] == null) { if (sequence.OPTIONAL[i]) { continue; } else { throw new RuntimeException();//FIXME type & message } } if (Objects.equal(sequence.DEFAULT[i], values[i])) { values[i] = null; continue; } content = values[i]; type[i].setEncodingContent(this); compLens[i] = length; // in case if we get content bytes while getting its length // FIXME what about remove it: need redesign values[i] = content; seqLen += type[i].getEncodedLength(this); } length = seqLen; }
/** * Returns ASN.1 encoded form of this PrivateKeyInfo. */ public byte[] getEncoded() { if (encoding == null) { encoding = ASN1.encode(this); } return encoding; }
public static NameConstraints decode(byte[] encoding) throws IOException { return (NameConstraints) ASN1.decode(encoding); }
ASN1PrivateKeyInfo.verify(decryptedData); } catch (IOException e1) { throw invalidKey();