Ejemplo n.º 1
0
  private Certificate readPEMCertificate(InputStream in)
      throws IOException, CertificateParsingException {
    ASN1Sequence seq = PEM_PARSER.readPEMObject(in);

    if (seq != null) {
      return new X509CertificateObject(
          org.ripple.bouncycastle.asn1.x509.Certificate.getInstance(seq));
    }

    return null;
  }
Ejemplo n.º 2
0
  private Certificate getCertificate() throws CertificateParsingException {
    if (sData != null) {
      while (sDataObjectCount < sData.size()) {
        Object obj = sData.getObjectAt(sDataObjectCount++);

        if (obj instanceof ASN1Sequence) {
          return new X509CertificateObject(
              org.ripple.bouncycastle.asn1.x509.Certificate.getInstance(obj));
        }
      }
    }

    return null;
  }
Ejemplo n.º 3
0
  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));
  }