Search in sources :

Example 21 with TLV

use of org.openecard.common.tlv.TLV in project open-ecard by ecsec.

the class ReadHelper method readCIAFile.

public static TLV readCIAFile(String name) throws IOException, TLVException {
    String path = "/df.cia/" + name;
    InputStream ins = ReadHelper.class.getResourceAsStream(path);
    ByteArrayOutputStream outs = new ByteArrayOutputStream(ins.available());
    int next;
    while ((next = ins.read()) != -1) {
        outs.write((byte) next);
    }
    byte[] resultBytes = outs.toByteArray();
    TLV result = TLV.fromBER(resultBytes);
    return result;
}
Also used : InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TLV(org.openecard.common.tlv.TLV)

Aggregations

TLV (org.openecard.common.tlv.TLV)21 Test (org.testng.annotations.Test)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 GeneralSecurityException (java.security.GeneralSecurityException)3 CardCommandAPDU (org.openecard.common.apdu.common.CardCommandAPDU)3 TLVException (org.openecard.common.tlv.TLVException)3 BigInteger (java.math.BigInteger)2 Cipher (javax.crypto.Cipher)2 CMac (org.openecard.bouncycastle.crypto.macs.CMac)2 ManageSecurityEnvironment (org.openecard.common.apdu.ManageSecurityEnvironment)2 CardResponseAPDU (org.openecard.common.apdu.common.CardResponseAPDU)2 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)1 DIDStructureType (iso.std.iso_iec._24727.tech.schema.DIDStructureType)1 DataMaskType (iso.std.iso_iec._24727.tech.schema.DataMaskType)1 DecipherResponse (iso.std.iso_iec._24727.tech.schema.DecipherResponse)1 SignResponse (iso.std.iso_iec._24727.tech.schema.SignResponse)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MessageDigest (java.security.MessageDigest)1