Example usage for org.bouncycastle.asn1 DERApplicationSpecific DERApplicationSpecific

List of usage examples for org.bouncycastle.asn1 DERApplicationSpecific DERApplicationSpecific

Introduction

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

Prototype

public DERApplicationSpecific(int tagNo, ASN1EncodableVector vec) 

Source Link

Document

Create an application specific object which is marked as constructed

Usage

From source file:au.com.nullpointer.gp.GPCardManager.java

License:Open Source License

/**
 * @param aid/*from   ww w.j  av a  2 s .co  m*/
 * @param withObjects
 */
public void delete(boolean withRelated, AID... aids) {
    int p2 = withRelated ? 0x80 : 0x00;

    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    for (AID aid : aids) {
        try {
            bos.write(new DERApplicationSpecific(DELETE_APPLICATION, aid.getAid()).getDEREncoded());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    ifd.transmit(0x80, 0xe4, 0x00, p2, bos.toByteArray());
}

From source file:com.github.horrorho.inflatabledonkey.data.der.DER.java

License:Open Source License

static DERApplicationSpecific toApplicationSpecific(int tag, ASN1Encodable encodable) {
    try {/*from  w w  w  . j av a2  s.  c  o m*/
        return new DERApplicationSpecific(tag, encodable);

    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }
}

From source file:com.hierynomus.spnego.SpnegoToken.java

License:Apache License

protected void writeGss(Buffer<?> buffer, ASN1EncodableVector negToken) throws IOException {
    DERTaggedObject negotiationToken = new DERTaggedObject(true, tokenTagNo, new DERSequence(negToken));

    ASN1EncodableVector implicitSeqGssApi = new ASN1EncodableVector();
    implicitSeqGssApi.add(SPNEGO);/*from   w w w .  jav a  2s .  co m*/
    implicitSeqGssApi.add(negotiationToken);

    DERApplicationSpecific gssApiHeader = new DERApplicationSpecific(0x0, implicitSeqGssApi);
    buffer.putRawBytes(gssApiHeader.getEncoded());
}

From source file:common.crypto.bouncycastle.CDERApplicationSpecificBC.java

License:Open Source License

public CDERApplicationSpecificBC(int nTagNo, IASN1EncodableVector vec) {
    m_adaptedObject = new DERApplicationSpecific(nTagNo, (ASN1EncodableVector) vec.getObject());
}

From source file:de.fraunhofer.fokus.openeid.pace.auth.AuthenticationToken.java

License:Open Source License

public static byte[] computeMAC(MAC macAlgorithm, Key K_mac, PACEInfoProtocol oid, ECPoint publicKey) {
    //0x86 0x04 ...
    DERTaggedObject pcdPoint = new DERTaggedObject(false, 0x06, new DEROctetString(publicKey.getEncoded()));

    //0x06/*from  w  ww  . j  a v  a 2  s  .  co m*/
    DERObjectIdentifier derOid = new DERObjectIdentifier(oid.getOid());

    ASN1EncodableVector outerValue = new ASN1EncodableVector();
    outerValue.add(derOid);
    outerValue.add(pcdPoint);
    //see X.690-0207 section 8.1.2.4.3
    DERApplicationSpecific outer = new DERApplicationSpecific(0x49, outerValue);

    logger.debug("mac input: " + Utils.byteArrayToHexString(outer.getDEREncoded()));

    byte[] keyMacBytes = K_mac.getKey();
    byte[] mac = macAlgorithm.compute(outer.getDEREncoded(), keyMacBytes);

    //IMPORTANT only the first 8 bytes are necessary, all following bytes are 0 anyways
    byte[] rangedMac = Arrays.copyOfRange(mac, 0, 8);
    logger.debug("mac      : " + Utils.byteArrayToHexString(mac));
    return rangedMac;
}

From source file:de.tsenger.animamea.asn1.AmPublicKey.java

License:Open Source License

@Override
public ASN1Primitive toASN1Primitive() {
    return new DERApplicationSpecific(0x49, vec);
}

From source file:de.tsenger.animamea.asn1.CertificateHolderAuthorizationTemplate.java

License:Open Source License

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

    return new DERApplicationSpecific(0x4c, v);
}

From source file:de.tsenger.animamea.asn1.CVCertBody.java

License:Open Source License

/**
 * CVCertBody contains://from  ww  w  . j a  va 2 s .c  o m
 * - Certificate Profile Identifier
 * - Certificate Authority Reference
 * - Public Key
 * - Certificate Holder Reference
 * - Certificate Holder Authorization Template
 * - Certificate Effective Date
 * - Certificate Expiration Date
 * - Certificate Extensions (OPTIONAL)
 * 
 */
@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    try {
        v.add(new DERApplicationSpecific(0x29, profileIdentifier));
        v.add(new DERApplicationSpecific(0x02, authorityReference));
        v.add(publicKey);
        v.add(new DERApplicationSpecific(0x20, chr));
        v.add(chat);
        v.add(new DERApplicationSpecific(0x25, effectiveDate));
        v.add(new DERApplicationSpecific(0x24, expirationDate));
        if (extensions != null)
            v.add(new DERApplicationSpecific(0x05, extensions));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return new DERApplicationSpecific(0x4E, v);
}

From source file:de.tsenger.animamea.asn1.CVCertificate.java

License:Open Source License

/** 
 * The definition of CVCertificate is/*from   ww w.  ja v a 2  s.co  m*/
  * <pre>
  * CVCertificate ::=  SEQUENCE {
  *      body        CVCertBody
  *      signature   CVCertSignature
  * }
  * </pre>
 */
@Override

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

    v.add(certBody);
    v.add(certSignature);

    return new DERApplicationSpecific(0x21, v);
}

From source file:de.tsenger.animamea.asn1.CVCertSignature.java

License:Open Source License

public CVCertSignature(byte[] signatureContent) {
    cvcsig = new DERApplicationSpecific(0x37, signatureContent);
}