Search in sources :

Example 51 with DerOutputStream

use of sun.security.util.DerOutputStream in project Bytecoder by mirkosertic.

the class AuthorityInfoAccessExtension method encodeThis.

// Encode this extension value
private void encodeThis() throws IOException {
    if (accessDescriptions.isEmpty()) {
        this.extensionValue = null;
    } else {
        DerOutputStream ads = new DerOutputStream();
        for (AccessDescription accessDescription : accessDescriptions) {
            accessDescription.encode(ads);
        }
        DerOutputStream seq = new DerOutputStream();
        seq.write(DerValue.tag_Sequence, ads);
        this.extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 52 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class X509CertificatePair method emit.

/* Translate to encoded bytes */
private void emit(DerOutputStream out) throws IOException, CertificateEncodingException {
    DerOutputStream tagged = new DerOutputStream();
    if (forward != null) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putDerValue(new DerValue(forward.getEncoded()));
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FORWARD), tmp);
    }
    if (reverse != null) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putDerValue(new DerValue(reverse.getEncoded()));
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REVERSE), tmp);
    }
    out.write(DerValue.tag_Sequence, tagged);
}
Also used : DerOutputStream(sun.security.util.DerOutputStream) DerValue(sun.security.util.DerValue)

Example 53 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class X509CertificatePair method getEncoded.

/**
 * Return the DER encoded form of the certificate pair.
 *
 * @return The encoded form of the certificate pair.
 * @throws CerticateEncodingException If an encoding exception occurs.
 */
public byte[] getEncoded() throws CertificateEncodingException {
    try {
        if (encoded == null) {
            DerOutputStream tmp = new DerOutputStream();
            emit(tmp);
            encoded = tmp.toByteArray();
        }
    } catch (IOException ex) {
        throw new CertificateEncodingException(ex.toString());
    }
    return encoded;
}
Also used : DerOutputStream(sun.security.util.DerOutputStream) CertificateEncodingException(java.security.cert.CertificateEncodingException) IOException(java.io.IOException)

Example 54 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class AuthorityInfoAccessExtension method encodeThis.

// Encode this extension value
private void encodeThis() throws IOException {
    if (accessDescriptions.isEmpty()) {
        this.extensionValue = null;
    } else {
        DerOutputStream ads = new DerOutputStream();
        for (AccessDescription accessDescription : accessDescriptions) {
            accessDescription.encode(ads);
        }
        DerOutputStream seq = new DerOutputStream();
        seq.write(DerValue.tag_Sequence, ads);
        this.extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 55 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class AuthorityInfoAccessExtension method encode.

/**
 * Write the extension to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the extension to.
 * @exception IOException on encoding errors.
 */
public void encode(OutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (this.extensionValue == null) {
        this.extensionId = PKIXExtensions.AuthInfoAccess_Id;
        this.critical = false;
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Aggregations

DerOutputStream (sun.security.util.DerOutputStream)125 IOException (java.io.IOException)17 DerValue (sun.security.util.DerValue)11 CertificateEncodingException (java.security.cert.CertificateEncodingException)9 CertificateException (java.security.cert.CertificateException)9 X509Certificate (java.security.cert.X509Certificate)9 ObjectIdentifier (sun.security.util.ObjectIdentifier)9 AlgorithmId (sun.security.x509.AlgorithmId)7 KeyStoreException (java.security.KeyStoreException)6 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)6 UnrecoverableEntryException (java.security.UnrecoverableEntryException)6 UnrecoverableKeyException (java.security.UnrecoverableKeyException)6 SecretKey (javax.crypto.SecretKey)6 DestroyFailedException (javax.security.auth.DestroyFailedException)6 ContentInfo (sun.security.pkcs.ContentInfo)6 BitArray (sun.security.util.BitArray)6 Date (java.util.Date)4 PKCS7 (sun.security.pkcs.PKCS7)4 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)3 InvalidKeyException (java.security.InvalidKeyException)3