From ab3d4fc97d673afce126e62be160c2feb4e6e588 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Mon, 18 Dec 2006 14:17:02 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'Build_ID-1_3_3'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/Build_ID-1_3_3@757 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss.test/src/testgenerator/TestPKCS12.java | 107 ---------------------------- 1 file changed, 107 deletions(-) delete mode 100644 spss.test/src/testgenerator/TestPKCS12.java (limited to 'spss.test/src/testgenerator/TestPKCS12.java') diff --git a/spss.test/src/testgenerator/TestPKCS12.java b/spss.test/src/testgenerator/TestPKCS12.java deleted file mode 100644 index 97aa8acd0..000000000 --- a/spss.test/src/testgenerator/TestPKCS12.java +++ /dev/null @@ -1,107 +0,0 @@ - -package testgenerator; -import iaik.pkcs.pkcs12.CertificateBag; -import iaik.pkcs.pkcs12.KeyBag; -import iaik.pkcs.pkcs12.PKCS12; -import iaik.security.ecc.ecdsa.ECPrivateKey; -import iaik.security.ecc.ecdsa.ECPublicKey; -import iaik.security.ecc.math.ecgroup.ECPoint; - -import java.io.FileInputStream; - - -/** - * @author stephan - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class TestPKCS12 { - -/* - public static void main(String[] args) throws Exception { - -// String file = "C:/Daten/MOAPhase2/additionalFiles/keys/TestUser.p12"; -// String password = "testuser"; -// String file = "C:\\Certs\\grill(1234).p12"; -// String password = "1234"; - - // SL eCard Demo P12 Files - String file = "C:\\Daten\\MOAPhase2\\Keys\\sl2002mmdd.ecard.sicher(ego).p12"; - String password = "ego"; -// String file = "C:\\Daten\\MOAPhase2\\Keys\\sl2002mmdd.ecard.normal(ego).p12"; -// String password = "ego"; - - // SL Personalausweis Demo P12 Files -// String file = "C:\\Daten\\MOAPhase2\\Keys\\sicher-demo(buergerkarte).p12"; -// String password = "buergerkarte"; -// String file = "C:\\Daten\\MOAPhase2\\Keys\\normal().p12"; -// String password = ""; - - IAIK.addAsJDK14Provider(); - - FileInputStream pkcs12FIS = new FileInputStream(file); - PKCS12 pkcs12 = new PKCS12(pkcs12FIS); - if (!pkcs12.verify(password.toCharArray())) - { - System.out.println("could not PKCS12.verify file " + file + " with password " + password); - } else - { - System.out.println("could PKCS12.verify file " + file + " with password " + password); - } - - pkcs12.decrypt(password.toCharArray()); - System.out.println("could PKCS12.decrypt file " + file + " with password " + password); - - KeyBag[] keyBags = pkcs12.getKeyBags(); - System.out.println("PKCS12.getKeyBags(): " + keyBags.length + " KeyBags found"); - - RSAPrivateKey privKey = (RSAPrivateKey) keyBags[0].getPrivateKey(); - System.out.println("getFriendlyName(): " + keyBags[0].getFriendlyName() ); - - X509Certificate[] certBag = CertificateBag.getCertificates(pkcs12.getCertificateBags()); - System.out.println("PKCS12.getCertificates(): " + certBag.length + " certificates found"); - - System.out.println("certBag[0]: " + certBag[0]); - - } -*/ - - public static void main(String[] args) throws Exception { - // von Wolfgang Bauer - iaik.security.provider.IAIK.addAsProvider(); - iaik.security.ecc.provider.ECCProvider.addAsProvider(); - - final String FILENAME = "sl2002mmdd.ecard.sicher.p12"; - final char[] PASSWORD = "ego".toCharArray(); -// public final static String FILENAME = "sl2002mmdd.ecard.sicher.p12"; -// public final static char[] PASSWORD = "ego".toCharArray(); - - System.out.println("Checking"); - FileInputStream fis = new FileInputStream(FILENAME); - PKCS12 p12 = new PKCS12(fis); - p12.decrypt(PASSWORD); - CertificateBag[] cb = p12.getCertificateBags(); - - KeyBag kb = p12.getKeyBag(); - ECPrivateKey pk = (ECPrivateKey) kb.getPrivateKey(); - - ECPoint p = pk.getParameter().getG(); - p.multiply(pk.getS()); - - ECPoint p2 = ((ECPublicKey)cb[0].getCertificate().getPublicKey()).getW(); - if (p.equals(p2) ) { - System.out.println("Check OK"); - } else { - System.out.println("Nix wars"); - } - cb[0].getCertificate().verify(); - - } - - - -} - -- cgit v1.2.3