com.google.bitcoin.bouncycastle.asn1.x509.X509CertificateStructure

Here are the examples of the java api class com.google.bitcoin.bouncycastle.asn1.x509.X509CertificateStructure taken from open source projects.

1. Certificate#getCerts()

Project: bitcoin-android
File: Certificate.java
/**
     * @return An array which contains the certs, this chain contains.
     */
public X509CertificateStructure[] getCerts() {
    X509CertificateStructure[] result = new X509CertificateStructure[certs.length];
    System.arraycopy(certs, 0, result, 0, certs.length);
    return result;
}

2. Certificate#parse()

Project: bitcoin-android
File: Certificate.java
/**
     * Parse the ServerCertificate message.
     *
     * @param is The stream where to parse from.
     * @return A Certificate object with the certs, the server has sended.
     * @throws IOException If something goes wrong during parsing.
     */
protected static Certificate parse(InputStream is) throws IOException {
    X509CertificateStructure[] certs;
    int left = TlsUtils.readUint24(is);
    Vector tmp = new Vector();
    while (left > 0) {
        int size = TlsUtils.readUint24(is);
        left -= 3 + size;
        byte[] buf = new byte[size];
        TlsUtils.readFully(buf, is);
        ByteArrayInputStream bis = new ByteArrayInputStream(buf);
        ASN1InputStream ais = new ASN1InputStream(bis);
        DERObject o = ais.readObject();
        tmp.addElement(X509CertificateStructure.getInstance(o));
        if (bis.available() > 0) {
            throw new IllegalArgumentException("Sorry, there is garbage data left after the certificate");
        }
    }
    certs = new X509CertificateStructure[tmp.size()];
    for (int i = 0; i < tmp.size(); i++) {
        certs[i] = (X509CertificateStructure) tmp.elementAt(i);
    }
    return new Certificate(certs);
}