private BasicConstraints(ASN1Sequence seq) { if (seq.size() == 0) { this.cA = null; this.pathLenConstraint = null; } else { if (seq.getObjectAt(0) instanceof ASN1Boolean) { this.cA = ASN1Boolean.getInstance(seq.getObjectAt(0)); } else { this.cA = null; this.pathLenConstraint = ASN1Integer.getInstance(seq.getObjectAt(0)); } if (seq.size() > 1) { if (this.cA != null) { this.pathLenConstraint = ASN1Integer.getInstance(seq.getObjectAt(1)); } else { throw new IllegalArgumentException("wrong sequence in constructor"); } } } }
private Certificate readDERCertificate(InputStream in) throws IOException, CertificateParsingException { ASN1InputStream dIn = new ASN1InputStream(in); ASN1Sequence seq = (ASN1Sequence) dIn.readObject(); if (seq.size() > 1 && seq.getObjectAt(0) instanceof DERObjectIdentifier) { if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData)) { sData = new SignedData(ASN1Sequence.getInstance((ASN1TaggedObject) seq.getObjectAt(1), true)) .getCertificates(); return getCertificate(); } } return new X509CertificateObject( org.ripple.bouncycastle.asn1.x509.Certificate.getInstance(seq)); }
public List getExtendedKeyUsage() throws CertificateParsingException { byte[] bytes = this.getExtensionBytes("2.5.29.37"); if (bytes != null) { try { ASN1InputStream dIn = new ASN1InputStream(bytes); ASN1Sequence seq = (ASN1Sequence) dIn.readObject(); List list = new ArrayList(); for (int i = 0; i != seq.size(); i++) { list.add(((ASN1ObjectIdentifier) seq.getObjectAt(i)).getId()); } return Collections.unmodifiableList(list); } catch (Exception e) { throw new CertificateParsingException("error processing extended key usage extension"); } } return null; }