diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-11-04 10:14:12 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-11-04 10:14:12 +0000 |
commit | f1df66711b7e81159ac0a998f2764efb55fc468d (patch) | |
tree | ab7de7daa2d75d8fe5f9ddfb4298764ce7376de0 /smccTest/src | |
parent | 70119c48e95272f1f9dfc5f92d5c0c349e4fa7cc (diff) | |
download | mocca-f1df66711b7e81159ac0a998f2764efb55fc468d.tar.gz mocca-f1df66711b7e81159ac0a998f2764efb55fc468d.tar.bz2 mocca-f1df66711b7e81159ac0a998f2764efb55fc468d.zip |
e-card sig cert
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@818 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'smccTest/src')
-rw-r--r-- | smccTest/src/test/java/at/gv/egiz/pkcs15test/PKCS15Test.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/smccTest/src/test/java/at/gv/egiz/pkcs15test/PKCS15Test.java b/smccTest/src/test/java/at/gv/egiz/pkcs15test/PKCS15Test.java index 324ec1d4..a80210c5 100644 --- a/smccTest/src/test/java/at/gv/egiz/pkcs15test/PKCS15Test.java +++ b/smccTest/src/test/java/at/gv/egiz/pkcs15test/PKCS15Test.java @@ -8,8 +8,10 @@ import iaik.asn1.ASN1Object; import iaik.asn1.CodingException; import iaik.asn1.DerCoder; //import iaik.security.provider.IAIK; +import iaik.security.ecc.provider.ECCProvider; import iaik.security.provider.IAIK; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.Charset; @@ -68,6 +70,7 @@ public class PKCS15Test { public void setUp() throws NoSuchAlgorithmException, CardException { IAIK.addAsJDK14Provider(); + ECCProvider.addAsProvider(); System.out.println("create terminalFactory...\n"); TerminalFactory terminalFactory = TerminalFactory.getInstance("PC/SC", null); @@ -336,6 +339,24 @@ public class PKCS15Test { System.out.println(" -> " + toString(resp.getBytes()) + "\n"); System.out.println(new TLVSequence(new TLVSequence(resp.getData()).getValue(0x6f))); + System.out.println("SELECT CERTIFICATE"); + cmdAPDU = new CommandAPDU(0x00, 0xA4, 0x02, 0x00, new byte[] { (byte) 0xc0, (byte) 0x00 }, 256); + System.out.println(" cmd apdu " + toString(cmdAPDU.getBytes())); + resp = basicChannel.transmit(cmdAPDU); + System.out.println(" -> " + toString(resp.getBytes()) + "\n"); + + X509Certificate certificate = null; + try { + System.out.println("READ cert?"); + CertificateFactory certificateFactory = CertificateFactory.getInstance("X509"); + certificate = (X509Certificate) certificateFactory.generateCertificate(ISO7816Utils.openTransparentFileInputStream(basicChannel, -1)); +// certificate = certificateFactory.generateCertificate(new BASE64DecoderStream(new ByteArrayInputStream(CERT.getBytes()))); +// System.out.println("certificate: \n" + toString(certificate.getEncoded())); + System.out.println("certificate: \n" + certificate); + } catch (CertificateException e) { + e.printStackTrace(); + } + byte[] fid = new byte[] {(byte) 0x00, (byte) 0x30 }; System.out.println("SELECT EF FID=" + toString(fid)); cmdAPDU = new CommandAPDU(0x00, 0xA4, 0x02, 0x04, fid, 256); |