Example usage for org.bouncycastle.asn1 ASN1EncodableVector add

List of usage examples for org.bouncycastle.asn1 ASN1EncodableVector add

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 ASN1EncodableVector add.

Prototype

public void add(ASN1Encodable element) 

Source Link

Usage

From source file:net.jsign.asn1.authenticode.AuthenticodeTimeStampRequest.java

License:Apache License

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(AuthenticodeObjectIdentifiers.SPC_TIME_STAMP_REQUEST_OBJID);
    v.add(contenInfo);/*w w w .  j a v  a 2s.co m*/
    return new DERSequence(v);
}

From source file:net.jsign.asn1.authenticode.SpcAttributeTypeAndOptionalValue.java

License:Apache License

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(type);
    if (value != null) {
        v.add(value);//from w w w  . ja va 2s.  c o m
    }

    return new BERSequence(v);
}

From source file:net.jsign.asn1.authenticode.SpcIndirectDataContent.java

License:Apache License

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(data);
    v.add(messageDigest);//from w  ww .  j  a  v a 2  s  .  c  om

    return new BERSequence(v);
}

From source file:net.jsign.asn1.authenticode.SpcPeImageData.java

License:Apache License

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(flags);
    v.add(new DERTaggedObject(0, file)); // contrary to the specification this is tagged (as observed in actual signed executables)

    return new BERSequence(v);
}

From source file:net.jsign.asn1.authenticode.SpcSerializedObject.java

License:Apache License

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(classId);
    v.add(serializedData);/*w  ww. j  av  a 2  s . c  o m*/

    return new DERSequence(v);
}

From source file:net.jsign.asn1.authenticode.SpcSpOpusInfo.java

License:Apache License

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (programName != null) {
        v.add(new DERTaggedObject(true, 0, programName));
    }/*from w  w w.j  a  va 2 s .c  o m*/

    if (moreInfo != null) {
        v.add(new DERTaggedObject(true, 1, moreInfo));
    }

    return new BERSequence(v);
}

From source file:net.markenwerk.utils.mail.smime.SmimeUtil.java

License:Open Source License

private static ASN1EncodableVector getSignedAttributes(SmimeKey smimeKey) {
    ASN1EncodableVector signedAttributes = new ASN1EncodableVector();
    IssuerAndSerialNumber issuerAndSerialNumber = getIssuerAndSerialNumber(smimeKey);
    signedAttributes.add(new SMIMEEncryptionKeyPreferenceAttribute(issuerAndSerialNumber));
    signedAttributes.add(new SMIMECapabilitiesAttribute(getCapabilityVector()));
    return signedAttributes;
}

From source file:net.ripe.rpki.commons.crypto.cms.manifest.ManifestCmsBuilder.java

License:BSD License

ASN1Encodable encodeFileList() {
    ASN1EncodableVector seq = new ASN1EncodableVector();
    for (Map.Entry<String, byte[]> fileAndHash : files.entrySet()) {
        seq.add(encodeFileAndHash(fileAndHash.getKey(), fileAndHash.getValue()));
    }/*w  w  w. j  a v  a2 s .  c o m*/
    return new DERSequence(seq);
}

From source file:net.schmizz.sshj.signature.SignatureDSA.java

License:Apache License

/**
 * Encodes the signature as a DER sequence (ASN.1 format).
 *///  ww w.  j a  v a2  s .  c o m
private byte[] asnEncode(byte[] sigBlob) throws IOException {
    byte[] r = new BigInteger(1, Arrays.copyOfRange(sigBlob, 0, 20)).toByteArray();
    byte[] s = new BigInteger(1, Arrays.copyOfRange(sigBlob, 20, 40)).toByteArray();

    ASN1EncodableVector vector = new ASN1EncodableVector();
    vector.add(new ASN1Integer(r));
    vector.add(new ASN1Integer(s));

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ASN1OutputStream asnOS = new ASN1OutputStream(baos);

    asnOS.writeObject(new DERSequence(vector));
    asnOS.flush();

    return baos.toByteArray();
}

From source file:net.schmizz.sshj.signature.SignatureECDSA.java

License:Apache License

/**
 * Encodes the signature as a DER sequence (ASN.1 format).
 *//*ww w  . j ava  2  s.  c  om*/
private byte[] asnEncode(byte[] sigBlob) throws IOException {
    Buffer.PlainBuffer sigbuf = new Buffer.PlainBuffer(sigBlob);
    byte[] r = sigbuf.readBytes();
    byte[] s = sigbuf.readBytes();

    ASN1EncodableVector vector = new ASN1EncodableVector();
    vector.add(new ASN1Integer(r));
    vector.add(new ASN1Integer(s));

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ASN1OutputStream asnOS = new ASN1OutputStream(baos);

    asnOS.writeObject(new DERSequence(vector));
    asnOS.flush();

    return baos.toByteArray();
}