summaryrefslogtreecommitdiff
path: root/mocca-1.2.11/smccSTAL/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mocca-1.2.11/smccSTAL/src/test')
-rw-r--r--mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/ASN1Test.java105
-rw-r--r--mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java126
-rw-r--r--mocca-1.2.11/smccSTAL/src/test/resources/log4j.properties19
3 files changed, 0 insertions, 250 deletions
diff --git a/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/ASN1Test.java b/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/ASN1Test.java
deleted file mode 100644
index f2d61e7f..00000000
--- a/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/ASN1Test.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package at.gv.egiz.smcc;
-
-import iaik.me.asn1.ASN1;
-import iaik.me.utils.Base64;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Vector;
-
-import org.junit.Ignore;
-
-@Ignore
-public class ASN1Test {
-
- public static void main(String[] args) throws IOException {
-
- ClassLoader classLoader = ASN1Test.class.getClassLoader();
-
- InputStream stream = classLoader.getResourceAsStream("IdentityLink.bin");
-
- if (stream != null) {
-
- ASN1 identityLink = new ASN1(stream);
- System.out.println("BaseId:" + getBaseId(identityLink));
- identityLink = replaceBaseId(identityLink, "test");
- System.out.println("BaseId:" + getBaseId(identityLink));
-
- String bpk = "hansi";
- MessageDigest sha = null;
- try {
- sha = MessageDigest.getInstance("SHA");
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- sha.update((identityLink + "+" + bpk).getBytes());
- String bpkStr = new String(Base64.encode(sha.digest()));
- System.out.println("bpk: "+bpkStr);
- identityLink = replaceBaseId(identityLink, bpkStr);
- System.out.println(getBaseId(identityLink));
-
- } else {
- System.out.println("Not found.");
- }
-
- }
-
- private static String getBaseId(ASN1 identityLink) throws IOException {
-
- if (identityLink.getType() == ASN1.TYPE_SEQUENCE) {
- ASN1 personData = identityLink.getElementAt(4);
- if (personData.getType() == ASN1.TAG_CONTEXT_SPECIFIC) {
- ASN1 physicalPersonData = personData.gvASN1();
- ASN1 baseId = physicalPersonData.getElementAt(0);
- return baseId.gvString();
- }
- throw new IOException("Invalid structure.");
-
- }
- throw new IOException("Invalid structure.");
-
- }
-
- private static ASN1 replaceBaseId(ASN1 identityLink, String newBaseId)
- throws IOException {
-
- ASN1 newIdentityLink = new ASN1(ASN1.TYPE_SEQUENCE, new Vector<ASN1>());
- for (int i = 0; i < identityLink.getSize(); i++) {
- ASN1 asn1 = identityLink.getElementAt(i);
- if (i == 4 && asn1.getType() == ASN1.TAG_CONTEXT_SPECIFIC) {
- ASN1 physicalPersonData = asn1.gvASN1();
- ASN1 newPhysicalPersonData = new ASN1(ASN1.TYPE_SEQUENCE,
- new Vector<ASN1>());
- newPhysicalPersonData.addElement(new ASN1(ASN1.TYPE_UTF8_STRING,
- newBaseId));
- for (int j = 1; j < physicalPersonData.getSize(); j++) {
- newPhysicalPersonData.addElement(physicalPersonData.getElementAt(j));
- }
- asn1 = new ASN1(ASN1.TAG_CONTEXT_SPECIFIC, newPhysicalPersonData);
- }
- newIdentityLink.addElement(asn1);
- }
- return newIdentityLink;
-
- }
-
-}
diff --git a/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java b/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
deleted file mode 100644
index bf57b0a6..00000000
--- a/mocca-1.2.11/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package at.gv.egiz.smcc;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import javax.smartcardio.Card;
-import javax.smartcardio.CardTerminal;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
-import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler;
-import at.gv.egiz.smcc.pin.gui.PINGUI;
-import at.gv.egiz.stal.ErrorResponse;
-import at.gv.egiz.stal.InfoboxReadRequest;
-import at.gv.egiz.stal.InfoboxReadResponse;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-
-public class AbstractSMCCSTALTest extends AbstractSMCCSTAL implements
- SMCCSTALRequestHandler {
- private int errorConter;
-
- @Override
- protected BKUGUIFacade getGUI() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected boolean waitForCard() {
- signatureCard = new SignatureCard() {
-
- @Override
- public byte[] createSignature(InputStream input, KeyboxName keyboxName,
- PINGUI provider, String alg) throws SignatureCardException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void disconnect(boolean reset) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public byte[] getCertificate(KeyboxName keyboxName)
- throws SignatureCardException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public byte[] getInfobox(String infobox, PINGUI provider,
- String domainId) throws SignatureCardException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void init(Card card, CardTerminal cardTerminal) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setLocale(Locale locale) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Card getCard() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void reset() throws SignatureCardException {
- // TODO Auto-generated method stub
-
- }
- };
- return false;
- }
-
- @Before
- public void setUp() {
- addRequestHandler(InfoboxReadRequest.class, this);
- }
-
- @Test
- @Ignore
- public void testRetry() {
- InfoboxReadRequest irr = new InfoboxReadRequest();
- List<STALRequest> irrl = new ArrayList<STALRequest>();
- irrl.add(irr);
- List<STALResponse> list = handleRequest(irrl);
- Assert.assertFalse(list.get(0) instanceof ErrorResponse);
- }
-
- @Override
- public STALResponse handleRequest(STALRequest request) {
- if (++errorConter < 3) {
- return new ErrorResponse(400);
- }
- return new InfoboxReadResponse();
- }
-
- @Override
- public void init(SignatureCard sc, BKUGUIFacade gui) {
- }
-
- @Override
- public boolean requireCard() {
- return true;
- }
-
-}
diff --git a/mocca-1.2.11/smccSTAL/src/test/resources/log4j.properties b/mocca-1.2.11/smccSTAL/src/test/resources/log4j.properties
deleted file mode 100644
index 053eac17..00000000
--- a/mocca-1.2.11/smccSTAL/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# loglever DEBUG, appender STDOUT
-log4j.rootLogger=TRACE, STDOUT
-#log4j.logger.at.gv.egiz.slbinding.RedirectEventFilter=DEBUG, STDOUT
-
-# STDOUT appender
-log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
-log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
-#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n
-#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n
-
-### FILE appender
-#log4j.appender.file=org.apache.log4j.RollingFileAppender
-#log4j.appender.file.maxFileSize=100KB
-#log4j.appender.file.maxBackupIndex=9
-#log4j.appender.file.File=egovbus_ca.log
-#log4j.appender.file.threshold=info
-#log4j.appender.file.layout=org.apache.log4j.PatternLayout
-#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n \ No newline at end of file