Example usage for org.bouncycastle.asn1 DEROctetString DEROctetString

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

Introduction

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

Prototype

public DEROctetString(ASN1Encodable obj) throws IOException 

Source Link

Document

Constructor from the encoding of an ASN.1 object.

Usage

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

License:Open Source License

/** Constructor for Encoding
 * @param data//from   w  w w.  ja  v a2  s  .  c om
 */
public DiscretionaryData(byte data) {
    this.data = new DEROctetString(new byte[] { data });
}

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

License:Open Source License

/**
 * Fgt ein Tagged Object mit dem Tag (0x80 & tagno) ein.
 * @param tagno/*  ww  w.  ja v a2s .com*/
 * @param data
 */
public void addDataObject(int tagno, byte[] data) {
    objects.add(new DERTaggedObject(false, tagno, new DEROctetString(data)));
}

From source file:de.tsenger.animamea.iso7816.DO87.java

License:Open Source License

public DO87(byte[] data) {
    this.data = data.clone();
    value_ = addPaddingIndicator(data);/*  w  w  w .j  av a 2s.  co  m*/
    //System.out.println("do 87 padding indicator:");
    //System.out.println(Hex.toHexString(value_));
    to = new DERTaggedObject(false, 7, new DEROctetString(value_));
}

From source file:de.tsenger.animamea.iso7816.DO8E.java

License:Open Source License

public DO8E(byte[] checksum) {
    data = checksum.clone();
    to = new DERTaggedObject(false, 0x0E, new DEROctetString(checksum));
}

From source file:de.tsenger.animamea.iso7816.DO97.java

License:Open Source License

public DO97(byte[] le) {
    data = le.clone();
    to = new DERTaggedObject(false, 0x17, new DEROctetString(data));
}

From source file:de.tsenger.animamea.iso7816.DO97.java

License:Open Source License

public DO97(int le) {
    data = new byte[1];
    data[0] = (byte) le;
    to = new DERTaggedObject(false, 0x17, new DEROctetString(data));
    ;/*from   w w  w. ja v  a  2  s . c om*/
}

From source file:de.tsenger.animamea.iso7816.DO99.java

License:Open Source License

public DO99(byte[] le) {
    data = le.clone();
    to = new DERTaggedObject(false, 0x19, new DEROctetString(le));
}

From source file:de.tsenger.animamea.iso7816.MSESetAT.java

License:Open Source License

/**
 * Setzt das Tag 0x83 (Reference of public / secret key) fr Terminal
 * Authentication/*from  w  ww .j  a  v  a  2 s. co  m*/
 * 
 * @param kr
 *            String der den Namen des Public Keys des Terminals beinhaltet
 *            (ISO 8859-1 kodiert)
 */
public void setKeyReference(String kr) {
    DERTaggedObject to = new DERTaggedObject(false, 0x03, new DEROctetString(kr.getBytes()));
    try {
        do83KeyName = to.getEncoded(ASN1Encoding.DER);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:de.tsenger.animamea.iso7816.MSESetAT.java

License:Open Source License

/**
 * Setzt das Tag 0x91 (Ephemeral Public Key). Der PK muss bereits komprimiert 
 * (siehe comp()-Funktion in TR-03110) sein.
 * @param pubKey comp(ephemeral PK_PCD) -> TR-03110 A.2.2.3
 *//*from  www.j av  a2  s .c om*/
public void setEphemeralPublicKey(byte[] pubKey) {
    DERTaggedObject to = new DERTaggedObject(false, 0x11, new DEROctetString(pubKey));
    try {
        do91EphemeralPublicKEy = to.getEncoded(ASN1Encoding.DER);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:de.tsenger.animamea.ta.TAOperator.java

License:Open Source License

/**
 * @param pubKeyRef//from   w  w  w  . jav a2  s.  c  o m
 * @return
 * @throws CardException
 * @throws SecureMessagingException
 * @throws TAException 
 */
private ResponseAPDU sendMSESetDST(String pubKeyRef)
        throws SecureMessagingException, CardException, TAException {

    DERTaggedObject do83 = new DERTaggedObject(false, 0x03, new DEROctetString(pubKeyRef.getBytes()));
    byte[] data = null;

    try {
        data = do83.getEncoded(ASN1Encoding.DER);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    CommandAPDU setdst = new CommandAPDU(0x00, 0x22, 0x81, 0xB6, data);

    ResponseAPDU resp = cardHandler.transceive(setdst);
    if (resp.getSW1() != 0x90)
        throw new TAException("MSE:Set AT failed " + HexString.bufferToHex(resp.getBytes()));

    return resp;
}