Search in sources :

Example 16 with Sequence

use of com.google.showcase.v1beta1.Sequence in project jss by dogtagpki.

the class AVA method encode.

@Override
public void encode(Tag implicit, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    seq.addElement(oid);
    seq.addElement(value);
    seq.encode(implicit, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE)

Example 17 with Sequence

use of com.google.showcase.v1beta1.Sequence in project jss by dogtagpki.

the class Attribute method encode.

@Override
public void encode(Tag implicit, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    seq.addElement(type);
    seq.addElement(values);
    seq.encode(implicit, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE)

Example 18 with Sequence

use of com.google.showcase.v1beta1.Sequence in project jss by dogtagpki.

the class PKCS12Util method createKeyBagAttrs.

SET createKeyBagAttrs(PKCS12KeyInfo keyInfo) throws Exception {
    SET attrs = new SET();
    String friendlyName = keyInfo.getFriendlyName();
    logger.debug("   Friendly name: " + friendlyName);
    SEQUENCE subjectAttr = new SEQUENCE();
    subjectAttr.addElement(SafeBag.FRIENDLY_NAME);
    SET subjectSet = new SET();
    subjectSet.addElement(new BMPString(friendlyName));
    subjectAttr.addElement(subjectSet);
    attrs.addElement(subjectAttr);
    byte[] keyID = keyInfo.getID();
    SEQUENCE localKeyAttr = new SEQUENCE();
    localKeyAttr.addElement(SafeBag.LOCAL_KEY_ID);
    SET localKeySet = new SET();
    localKeySet.addElement(new OCTET_STRING(keyID));
    localKeyAttr.addElement(localKeySet);
    attrs.addElement(localKeyAttr);
    return attrs;
}
Also used : SET(org.mozilla.jss.asn1.SET) OCTET_STRING(org.mozilla.jss.asn1.OCTET_STRING) SEQUENCE(org.mozilla.jss.asn1.SEQUENCE) BMPString(org.mozilla.jss.asn1.BMPString) BMPString(org.mozilla.jss.asn1.BMPString)

Example 19 with Sequence

use of com.google.showcase.v1beta1.Sequence in project jss by dogtagpki.

the class PKCS12Util method getKeyInfos.

public void getKeyInfos(PKCS12 pkcs12, PFX pfx, Password password) throws Exception {
    logger.debug("Load encrypted private keys:");
    AuthenticatedSafes safes = pfx.getAuthSafes();
    for (int i = 0; i < safes.getSize(); i++) {
        SEQUENCE contents = safes.getSafeContentsAt(password, i);
        for (int j = 0; j < contents.size(); j++) {
            SafeBag bag = (SafeBag) contents.elementAt(j);
            OBJECT_IDENTIFIER oid = bag.getBagType();
            if (!oid.equals(SafeBag.PKCS8_SHROUDED_KEY_BAG))
                continue;
            logger.debug(" - Private key:");
            PKCS12KeyInfo keyInfo = getKeyInfo(bag, password);
            pkcs12.addKeyInfo(keyInfo);
        }
    }
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE) OBJECT_IDENTIFIER(org.mozilla.jss.asn1.OBJECT_IDENTIFIER) SafeBag(org.mozilla.jss.pkcs12.SafeBag) AuthenticatedSafes(org.mozilla.jss.pkcs12.AuthenticatedSafes)

Example 20 with Sequence

use of com.google.showcase.v1beta1.Sequence in project jss by dogtagpki.

the class Extension method encode.

@Override
public void encode(Tag implicit, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    seq.addElement(extnId);
    if (critical == true) {
        // false is default, so we only code true
        seq.addElement(new BOOLEAN(true));
    }
    seq.addElement(extnValue);
    seq.encode(implicit, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE) BOOLEAN(org.mozilla.jss.asn1.BOOLEAN)

Aggregations

SEQUENCE (org.mozilla.jss.asn1.SEQUENCE)50 OCTET_STRING (org.mozilla.jss.asn1.OCTET_STRING)16 Sequence (org.sbolstandard.core2.Sequence)11 SET (org.mozilla.jss.asn1.SET)9 ANY (org.mozilla.jss.asn1.ANY)8 InvalidBERException (org.mozilla.jss.asn1.InvalidBERException)8 OBJECT_IDENTIFIER (org.mozilla.jss.asn1.OBJECT_IDENTIFIER)8 URI (java.net.URI)7 BMPString (org.mozilla.jss.asn1.BMPString)7 CryptoToken (org.mozilla.jss.crypto.CryptoToken)7 ASN1Value (org.mozilla.jss.asn1.ASN1Value)6 INTEGER (org.mozilla.jss.asn1.INTEGER)6 AuthenticatedSafes (org.mozilla.jss.pkcs12.AuthenticatedSafes)6 FileOutputStream (java.io.FileOutputStream)5 IOException (java.io.IOException)5 SignatureException (java.security.SignatureException)5 EXPLICIT (org.mozilla.jss.asn1.EXPLICIT)5 SafeBag (org.mozilla.jss.pkcs12.SafeBag)5 Certificate (org.mozilla.jss.pkix.cert.Certificate)5 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)5