diff options
98 files changed, 4973 insertions, 2926 deletions
| diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java index b5f34689..f63289e3 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java @@ -427,9 +427,9 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement  						currentState = State.FINISHED;  					}  				} else { -					log.debug("Content type not set in dataurl response."); +					log.info("Content type not set in dataurl response.");  					closeDataUrlConnection(); -					throw new SLBindingException(2007); +                    throw new SLBindingException(2007);  				}  				break; @@ -483,7 +483,7 @@ public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implement  				// issue error  				log.info("Unexpected response code from dataurl server: {}.",   				    dataUrlResponse.getResponseCode()); -				throw new SLBindingException(2007); +                throw new SLBindingException(2007);  			}  		} catch (SLException slx) { diff --git a/smcc/pom.xml b/smcc/pom.xml index aaca66d1..bedbbaa0 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -37,5 +37,10 @@        <artifactId>iaik_jce_full_signed</artifactId>        <scope>test</scope>      </dependency> +    <dependency> +      <groupId>org.springframework</groupId> +      <artifactId>spring-context</artifactId> +      <scope>test</scope> +    </dependency>    </dependencies>  </project>
\ No newline at end of file diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java index eea1b6ed..bb913c67 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java @@ -166,7 +166,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC    @Override    @Exclusive    public byte[] getCertificate(KeyboxName keyboxName) -      throws SignatureCardException, InterruptedException { +      throws SignatureCardException {        byte[] aid;        byte[] fid; @@ -240,7 +240,13 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC        // READ BINARY        while(true) {          try { -          return ISO7816Utils.readTransparentFileTLV(channel, maxSize, (byte) 0x30); +          byte[] idLink = ISO7816Utils.readTransparentFileTLV(channel, maxSize, +              (byte) 0x30); +          if (idLink != null) { +            return idLink; +          } else { +            throw new NotActivatedException(); +          }          } catch (SecurityStatusNotSatisfiedException e) {            verifyPINLoop(channel, infPinInfo, provider);          } @@ -299,7 +305,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC        }        // empty -      return null; +      throw new NotActivatedException();      } catch (FileNotFoundException e) {        throw new NotActivatedException(); @@ -472,7 +478,11 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC     * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getpinInfos()     */    @Override -  public PinInfo[] getPinInfos() { +  public PinInfo[] getPinInfos() throws SignatureCardException { +     +    //check if card is activated +    getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); +          if (appVersion < 2) {        return new PinInfo[] {decPinInfo, sigPinInfo, infPinInfo };      } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java index 01d8639a..f092b3fc 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java @@ -283,7 +283,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu          }          // empty -        return null; +        throw new NotActivatedException();        } else if ("Status".equals(infobox)) { diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java index 444de316..f7a8d58b 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java @@ -118,7 +118,7 @@ public class ISO7816Utils {        // check expected type        int b = is.read(); -      if (b == 0x00) { +      if (b == 0x00 || b == 0xFF) {          return null;        }        if (b == -1 || expectedType != (0xFF & b)) { diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/SwissSignIDCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/SwissSignIDCard.properties new file mode 100644 index 00000000..1a637af1 --- /dev/null +++ b/smcc/src/main/resources/at/gv/egiz/smcc/SwissSignIDCard.properties @@ -0,0 +1,20 @@ +# 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. + +# To change this template, choose Tools | Templates +# and open the template in the editor. + +pin.name=PIN +pin.length=5-12
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/AbstractAppl.java b/smcc/src/test/java/at/gv/egiz/smcc/AbstractAppl.java index affb06ff..62339591 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/AbstractAppl.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/AbstractAppl.java @@ -20,15 +20,34 @@ import java.util.ArrayList;  import java.util.HashMap;  import java.util.List; -import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU;  public abstract class AbstractAppl implements CardAppl { -  public final HashMap<Integer, PIN> pins = new HashMap<Integer, PIN>(); +  /** +   * The Application Identifier. +   */ +  private byte[] aid; +   +  /** +   * The File Identifier. +   */ +  private byte[] fid; +   +  /** +   * The File Control (Information / Parameter) +   */ +  private byte[] fcx; +   +  /** +   * The PINs used by this Application. +   */ +  public HashMap<Integer, PIN> pins = new HashMap<Integer, PIN>(); +  /** +   * The Files used by this Application. +   */    protected List<File> files = new ArrayList<File>();    public void checkINS(CommandAPDU command, int ins) { @@ -37,12 +56,54 @@ public abstract class AbstractAppl implements CardAppl {      }    } +  public void setAid(byte[] aID) { +    aid = aID; +  } + +  @Override +  public byte[] getAID() { +    return aid; +  } + +  public void setFid(byte[] fid) { +    this.fid = fid; +  } +    @Override -  public abstract byte[] getAID(); +  public byte[] getFID() { +    return fid; +  } + +  public void setFcx(byte[] fcx) { +    this.fcx = fcx; +  }    @Override -  public abstract byte[] getFCI(); +  public byte[] getFCX() { +    return fcx; +  } +  /** +   * @return the pins +   */ +  public HashMap<Integer, PIN> getPins() { +    return pins; +  } + +  /** +   * @param pins the pins to set +   */ +  public void setPins(HashMap<Integer, PIN> pins) { +    this.pins = pins; +  } + +  /** +   * @param files the files to set +   */ +  public void setFiles(List<File> files) { +    this.files = files; +  } +    public void putFile(File file) {      files.add(file);    } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardAppl.java b/smcc/src/test/java/at/gv/egiz/smcc/CardAppl.java index 76a3e567..e8d89af0 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardAppl.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/CardAppl.java @@ -21,14 +21,13 @@ import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU; -@SuppressWarnings("restriction")  public interface CardAppl {    public byte[] getAID();    public byte[] getFID(); -  public byte[] getFCI(); +  public byte[] getFCX();    public void leaveApplContext(); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/CardChannelEmul.java index bfe4e31c..cd4397b3 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/CardChannelEmul.java @@ -18,20 +18,18 @@ package at.gv.egiz.smcc;  import java.nio.ByteBuffer; +import javax.smartcardio.Card;  import javax.smartcardio.CardChannel;  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU; -@SuppressWarnings("restriction")  public abstract class CardChannelEmul extends CardChannel { +   +  protected CardEmul cardEmul;    protected AbstractAppl currentAppl = null;    protected File currentFile = null; -  public CardChannelEmul() { -    super(); -  } -    @Override    public int getChannelNumber() {      return 0; @@ -49,4 +47,12 @@ public abstract class CardChannelEmul extends CardChannel {      return responseBytes.length;    } +  public Card getCard() { +    return cardEmul; +  } + +  public void setCardEmul(CardEmul card) { +    this.cardEmul = card; +  } +  }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/CardEmul.java index 3dfc8510..36794903 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/CardEmul.java @@ -1,79 +1,101 @@  /* -* 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. -*/ + * 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 java.util.ArrayList;  import java.util.Arrays;  import java.util.List; +import javax.smartcardio.ATR;  import javax.smartcardio.Card;  import javax.smartcardio.CardChannel;  import javax.smartcardio.CardException; +public class CardEmul extends Card { -@SuppressWarnings("restriction") -public abstract class CardEmul extends Card { - -  protected Thread exclThread; // = null; -  protected CardChannel channel; // = newCardChannel(this); +  protected ATR atr; +   +  protected Thread exclThread; +  protected CardChannel basicChannel;    protected List<AbstractAppl> applications = new ArrayList<AbstractAppl>();    public CardEmul() {      super();    } -//  protected abstract CardChannelEmul newCardChannel(CardEmul cardEmul); +  public void setAtr(byte[] atr) { +    this.atr = new ATR(atr); +  } + +  /** +   * @param basicChannel +   *          the basicChannel to set +   */ +  public void setBasicChannel(CardChannel basicChannel) { +    this.basicChannel = basicChannel; +  } + +  /** +   * @param applications +   *          the applications to set +   */ +  public void setApplications(List<AbstractAppl> applications) { +    this.applications = applications; +  }    @Override    public void beginExclusive() throws CardException { -     +      if (exclThread == Thread.currentThread()) { -      throw new CardException("Exclusive access already assigned to current thread."); +      throw new CardException( +          "Exclusive access already assigned to current thread.");      } else if (exclThread != null) { -      throw new CardException("Exclusive access already assigned to another thread."); +      throw new CardException( +          "Exclusive access already assigned to another thread.");      } -   +      exclThread = Thread.currentThread(); -     +    }    @Override    public void endExclusive() throws CardException { -     +      if (exclThread == Thread.currentThread()) {        exclThread = null;      } else if (exclThread == null) {        throw new CardException("Exclusive access has not been assigned.");      } else { -      throw new CardException("Exclusive access has not been assigned to current thread."); +      throw new CardException( +          "Exclusive access has not been assigned to current thread.");      } -   +    }    @Override    public CardChannel getBasicChannel() { -    return channel; +    return basicChannel;    }    @Override    public void disconnect(boolean reset) throws CardException { -//    if (reset) { -//      channel = newCardChannel(this); -//    } +    // if (reset) { +    // channel = newCardChannel(this); +    // }    }    @Override @@ -89,18 +111,24 @@ public abstract class CardEmul extends Card {    @Override    public byte[] transmitControlCommand(int arg0, byte[] arg1)        throws CardException { -            throw new CardException("transmitControlCommand() not supported."); -      } +    throw new CardException("transmitControlCommand() not supported."); +  } + +  @Override +  public ATR getATR() { +    return atr; +  }    public AbstractAppl getApplication(byte[] fid) { -    for(AbstractAppl appl : applications) { -      if (Arrays.equals(appl.getAID(), fid) || Arrays.equals(appl.getFID(), fid)) { +    for (AbstractAppl appl : applications) { +      if (Arrays.equals(appl.getAID(), fid) +          || Arrays.equals(appl.getFID(), fid)) {          return appl;        }      }      return null; -     +    }  }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java deleted file mode 100644 index 17a8a03f..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java +++ /dev/null @@ -1,220 +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 at.gv.egiz.smcc.pin.gui.CancelPINProvider; -import at.gv.egiz.smcc.pin.gui.InterruptPINProvider; -import at.gv.egiz.smcc.pin.gui.CancelChangePINProvider; -import static org.junit.Assert.*; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; - -import javax.smartcardio.Card; - -import org.junit.Test; - -import at.gv.egiz.smcc.SignatureCard.KeyboxName; -import at.gv.egiz.smcc.acos.A04ApplDEC; -import at.gv.egiz.smcc.pin.gui.DummyPINGUI; -import at.gv.egiz.smcc.pin.gui.ModifyPINGUI; -import at.gv.egiz.smcc.pin.gui.PINGUI; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; - -@SuppressWarnings("restriction") -public abstract class CardTest { - -  public CardTest() { -    super(); -  } - -  protected abstract SignatureCard createSignatureCard() -      throws CardNotSupportedException; - -  @Test -  public void testGetCard() throws CardNotSupportedException { -    SignatureCard signatureCard = createSignatureCard(); -    Card card = signatureCard.getCard(); -    assertNotNull(card); -  } - -  @Test -  public void testGetInfoboxIdentityLink() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    final char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -     -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider(pin); - -    byte[] idlink = signatureCard.getInfobox("IdentityLink", -        pinProvider, null); -    assertNotNull(idlink); -    assertTrue(Arrays.equals(idlink, A04ApplDEC.IDLINK)); -    assertEquals(1, pinProvider.provided); - -  } - -  @Test(expected = CancelledException.class) -  public void testSignSIGCancel() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new CancelPINProvider(); -       -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, pinProvider, -        null); -       -      } - -  @Test(expected = CancelledException.class) -  public void testSignDECCancel() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new CancelPINProvider(); -       -        signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -            .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -            pinProvider, null); -       -      } - -  @Test(expected = InterruptedException.class) -  public void testSignSIGInterrrupted() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new InterruptPINProvider(); -       -        signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -            .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -            pinProvider, null); -       -      } - -  @Test(expected = InterruptedException.class) -  public void testSignDECInterrrupted() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new InterruptPINProvider(); -       -        signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -            .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -            pinProvider, null); -       -      } - -  @Test(expected = CancelledException.class) -  public void testSignSIGConcurrent() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        final SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new DummyPINGUI() { -          @Override -          public char[] providePIN(PinInfo spec, int retries) -              throws CancelledException, InterruptedException { - -            try { -              signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); -              assertTrue(false); -              return null; -            } catch (SignatureCardException e) { -              // expected -              throw new CancelledException(); -            } - -          } -        }; - -        signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -            .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -            pinProvider, null); -       -      } - -  @Test(expected = CancelledException.class) -  public void testSignDECConcurrent() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { -       -        final SignatureCard signatureCard = createSignatureCard(); -       -        PINGUI pinProvider = new DummyPINGUI() { -          @Override -          public char[] providePIN(PinInfo spec, int retries) -              throws CancelledException, InterruptedException { -       -            try { -              signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); -              assertTrue(false); -              return null; -            } catch (SignatureCardException e) { -              // expected -              throw new CancelledException(); -            } -          } -        }; -       -        signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -            .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -            pinProvider, null); -       -      } - -  @Test -  public void testGetPinSpecs() throws CardNotSupportedException, SignatureCardException { -   -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); -   -    PinInfo[] specs = signatureCard.getPinInfos(); -    assertNotNull(specs); -    assertTrue(specs.length > 0); -   -  } - -  @Test(expected = SignatureCardException.class) -  public void testActivatePin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, UnsupportedEncodingException { -       -        PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); -       -        ModifyPINGUI pinProvider = new CancelChangePINProvider(); -       -        PinInfo[] specs = signatureCard.getPinInfos(); -       -        signatureCard.activatePIN(specs[0], pinProvider); -      } - -}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/File.java b/smcc/src/test/java/at/gv/egiz/smcc/File.java index e47c5f7d..d3376fa1 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/File.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/File.java @@ -17,10 +17,14 @@  package at.gv.egiz.smcc;  public class File { +      public byte[] fid;    public byte[] file;    public byte[] fcx;    public int kid = -1; +   +  public File() { +  }    public File(byte[] fid, byte[] file, byte[] fcx) {      this.fid = fid; @@ -35,4 +39,62 @@ public class File {      this.kid = kid;    } +  /** +   * @return the fid +   */ +  public byte[] getFid() { +    return fid; +  } + +  /** +   * @param fid the fid to set +   */ +  public void setFid(byte[] fid) { +    this.fid = fid; +  } + +  /** +   * @return the file +   */ +  public byte[] getFile() { +    return file; +  } + +  /** +   * @param file the file to set +   */ +  public void setFile(byte[] file) { +    this.file = file; +  } + +  /** +   * @return the fcx +   */ +  public byte[] getFcx() { +    return fcx; +  } + +  /** +   * @param fcx the fcx to set +   */ +  public void setFcx(byte[] fcx) { +    this.fcx = fcx; +  } + +  /** +   * @return the kid +   */ +  public int getKid() { +    return kid; +  } + +  /** +   * @param kid the kid to set +   */ +  public void setKid(int kid) { +    this.kid = kid; +  } + +   +    }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/PIN.java b/smcc/src/test/java/at/gv/egiz/smcc/PIN.java index 2cda0c2f..fbcd030a 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/PIN.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/PIN.java @@ -34,6 +34,9 @@ public class PIN {    public int kfpc; // = 10; +  public PIN() { +  }; +      //TODO also provde default constructor without state param    public PIN(byte[] pin, int kid, int kfpc, int state) {      this.pin = pin; @@ -42,4 +45,62 @@ public class PIN {      this.state = state;    } +  /** +   * @return the pin +   */ +  public byte[] getPin() { +    return pin; +  } + +  /** +   * @param pin the pin to set +   */ +  public void setPin(byte[] pin) { +    this.pin = pin; +  } + +  /** +   * @return the kid +   */ +  public int getKid() { +    return kid; +  } + +  /** +   * @param kid the kid to set +   */ +  public void setKid(int kid) { +    this.kid = kid; +  } + +  /** +   * @return the state +   */ +  public int getState() { +    return state; +  } + +  /** +   * @param state the state to set +   */ +  public void setState(int state) { +    this.state = state; +  } + +  /** +   * @return the kfpc +   */ +  public int getKfpc() { +    return kfpc; +  } + +  /** +   * @param kfpc the kfpc to set +   */ +  public void setKfpc(int kfpc) { +    this.kfpc = kfpc; +  } + +   +    } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplDEC.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplDEC.java index f4ac5c35..e70649ad 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplDEC.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplDEC.java @@ -16,7 +16,6 @@  */  package at.gv.egiz.smcc.acos; -import java.io.UnsupportedEncodingException;  import java.util.Arrays;  import java.util.Random; @@ -24,28 +23,11 @@ import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public class A03ApplDEC extends ACOSApplDEC { -  public static final int KID_PIN_INF = 0x83; - -  public A03ApplDEC() { -    super(); - -    System.arraycopy(IDLINK, 0, EF_INFOBOX, 0, IDLINK.length); -    putFile(new File(FID_EF_INFOBOX, EF_INFOBOX, FCI_EF_INFOBOX, KID_PIN_INF)); - -    try { -      pins.put(KID_PIN_INF, new PIN("0000\0\0\0\0".getBytes("ASCII"), KID_PIN_INF, 10, PIN.STATE_RESET)); -    } catch (UnsupportedEncodingException e) { -      throw new RuntimeException(e); -    } -  } -    @Override    public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) { diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplSIG.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplSIG.java index d059ad57..82c3cbed 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplSIG.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03ApplSIG.java @@ -24,14 +24,8 @@ import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -@SuppressWarnings("restriction")  public class A03ApplSIG extends ACOSApplSIG { -  public A03ApplSIG() { -    super(); -    System.arraycopy(C_CH_DS, 0, EF_C_CH_DS, 0, C_CH_DS.length); -  } -    @Override    public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) { @@ -63,9 +57,9 @@ public class A03ApplSIG extends ACOSApplSIG {      case 0xB8:        switch (command.getP1()) {        case 0x41: -        // PSO � DECIPHER +        // PSO - DECIPHER        case 0x81: -        // PSO � ENCIPHER +        // PSO - ENCIPHER        }      default:        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardChannelEmul.java index c8d5382c..c3a2fbde 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardChannelEmul.java @@ -21,17 +21,11 @@ import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU; -import at.gv.egiz.smcc.CardEmul;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public class A03CardChannelEmul extends ACOSCardChannelEmul { -  public A03CardChannelEmul(CardEmul cardEmul) { -    super(cardEmul); -  } -    @Override    public ResponseAPDU cmdREAD_BINARY(CommandAPDU command) throws CardException { diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java deleted file mode 100644 index 4a94c623..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java +++ /dev/null @@ -1,92 +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.acos; - -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; - -import org.junit.Test; - -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.CardNotSupportedException; -import at.gv.egiz.smcc.CardTerminalEmul; -import at.gv.egiz.smcc.pin.gui.ChangePINProvider; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PINFormatException; -import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import at.gv.egiz.smcc.PinInfo; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.SignatureCardFactory; - -public class A03CardTest extends ACOSCardTest { - -  @Override -  protected SignatureCard createSignatureCard() -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    CardEmul card = new A03CardEmul(new A03ApplSIG(), new A03ApplDEC()); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  @Override -  protected int getVersion() { -    return 1; -  } - -  @Test -  public void testChangePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    char[] defaultPin = "123456".toCharArray(); - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplSIG applSIG = (ACOSApplSIG) card.getApplication(ACOSAppl.AID_SIG); -    applSIG.setPin(ACOSApplSIG.KID_PIN_SIG, defaultPin); -    ACOSApplDEC applDEC = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    applDEC.setPin(ACOSApplDEC.KID_PIN_DEC, defaultPin); -    applDEC.setPin(A03ApplDEC.KID_PIN_INF, defaultPin); - -    for (PinInfo pinSpec : signatureCard.getPinInfos()) { - -      char[] pin = defaultPin; - -      for (int i = pinSpec.getMinLength(); i <= pinSpec.getMaxLength(); i++) { -        signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); -        char[] newPin = new char[i]; -        Arrays.fill(newPin, '0'); -        signatureCard -            .changePIN(pinSpec, new ChangePINProvider(pin, newPin)); -        signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(newPin)); -        pin = newPin; -      } - -    } - -  } - -   -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplDEC.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplDEC.java index e38a8e80..b264bcae 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplDEC.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplDEC.java @@ -16,39 +16,20 @@  */  package at.gv.egiz.smcc.acos; -import java.io.UnsupportedEncodingException;  import java.security.GeneralSecurityException; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException;  import java.security.PrivateKey; -import java.security.PublicKey;  import java.security.Signature; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey;  import java.util.Arrays; -import javax.crypto.BadPaddingException;  import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.KeyGenerator; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec;  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public class A04ApplDEC extends ACOSApplDEC {    private static final byte[] SEC_ENV_INTERNAL_AUTHENTICATE = new byte[] { (byte) 0x84, @@ -57,91 +38,10 @@ public class A04ApplDEC extends ACOSApplDEC {    private static final byte[] SEC_ENV_DECIPHER = new byte[] { (byte) 0x84,        (byte) 0x01, (byte) 0x88, (byte) 0x80, (byte) 0x01, (byte) 0x02 }; -  private static final RSAPrivateKey SK_CH_EKEY; -   -  private static final RSAPublicKey PK_CH_EKEY; -   -  static { -    try { -      KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); -      gen.initialize(1536); -      KeyPair keyPair = gen.generateKeyPair(); -      SK_CH_EKEY = (RSAPrivateKey) keyPair.getPrivate(); -      PK_CH_EKEY = (RSAPublicKey) keyPair.getPublic(); -    } catch (NoSuchAlgorithmException e) { -      throw new RuntimeException(e); -    } -  } -   -  public A04ApplDEC() { -    this(false); -  } - -  public A04ApplDEC(boolean encrypt) { -     -    int offset = 0; -     -    // HEADER 'AIK' + version -    byte[] header; -    try { -      header = "AIK".getBytes("ASCII"); -    } catch (UnsupportedEncodingException e) { -      throw new RuntimeException(e); -    } -    System.arraycopy(header, 0, EF_INFOBOX, offset, header.length); -    offset += header.length; -    EF_INFOBOX[offset++] = 1;  -     -    // HEADER identity link -    EF_INFOBOX[offset++] = (byte) 0x01; // Personenbindung -    if (encrypt) { -      EF_INFOBOX[offset++] = (byte) 0x01; // Modifier +  protected PrivateKey privateKey; -      byte[] cipherText; -      byte[] encKey; -      try { -        KeyGenerator keyGenerator = KeyGenerator.getInstance("DESede"); -        SecretKey secretKey = keyGenerator.generateKey(); -         -        byte[] keyBytes = secretKey.getEncoded(); -         -        Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); -        byte[] iv = new byte[8]; -        Arrays.fill(iv, (byte) 0x00); -        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); -        cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec); -        cipherText = cipher.doFinal(IDLINK); -         -        cipher = Cipher.getInstance("RSA"); -        cipher.init(Cipher.ENCRYPT_MODE, PK_CH_EKEY); -        encKey = cipher.doFinal(keyBytes); -         -      } catch (GeneralSecurityException e) { -        throw new RuntimeException(e); -      } -       -      int len = encKey.length + cipherText.length + 2; -       -      EF_INFOBOX[offset++] = (byte) (0xFF & len); -      EF_INFOBOX[offset++] = (byte) (0xFF & len >> 8); -       -      EF_INFOBOX[offset++] = (byte) (0xFF & encKey.length); -      EF_INFOBOX[offset++] = (byte) (0xFF & encKey.length >> 8); -       -      System.arraycopy(encKey, 0, EF_INFOBOX, offset, encKey.length); -      offset += encKey.length; -       -      System.arraycopy(cipherText, 0, EF_INFOBOX, offset, cipherText.length); -       -    } else { -      EF_INFOBOX[offset++] = (byte) 0x00; // Modifier -      EF_INFOBOX[offset++] = (byte) (0xFF & IDLINK.length); -      EF_INFOBOX[offset++] = (byte) (0xFF & IDLINK.length >> 8); -      System.arraycopy(IDLINK, 0, EF_INFOBOX, offset, IDLINK.length); -      offset += IDLINK.length; -    } -     -    putFile(new File(FID_EF_INFOBOX, EF_INFOBOX, FCI_EF_INFOBOX)); +  public void setPrivateKey(PrivateKey privateKey) { +    this.privateKey = privateKey;    }    @Override @@ -197,6 +97,8 @@ public class A04ApplDEC extends ACOSApplDEC {      if (command.getP1() == 0x80 && command.getP2() == 0x86) { +      // DECIPHER +              byte[] data = command.getData();        if (!Arrays.equals(securityEnv, SEC_ENV_DECIPHER)) { @@ -217,7 +119,7 @@ public class A04ApplDEC extends ACOSApplDEC {        byte[] plainText;        try {          Cipher cipher = Cipher.getInstance("RSA"); -        cipher.init(Cipher.DECRYPT_MODE, SK_CH_EKEY); +        cipher.init(Cipher.DECRYPT_MODE, privateKey);          plainText = cipher.doFinal(cipherText);        } catch (GeneralSecurityException e) {          throw new CardException(e); @@ -268,8 +170,8 @@ public class A04ApplDEC extends ACOSApplDEC {        byte[] sig;        try { -        Signature signature = Signature.getInstance("RSA"); -        signature.initSign(SK_CH_EKEY); +        Signature signature = Signature.getInstance(privateKey.getAlgorithm()); +        signature.initSign(privateKey);          signature.update(digest);          sig = signature.sign();        } catch (GeneralSecurityException e) { diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplSIG.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplSIG.java index aee6a7f7..f19db2d0 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplSIG.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04ApplSIG.java @@ -22,26 +22,10 @@ import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File; -@SuppressWarnings("restriction")  public class A04ApplSIG extends ACOSApplSIG { -  private static byte[] FID_EF_INFO = new byte[] { (byte) 0xd0, (byte) 0x02 }; - -  private static byte[] FCI_EF_INFO = new byte[] { (byte) 0x6f, (byte) 0x07, -      (byte) 0x80, (byte) 0x02, (byte) 0x00, (byte) 0x08, (byte) 0x82, -      (byte) 0x01, (byte) 0x01 }; - -  private static byte[] EF_INFO = new byte[] { (byte) 0x02, (byte) 0x00, -      (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, -      (byte) 0x00, (byte) 0x90, (byte) 0x00 }; - -  public A04ApplSIG() { -    putFile(new File(FID_EF_INFO, EF_INFO, FCI_EF_INFO)); -  } -    @Override    public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) { @@ -73,9 +57,9 @@ public class A04ApplSIG extends ACOSApplSIG {      case 0xB8:        switch (command.getP1()) {        case 0x41: -        // PSO � DECIPHER +        // PSO - DECIPHER        case 0x81: -        // PSO � ENCIPHER +        // PSO - ENCIPHER        }      default:        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardChannelEmul.java index 3eaece91..31c5ba98 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardChannelEmul.java @@ -21,16 +21,9 @@ import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU; -import at.gv.egiz.smcc.CardEmul; - -@SuppressWarnings("restriction")  public class A04CardChannelEmul extends ACOSCardChannelEmul { -  public A04CardChannelEmul(CardEmul cardEmul) { -    super(cardEmul); -  } -    @Override    public ResponseAPDU cmdREAD_BINARY(CommandAPDU command) throws CardException { diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java deleted file mode 100644 index a7a5eef4..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java +++ /dev/null @@ -1,143 +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.acos; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import iaik.security.provider.IAIK; - -import java.security.Security; -import java.util.Arrays; - -import org.junit.BeforeClass; -import org.junit.Test; - -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.CardNotSupportedException; -import at.gv.egiz.smcc.CardTerminalEmul; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PINFormatException; -import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PinInfo; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.SignatureCardFactory; -import at.gv.egiz.smcc.pin.gui.ChangePINProvider; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; - -public class A04CardTest extends ACOSCardTest { - -  @Override -  protected SignatureCard createSignatureCard() -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    CardEmul card = new A04CardEmul(new A04ApplSIG(), new A04ApplDEC()); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  @Override -  protected int getVersion() { -    return 2; -  } - -  @BeforeClass -  public static void setupClass() { -    IAIK.addAsProvider(); -  } -   -  @Test -  public void testChangePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    char[] defaultPin = "123456".toCharArray(); - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplSIG applSIG = (ACOSApplSIG) card.getApplication(ACOSAppl.AID_SIG); -    applSIG.setPin(ACOSApplSIG.KID_PIN_SIG, defaultPin); -    ACOSApplDEC applDEC = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    applDEC.setPin(ACOSApplDEC.KID_PIN_DEC, defaultPin); - -    for (PinInfo pinSpec : signatureCard.getPinInfos()) { - -      char[] pin = defaultPin; - -      for (int i = pinSpec.getMinLength(); i <= pinSpec.getMaxLength(); i++) { -        char[] newPin = new char[i]; -        Arrays.fill(newPin, '0'); -        signatureCard -            .changePIN(pinSpec, new ChangePINProvider(pin, newPin)); -        signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(newPin)); -        pin = newPin; -      } - -    } - -  } -   -  @Test -  public void testGetInfoboxIdentityLinkEncrypted() -      throws CardNotSupportedException, SignatureCardException, -      InterruptedException { -     -    char[] pin = "0000".toCharArray(); - -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    A04ApplDEC applDEC = new A04ApplDEC(true); -    applDEC.setPin(A04ApplDEC.KID_PIN_DEC, pin); -    CardEmul card = new A04CardEmul(new A04ApplSIG(), applDEC); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider(pin); - -    byte[] idlink = signatureCard.getInfobox("IdentityLink", -        pinProvider, null); -    assertNotNull(idlink); -    assertTrue(Arrays.equals(idlink, A04ApplDEC.IDLINK)); -    assertEquals(1, pinProvider.getProvided()); - -  } -   -  @Test -  public void testGetInfoboxIdentityLink() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    final char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -     -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider(pin); - -    byte[] idlink = signatureCard.getInfobox("IdentityLink", -        pinProvider, null); -    assertNotNull(idlink); -    assertTrue(Arrays.equals(idlink, A04ApplDEC.IDLINK)); -    assertEquals(0, pinProvider.getProvided()); - -  } - - -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSAppl.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSAppl.java index 4c340d61..61632d56 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSAppl.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSAppl.java @@ -29,19 +29,8 @@ import at.gv.egiz.smcc.CardAppl;  import at.gv.egiz.smcc.CardChannelEmul;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public abstract class ACOSAppl extends AbstractAppl implements CardAppl { -  public static byte[] AID_SIG = new byte[] { (byte) 0xA0, (byte) 0x00, -        (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x43 }; -   -  public static byte[] FID_SIG = new byte[] { (byte) 0xDF, (byte) 0x70 }; -   -  public static byte[] AID_DEC = new byte[] { (byte) 0xA0, (byte) 0x00, -        (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; - -  public static byte[] FID_DEC = new byte[] { (byte) 0xDF, (byte) 0x71 }; -    protected byte[] securityEnv;    protected byte[] hash; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplDEC.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplDEC.java index 09a754f3..06b66d13 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplDEC.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplDEC.java @@ -16,319 +16,9 @@  */  package at.gv.egiz.smcc.acos; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; - -import at.gv.egiz.smcc.File; -import at.gv.egiz.smcc.PIN;  public abstract class ACOSApplDEC extends ACOSAppl { -  public static final byte[] IDLINK = new byte[] { -      (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x11, (byte) 0x02, (byte) 0x01, (byte) 0x01, (byte) 0x0c,  -      (byte) 0x26, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -      (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72,  -      (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x7a,  -      (byte) 0x6d, (byte) 0x72, (byte) 0x2f, (byte) 0x70, (byte) 0x65, (byte) 0x72, (byte) 0x73, (byte) 0x62,  -      (byte) 0x32, (byte) 0x30, (byte) 0x34, (byte) 0x2e, (byte) 0x78, (byte) 0x73, (byte) 0x6c, (byte) 0x0c,  -      (byte) 0x29, (byte) 0x73, (byte) 0x7a, (byte) 0x72, (byte) 0x2e, (byte) 0x62, (byte) 0x6d, (byte) 0x69,  -      (byte) 0x2e, (byte) 0x67, (byte) 0x76, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2d, (byte) 0x41,  -      (byte) 0x73, (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e,  -      (byte) 0x49, (byte) 0x44, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x36, (byte) 0x33, (byte) 0x35,  -      (byte) 0x36, (byte) 0x33, (byte) 0x36, (byte) 0x36, (byte) 0x37, (byte) 0x39, (byte) 0x39, (byte) 0x39,  -      (byte) 0x31, (byte) 0x39, (byte) 0x0c, (byte) 0x19, (byte) 0x32, (byte) 0x30, (byte) 0x30, (byte) 0x39,  -      (byte) 0x2d, (byte) 0x30, (byte) 0x33, (byte) 0x2d, (byte) 0x30, (byte) 0x36, (byte) 0x54, (byte) 0x31,  -      (byte) 0x36, (byte) 0x3a, (byte) 0x31, (byte) 0x39, (byte) 0x3a, (byte) 0x32, (byte) 0x36, (byte) 0x2b,  -      (byte) 0x30, (byte) 0x31, (byte) 0x3a, (byte) 0x30, (byte) 0x30, (byte) 0xa0, (byte) 0x42, (byte) 0x30,  -      (byte) 0x40, (byte) 0x0c, (byte) 0x18, (byte) 0x45, (byte) 0x68, (byte) 0x42, (byte) 0x53, (byte) 0x36,  -      (byte) 0x54, (byte) 0x6f, (byte) 0x31, (byte) 0x49, (byte) 0x6c, (byte) 0x54, (byte) 0x4b, (byte) 0x4f,  -      (byte) 0x4a, (byte) 0x45, (byte) 0x39, (byte) 0x75, (byte) 0x62, (byte) 0x74, (byte) 0x48, (byte) 0x69,  -      (byte) 0x51, (byte) 0x3d, (byte) 0x3d, (byte) 0x0c, (byte) 0x0a, (byte) 0x58, (byte) 0x58, (byte) 0x58,  -      (byte) 0xc5, (byte) 0x90, (byte) 0x7a, (byte) 0x67, (byte) 0xc3, (byte) 0xbc, (byte) 0x72, (byte) 0x0c,  -      (byte) 0x0c, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x54, (byte) 0xc3, (byte) 0xbc, (byte) 0x7a,  -      (byte) 0x65, (byte) 0x6b, (byte) 0xc3, (byte) 0xa7, (byte) 0x69, (byte) 0x0c, (byte) 0x0a, (byte) 0x31,  -      (byte) 0x39, (byte) 0x37, (byte) 0x33, (byte) 0x2d, (byte) 0x30, (byte) 0x36, (byte) 0x2d, (byte) 0x30,  -      (byte) 0x34, (byte) 0x30, (byte) 0x0a, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x00,  -      (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x01, (byte) 0x03, (byte) 0x82, (byte) 0x01,  -      (byte) 0x01, (byte) 0x00, (byte) 0x9f, (byte) 0xa5, (byte) 0x68, (byte) 0xa9, (byte) 0x14, (byte) 0x4c,  -      (byte) 0xa4, (byte) 0x5d, (byte) 0x9d, (byte) 0x09, (byte) 0x99, (byte) 0x2e, (byte) 0xe7, (byte) 0x45,  -      (byte) 0x2e, (byte) 0x42, (byte) 0x49, (byte) 0x02, (byte) 0x16, (byte) 0xd9, (byte) 0xcb, (byte) 0x90,  -      (byte) 0x43, (byte) 0x27, (byte) 0x03, (byte) 0x43, (byte) 0x6d, (byte) 0xb4, (byte) 0x8c, (byte) 0xdc,  -      (byte) 0x1c, (byte) 0x77, (byte) 0xd4, (byte) 0x2e, (byte) 0xa1, (byte) 0x40, (byte) 0xe7, (byte) 0xe0,  -      (byte) 0x03, (byte) 0x60, (byte) 0x15, (byte) 0xf7, (byte) 0xdb, (byte) 0x03, (byte) 0x5e, (byte) 0xca,  -      (byte) 0xe4, (byte) 0x35, (byte) 0xba, (byte) 0x2b, (byte) 0xfd, (byte) 0xe6, (byte) 0xb8, (byte) 0xd8,  -      (byte) 0xb7, (byte) 0x2a, (byte) 0x80, (byte) 0xdd, (byte) 0x38, (byte) 0xe0, (byte) 0x8a, (byte) 0x69,  -      (byte) 0xad, (byte) 0x67, (byte) 0x60, (byte) 0x65, (byte) 0x42, (byte) 0xc9, (byte) 0x41, (byte) 0x60,  -      (byte) 0x94, (byte) 0xde, (byte) 0x84, (byte) 0x54, (byte) 0xad, (byte) 0xb3, (byte) 0xf4, (byte) 0xf7,  -      (byte) 0x44, (byte) 0xd5, (byte) 0xf3, (byte) 0xd3, (byte) 0xb6, (byte) 0x87, (byte) 0x8a, (byte) 0x22,  -      (byte) 0x38, (byte) 0x00, (byte) 0xcb, (byte) 0xa4, (byte) 0x4f, (byte) 0x96, (byte) 0xc2, (byte) 0x28,  -      (byte) 0xc2, (byte) 0x8d, (byte) 0x91, (byte) 0x95, (byte) 0xb4, (byte) 0xea, (byte) 0x00, (byte) 0x59,  -      (byte) 0x2e, (byte) 0xec, (byte) 0x78, (byte) 0xd8, (byte) 0x0f, (byte) 0x26, (byte) 0x04, (byte) 0xee,  -      (byte) 0xed, (byte) 0x13, (byte) 0xbf, (byte) 0x81, (byte) 0x68, (byte) 0x81, (byte) 0x43, (byte) 0xbe,  -      (byte) 0x15, (byte) 0x0e, (byte) 0xba, (byte) 0xf9, (byte) 0x6a, (byte) 0x18, (byte) 0xeb, (byte) 0x95,  -      (byte) 0xad, (byte) 0xb4, (byte) 0x0f, (byte) 0x3c, (byte) 0x94, (byte) 0x63, (byte) 0x32, (byte) 0x81,  -      (byte) 0x90, (byte) 0xcf, (byte) 0x3f, (byte) 0x95, (byte) 0xff, (byte) 0x8d, (byte) 0x86, (byte) 0xed,  -      (byte) 0xe4, (byte) 0x75, (byte) 0xd5, (byte) 0x09, (byte) 0x32, (byte) 0x17, (byte) 0x38, (byte) 0xb2,  -      (byte) 0x68, (byte) 0x35, (byte) 0x49, (byte) 0x8c, (byte) 0xa6, (byte) 0xd0, (byte) 0x3e, (byte) 0xde,  -      (byte) 0x6e, (byte) 0x47, (byte) 0x68, (byte) 0xbf, (byte) 0x98, (byte) 0x33, (byte) 0xae, (byte) 0x59,  -      (byte) 0x9f, (byte) 0xe0, (byte) 0x19, (byte) 0x9b, (byte) 0x5b, (byte) 0x1b, (byte) 0x8f, (byte) 0x74,  -      (byte) 0xd2, (byte) 0x9c, (byte) 0x01, (byte) 0x1a, (byte) 0xdf, (byte) 0xaf, (byte) 0xf8, (byte) 0x96,  -      (byte) 0x91, (byte) 0xcb, (byte) 0xf8, (byte) 0xbf, (byte) 0x06, (byte) 0xc7, (byte) 0xd5, (byte) 0x17,  -      (byte) 0x95, (byte) 0xef, (byte) 0xc5, (byte) 0x97, (byte) 0x37, (byte) 0x1b, (byte) 0xb0, (byte) 0xa1,  -      (byte) 0x4f, (byte) 0x9f, (byte) 0x01, (byte) 0x82, (byte) 0x90, (byte) 0x4a, (byte) 0x6a, (byte) 0x04,  -      (byte) 0xdb, (byte) 0x31, (byte) 0x1a, (byte) 0x58, (byte) 0xeb, (byte) 0xcd, (byte) 0x68, (byte) 0xe3,  -      (byte) 0x68, (byte) 0x0b, (byte) 0xa0, (byte) 0x11, (byte) 0x44, (byte) 0x08, (byte) 0xa0, (byte) 0x5c,  -      (byte) 0xfc, (byte) 0x61, (byte) 0x15, (byte) 0x1f, (byte) 0xbb, (byte) 0x22, (byte) 0x87, (byte) 0x18,  -      (byte) 0xa3, (byte) 0x07, (byte) 0x9b, (byte) 0x0d, (byte) 0x13, (byte) 0x7c, (byte) 0xff, (byte) 0x30,  -      (byte) 0xcf, (byte) 0xf3, (byte) 0xaf, (byte) 0xe4, (byte) 0x45, (byte) 0x05, (byte) 0xa0, (byte) 0x8e,  -      (byte) 0x6b, (byte) 0xef, (byte) 0x70, (byte) 0xf5, (byte) 0x4b, (byte) 0x68, (byte) 0x8f, (byte) 0x61,  -      (byte) 0xd6, (byte) 0xf5, (byte) 0xa0, (byte) 0x17, (byte) 0x03, (byte) 0x15, (byte) 0x00, (byte) 0x8e,  -      (byte) 0xa8, (byte) 0xdf, (byte) 0xa9, (byte) 0x77, (byte) 0xfd, (byte) 0x9b, (byte) 0x4b, (byte) 0x91,  -      (byte) 0x89, (byte) 0x34, (byte) 0x84, (byte) 0xf3, (byte) 0x24, (byte) 0xb2, (byte) 0x5a, (byte) 0x39,  -      (byte) 0xa9, (byte) 0xf2, (byte) 0x17, (byte) 0xa1, (byte) 0x17, (byte) 0x03, (byte) 0x15, (byte) 0x00,  -      (byte) 0xdb, (byte) 0xa2, (byte) 0xfd, (byte) 0xa4, (byte) 0xe7, (byte) 0x65, (byte) 0x2e, (byte) 0x7e,  -      (byte) 0xb0, (byte) 0xc8, (byte) 0xfa, (byte) 0x4d, (byte) 0x13, (byte) 0x28, (byte) 0xdf, (byte) 0xb1,  -      (byte) 0x58, (byte) 0x3b, (byte) 0x9e, (byte) 0x29, (byte) 0xa2, (byte) 0x17, (byte) 0x03, (byte) 0x15,  -      (byte) 0x00, (byte) 0x68, (byte) 0xa0, (byte) 0x17, (byte) 0x18, (byte) 0xb7, (byte) 0xb3, (byte) 0xc3,  -      (byte) 0x60, (byte) 0x77, (byte) 0x82, (byte) 0x8d, (byte) 0xf1, (byte) 0x5e, (byte) 0x10, (byte) 0xc3,  -      (byte) 0x2d, (byte) 0x78, (byte) 0x2c, (byte) 0x11, (byte) 0x0b -    }; -  private static byte[] FCI = new byte[] { (byte) 0x6f, (byte) 0x1a, (byte) 0x84, -        (byte) 0x07, (byte) 0xa0, (byte) 0x00, (byte) 0x00, (byte) 0x01, -        (byte) 0x18, (byte) 0x4e, (byte) 0x43, (byte) 0x85, (byte) 0x0f, -        (byte) 0x50, (byte) 0x0d, (byte) 0x44, (byte) 0x49, (byte) 0x47, -        (byte) 0x53, (byte) 0x49, (byte) 0x47, (byte) 0x20, (byte) 0x43, -        (byte) 0x43, (byte) 0x20, (byte) 0x45, (byte) 0x4e, (byte) 0x43 }; -  protected static byte[] FID_EF_C_CH_EKEY = new byte[] { (byte) 0xc0, (byte) 0x01 }; -  protected static byte[] FCI_EF_C_CH_EKEY = new byte[] { (byte) 0x6f, (byte) 0x07, -    (byte) 0x80, (byte) 0x02, (byte) 0x07, (byte) 0xd0, (byte) 0x82, -    (byte) 0x01, (byte) 0x01}; -  protected static byte[] C_CH_EKEY = new byte[] { -      (byte) 0x30, (byte) 0x82, (byte) 0x05, (byte) 0x7f, (byte) 0x30, (byte) 0x82, (byte) 0x04, (byte) 0x67,  -      (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x03, (byte) 0x02,  -      (byte) 0x05, (byte) 0x51, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,  -      (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0xa1, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41,  -      (byte) 0x54, (byte) 0x31, (byte) 0x48, (byte) 0x30, (byte) 0x46, (byte) 0x06, (byte) 0x03, (byte) 0x55,  -      (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x3f, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72,  -      (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x47, (byte) 0x65, (byte) 0x73, (byte) 0x2e,  -      (byte) 0x20, (byte) 0x66, (byte) 0x2e, (byte) 0x20, (byte) 0x53, (byte) 0x69, (byte) 0x63, (byte) 0x68,  -      (byte) 0x65, (byte) 0x72, (byte) 0x68, (byte) 0x65, (byte) 0x69, (byte) 0x74, (byte) 0x73, (byte) 0x73,  -      (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x20, (byte) 0x69,  -      (byte) 0x6d, (byte) 0x20, (byte) 0x65, (byte) 0x6c, (byte) 0x65, (byte) 0x6b, (byte) 0x74, (byte) 0x72,  -      (byte) 0x2e, (byte) 0x20, (byte) 0x44, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x6e, (byte) 0x76,  -      (byte) 0x65, (byte) 0x72, (byte) 0x6b, (byte) 0x65, (byte) 0x68, (byte) 0x72, (byte) 0x20, (byte) 0x47,  -      (byte) 0x6d, (byte) 0x62, (byte) 0x48, (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06,  -      (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0b, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65,  -      (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73,  -      (byte) 0x74, (byte) 0x2d, (byte) 0x45, (byte) 0x6e, (byte) 0x63, (byte) 0x2d, (byte) 0x30, (byte) 0x32,  -      (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -      (byte) 0x03, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67,  -      (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75,  -      (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x45,  -      (byte) 0x6e, (byte) 0x63, (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x30, (byte) 0x1e, (byte) 0x17,  -      (byte) 0x0d, (byte) 0x30, (byte) 0x39, (byte) 0x30, (byte) 0x31, (byte) 0x31, (byte) 0x33, (byte) 0x30,  -      (byte) 0x39, (byte) 0x34, (byte) 0x35, (byte) 0x31, (byte) 0x32, (byte) 0x5a, (byte) 0x17, (byte) 0x0d,  -      (byte) 0x31, (byte) 0x32, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x31, (byte) 0x30, (byte) 0x39,  -      (byte) 0x34, (byte) 0x35, (byte) 0x31, (byte) 0x32, (byte) 0x5a, (byte) 0x30, (byte) 0x70, (byte) 0x31,  -      (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06,  -      (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x54, (byte) 0x31, (byte) 0x1f, (byte) 0x30, (byte) 0x1d,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c, (byte) 0x16, (byte) 0x58,  -      (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x58,  -      (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x61, (byte) 0x6b, (byte) 0x72,  -      (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x65, (byte) 0x72, (byte) 0x31, (byte) 0x17, (byte) 0x30,  -      (byte) 0x15, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x04, (byte) 0x0c, (byte) 0x0e,  -      (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x61, (byte) 0x6b,  -      (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x65, (byte) 0x72, (byte) 0x31, (byte) 0x10,  -      (byte) 0x30, (byte) 0x0e, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x2a, (byte) 0x0c,  -      (byte) 0x07, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x6f,  -      (byte) 0x31, (byte) 0x15, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -      (byte) 0x05, (byte) 0x13, (byte) 0x0c, (byte) 0x39, (byte) 0x37, (byte) 0x30, (byte) 0x30, (byte) 0x31,  -      (byte) 0x36, (byte) 0x38, (byte) 0x36, (byte) 0x36, (byte) 0x31, (byte) 0x37, (byte) 0x34, (byte) 0x30,  -      (byte) 0x81, (byte) 0xdf, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,  -      (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05,  -      (byte) 0x00, (byte) 0x03, (byte) 0x81, (byte) 0xcd, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0xc9,  -      (byte) 0x02, (byte) 0x81, (byte) 0xc1, (byte) 0x00, (byte) 0xae, (byte) 0xe6, (byte) 0x07, (byte) 0x1d,  -      (byte) 0xb9, (byte) 0x56, (byte) 0x0a, (byte) 0x98, (byte) 0x1a, (byte) 0xde, (byte) 0x52, (byte) 0xf2,  -      (byte) 0x77, (byte) 0xdc, (byte) 0x5e, (byte) 0x76, (byte) 0x7f, (byte) 0xe5, (byte) 0xc1, (byte) 0x79,  -      (byte) 0xb9, (byte) 0x51, (byte) 0x97, (byte) 0x08, (byte) 0x20, (byte) 0x4e, (byte) 0xa6, (byte) 0xa3,  -      (byte) 0xab, (byte) 0xdf, (byte) 0x49, (byte) 0x21, (byte) 0x2b, (byte) 0x65, (byte) 0x4f, (byte) 0x7c,  -      (byte) 0x26, (byte) 0xe8, (byte) 0xb9, (byte) 0x47, (byte) 0xdf, (byte) 0x03, (byte) 0x0f, (byte) 0xf7,  -      (byte) 0x4e, (byte) 0xf4, (byte) 0x47, (byte) 0x3d, (byte) 0x32, (byte) 0x61, (byte) 0x05, (byte) 0x33,  -      (byte) 0x0f, (byte) 0xdc, (byte) 0x97, (byte) 0x3e, (byte) 0xbf, (byte) 0x9b, (byte) 0xf2, (byte) 0xf8,  -      (byte) 0xb3, (byte) 0xe2, (byte) 0xc4, (byte) 0x4d, (byte) 0xe0, (byte) 0x48, (byte) 0x6a, (byte) 0x1b,  -      (byte) 0xd2, (byte) 0xfe, (byte) 0xfa, (byte) 0xee, (byte) 0x24, (byte) 0x08, (byte) 0xdc, (byte) 0x60,  -      (byte) 0x2a, (byte) 0x78, (byte) 0x6c, (byte) 0x1d, (byte) 0xd3, (byte) 0x74, (byte) 0x43, (byte) 0x1f,  -      (byte) 0x1f, (byte) 0x4e, (byte) 0xd2, (byte) 0x0f, (byte) 0x89, (byte) 0x3c, (byte) 0xe3, (byte) 0x1e,  -      (byte) 0xfa, (byte) 0x31, (byte) 0x5a, (byte) 0xc2, (byte) 0x04, (byte) 0x24, (byte) 0xd1, (byte) 0xe5,  -      (byte) 0x51, (byte) 0xc4, (byte) 0x94, (byte) 0x26, (byte) 0xd1, (byte) 0x32, (byte) 0x1e, (byte) 0xdf,  -      (byte) 0x64, (byte) 0xaa, (byte) 0xaf, (byte) 0x2c, (byte) 0x85, (byte) 0x25, (byte) 0x88, (byte) 0x8f,  -      (byte) 0x80, (byte) 0xe4, (byte) 0x05, (byte) 0x74, (byte) 0xd5, (byte) 0xda, (byte) 0x69, (byte) 0x88,  -      (byte) 0x4a, (byte) 0x0c, (byte) 0x6a, (byte) 0x85, (byte) 0x5f, (byte) 0x67, (byte) 0x51, (byte) 0x6c,  -      (byte) 0x5c, (byte) 0x1c, (byte) 0x41, (byte) 0x88, (byte) 0x4c, (byte) 0xad, (byte) 0x83, (byte) 0xc9,  -      (byte) 0x10, (byte) 0x97, (byte) 0x45, (byte) 0x00, (byte) 0x3f, (byte) 0xbd, (byte) 0x1d, (byte) 0x2f,  -      (byte) 0x28, (byte) 0x2e, (byte) 0x78, (byte) 0x97, (byte) 0x05, (byte) 0xa5, (byte) 0x41, (byte) 0x42,  -      (byte) 0x37, (byte) 0x08, (byte) 0x60, (byte) 0x0b, (byte) 0x66, (byte) 0xb1, (byte) 0xb8, (byte) 0xdd,  -      (byte) 0x98, (byte) 0x03, (byte) 0x03, (byte) 0x33, (byte) 0xc9, (byte) 0x15, (byte) 0xf7, (byte) 0x5b,  -      (byte) 0x35, (byte) 0xa5, (byte) 0xaa, (byte) 0x7a, (byte) 0x5e, (byte) 0xe9, (byte) 0xa7, (byte) 0x60,  -      (byte) 0xba, (byte) 0xd8, (byte) 0x0d, (byte) 0x6d, (byte) 0xb3, (byte) 0x85, (byte) 0x70, (byte) 0x0e,  -      (byte) 0x38, (byte) 0x6f, (byte) 0xf0, (byte) 0xfd, (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00,  -      (byte) 0x01, (byte) 0xa3, (byte) 0x82, (byte) 0x02, (byte) 0x32, (byte) 0x30, (byte) 0x82, (byte) 0x02,  -      (byte) 0x2e, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x23,  -      (byte) 0x04, (byte) 0x0c, (byte) 0x30, (byte) 0x0a, (byte) 0x80, (byte) 0x08, (byte) 0x4b, (byte) 0x5d,  -      (byte) 0x02, (byte) 0x5c, (byte) 0x6d, (byte) 0x58, (byte) 0x24, (byte) 0x67, (byte) 0x30, (byte) 0x81,  -      (byte) 0x84, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x07, (byte) 0x01, (byte) 0x01, (byte) 0x04, (byte) 0x78, (byte) 0x30, (byte) 0x76, (byte) 0x30,  -      (byte) 0x2c, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x07, (byte) 0x30, (byte) 0x01, (byte) 0x86, (byte) 0x20, (byte) 0x68, (byte) 0x74, (byte) 0x74,  -      (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x70,  -      (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74,  -      (byte) 0x2f, (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x70, (byte) 0x30, (byte) 0x46, (byte) 0x06,  -      (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30,  -      (byte) 0x02, (byte) 0x86, (byte) 0x3a, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a,  -      (byte) 0x2f, (byte) 0x2f, (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74,  -      (byte) 0x2f, (byte) 0x63, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x73, (byte) 0x2f, (byte) 0x61,  -      (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72,  -      (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65,  -      (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x45, (byte) 0x6e, (byte) 0x63, (byte) 0x2d, (byte) 0x30,  -      (byte) 0x32, (byte) 0x2e, (byte) 0x63, (byte) 0x72, (byte) 0x74, (byte) 0x30, (byte) 0x81, (byte) 0x93,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x20, (byte) 0x04, (byte) 0x81, (byte) 0x8b,  -      (byte) 0x30, (byte) 0x81, (byte) 0x88, (byte) 0x30, (byte) 0x81, (byte) 0x85, (byte) 0x06, (byte) 0x06,  -      (byte) 0x2a, (byte) 0x28, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x03, (byte) 0x30, (byte) 0x7b,  -      (byte) 0x30, (byte) 0x3d, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05,  -      (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x01, (byte) 0x16, (byte) 0x31, (byte) 0x68, (byte) 0x74,  -      (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x77, (byte) 0x77, (byte) 0x77,  -      (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74,  -      (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x64, (byte) 0x6f, (byte) 0x63, (byte) 0x73,  -      (byte) 0x2f, (byte) 0x63, (byte) 0x70, (byte) 0x2f, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69,  -      (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x70, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69,  -      (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x30,  -      (byte) 0x3a, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x07, (byte) 0x02, (byte) 0x02, (byte) 0x30, (byte) 0x2e, (byte) 0x1a, (byte) 0x2c, (byte) 0x44,  -      (byte) 0x69, (byte) 0x65, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x20, (byte) 0x5a, (byte) 0x65,  -      (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x6b, (byte) 0x61, (byte) 0x74,  -      (byte) 0x20, (byte) 0x64, (byte) 0x69, (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x20, (byte) 0x6e,  -      (byte) 0x75, (byte) 0x72, (byte) 0x20, (byte) 0x7a, (byte) 0x75, (byte) 0x20, (byte) 0x54, (byte) 0x65,  -      (byte) 0x73, (byte) 0x74, (byte) 0x7a, (byte) 0x77, (byte) 0x65, (byte) 0x63, (byte) 0x6b, (byte) 0x65,  -      (byte) 0x6e, (byte) 0x20, (byte) 0x21, (byte) 0x30, (byte) 0x81, (byte) 0xa4, (byte) 0x06, (byte) 0x03,  -      (byte) 0x55, (byte) 0x1d, (byte) 0x1f, (byte) 0x04, (byte) 0x81, (byte) 0x9c, (byte) 0x30, (byte) 0x81,  -      (byte) 0x99, (byte) 0x30, (byte) 0x81, (byte) 0x96, (byte) 0xa0, (byte) 0x81, (byte) 0x93, (byte) 0xa0,  -      (byte) 0x81, (byte) 0x90, (byte) 0x86, (byte) 0x81, (byte) 0x8d, (byte) 0x6c, (byte) 0x64, (byte) 0x61,  -      (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x6c, (byte) 0x64, (byte) 0x61, (byte) 0x70,  -      (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74,  -      (byte) 0x2f, (byte) 0x6f, (byte) 0x75, (byte) 0x3d, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69,  -      (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69,  -      (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d,  -      (byte) 0x45, (byte) 0x6e, (byte) 0x63, (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x2c, (byte) 0x6f,  -      (byte) 0x3d, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74,  -      (byte) 0x2c, (byte) 0x63, (byte) 0x3d, (byte) 0x41, (byte) 0x54, (byte) 0x3f, (byte) 0x63, (byte) 0x65,  -      (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63, (byte) 0x61, (byte) 0x74,  -      (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x76, (byte) 0x6f, (byte) 0x63, (byte) 0x61, (byte) 0x74,  -      (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x6c, (byte) 0x69, (byte) 0x73, (byte) 0x74, (byte) 0x3f,  -      (byte) 0x62, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x3f, (byte) 0x6f, (byte) 0x62, (byte) 0x6a,  -      (byte) 0x65, (byte) 0x63, (byte) 0x74, (byte) 0x63, (byte) 0x6c, (byte) 0x61, (byte) 0x73, (byte) 0x73,  -      (byte) 0x3d, (byte) 0x65, (byte) 0x69, (byte) 0x64, (byte) 0x43, (byte) 0x65, (byte) 0x72, (byte) 0x74,  -      (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x69, (byte) 0x6f,  -      (byte) 0x6e, (byte) 0x41, (byte) 0x75, (byte) 0x74, (byte) 0x68, (byte) 0x6f, (byte) 0x72, (byte) 0x69,  -      (byte) 0x74, (byte) 0x79, (byte) 0x30, (byte) 0x11, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,  -      (byte) 0x0e, (byte) 0x04, (byte) 0x0a, (byte) 0x04, (byte) 0x08, (byte) 0x4a, (byte) 0x24, (byte) 0x43,  -      (byte) 0xc0, (byte) 0x85, (byte) 0x2a, (byte) 0xb4, (byte) 0x51, (byte) 0x30, (byte) 0x0e, (byte) 0x06,  -      (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0f, (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x04,  -      (byte) 0x04, (byte) 0x03, (byte) 0x02, (byte) 0x04, (byte) 0xb0, (byte) 0x30, (byte) 0x25, (byte) 0x06,  -      (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x11, (byte) 0x04, (byte) 0x1e, (byte) 0x30, (byte) 0x1c,  -      (byte) 0x81, (byte) 0x1a, (byte) 0x74, (byte) 0x68, (byte) 0x6f, (byte) 0x6d, (byte) 0x61, (byte) 0x73,  -      (byte) 0x2e, (byte) 0x72, (byte) 0x6f, (byte) 0x65, (byte) 0x73, (byte) 0x73, (byte) 0x6c, (byte) 0x65,  -      (byte) 0x72, (byte) 0x40, (byte) 0x65, (byte) 0x67, (byte) 0x69, (byte) 0x7a, (byte) 0x2e, (byte) 0x67,  -      (byte) 0x76, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03,  -      (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x02, (byte) 0x30, (byte) 0x00, (byte) 0x30,  -      (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7,  -      (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x82,  -      (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x4a, (byte) 0x36, (byte) 0x02, (byte) 0xb3, (byte) 0xab,  -      (byte) 0x02, (byte) 0xe9, (byte) 0xe1, (byte) 0xaf, (byte) 0x3f, (byte) 0xd5, (byte) 0xcd, (byte) 0x3d,  -      (byte) 0x51, (byte) 0x08, (byte) 0xb8, (byte) 0x73, (byte) 0x23, (byte) 0x68, (byte) 0x0c, (byte) 0x22,  -      (byte) 0x32, (byte) 0xcd, (byte) 0xbe, (byte) 0xc8, (byte) 0x77, (byte) 0xbc, (byte) 0x47, (byte) 0x37,  -      (byte) 0xdd, (byte) 0x89, (byte) 0x7c, (byte) 0x22, (byte) 0x24, (byte) 0x2f, (byte) 0x23, (byte) 0xea,  -      (byte) 0x3e, (byte) 0xc2, (byte) 0xf4, (byte) 0x59, (byte) 0x78, (byte) 0xa6, (byte) 0xbe, (byte) 0xcd,  -      (byte) 0x71, (byte) 0xaa, (byte) 0xb5, (byte) 0xbc, (byte) 0xe3, (byte) 0xbc, (byte) 0x3f, (byte) 0xf1,  -      (byte) 0xfa, (byte) 0x1a, (byte) 0x43, (byte) 0x2b, (byte) 0x91, (byte) 0x35, (byte) 0x67, (byte) 0xa5,  -      (byte) 0x62, (byte) 0x9d, (byte) 0x55, (byte) 0x85, (byte) 0xe0, (byte) 0x3f, (byte) 0xed, (byte) 0x00,  -      (byte) 0x67, (byte) 0x80, (byte) 0x6a, (byte) 0xfb, (byte) 0x46, (byte) 0x8a, (byte) 0xed, (byte) 0x48,  -      (byte) 0x03, (byte) 0xe7, (byte) 0x9d, (byte) 0x5c, (byte) 0xac, (byte) 0xdf, (byte) 0xec, (byte) 0x2d,  -      (byte) 0x53, (byte) 0x8b, (byte) 0x01, (byte) 0xdb, (byte) 0x14, (byte) 0x91, (byte) 0x21, (byte) 0xaf,  -      (byte) 0xa7, (byte) 0x91, (byte) 0x69, (byte) 0x7e, (byte) 0x97, (byte) 0x68, (byte) 0xcc, (byte) 0x2a,  -      (byte) 0x06, (byte) 0x1a, (byte) 0xbc, (byte) 0x53, (byte) 0x35, (byte) 0xde, (byte) 0xd7, (byte) 0x62,  -      (byte) 0x12, (byte) 0xbd, (byte) 0x54, (byte) 0xb5, (byte) 0x4c, (byte) 0x3c, (byte) 0xaf, (byte) 0x55,  -      (byte) 0xa4, (byte) 0x5b, (byte) 0x28, (byte) 0x61, (byte) 0x68, (byte) 0x03, (byte) 0xc6, (byte) 0x72,  -      (byte) 0xc0, (byte) 0xa2, (byte) 0x3f, (byte) 0x84, (byte) 0x02, (byte) 0xf8, (byte) 0x3d, (byte) 0x70,  -      (byte) 0x3f, (byte) 0xde, (byte) 0x9d, (byte) 0x6a, (byte) 0x71, (byte) 0x16, (byte) 0x87, (byte) 0x9d,  -      (byte) 0x93, (byte) 0x3d, (byte) 0x46, (byte) 0x41, (byte) 0xa9, (byte) 0x6a, (byte) 0xca, (byte) 0x87,  -      (byte) 0xd4, (byte) 0xd1, (byte) 0x3f, (byte) 0x1d, (byte) 0x6e, (byte) 0x6a, (byte) 0xbf, (byte) 0x02,  -      (byte) 0x9b, (byte) 0xfb, (byte) 0x4a, (byte) 0x47, (byte) 0xe0, (byte) 0x20, (byte) 0x4a, (byte) 0x2d,  -      (byte) 0x5a, (byte) 0x0c, (byte) 0x6b, (byte) 0x25, (byte) 0xd6, (byte) 0x2d, (byte) 0xd4, (byte) 0x53,  -      (byte) 0x08, (byte) 0x41, (byte) 0xa9, (byte) 0x16, (byte) 0xa2, (byte) 0xa0, (byte) 0xef, (byte) 0x13,  -      (byte) 0xa8, (byte) 0xec, (byte) 0x7e, (byte) 0x99, (byte) 0x15, (byte) 0xf9, (byte) 0x1a, (byte) 0x18,  -      (byte) 0x5e, (byte) 0x75, (byte) 0xc7, (byte) 0x5d, (byte) 0x40, (byte) 0xd4, (byte) 0x84, (byte) 0x4a,  -      (byte) 0xd2, (byte) 0xf7, (byte) 0x7c, (byte) 0x65, (byte) 0x12, (byte) 0xc7, (byte) 0xae, (byte) 0xbc,  -      (byte) 0x9d, (byte) 0x3e, (byte) 0xce, (byte) 0x42, (byte) 0xfe, (byte) 0xe4, (byte) 0x98, (byte) 0x10,  -      (byte) 0x63, (byte) 0x0d, (byte) 0xaa, (byte) 0x2d, (byte) 0x73, (byte) 0x7d, (byte) 0x46, (byte) 0x19,  -      (byte) 0xca, (byte) 0x78, (byte) 0x94, (byte) 0xe5, (byte) 0x11, (byte) 0x83, (byte) 0x87, (byte) 0xb2,  -      (byte) 0xf7, (byte) 0x59, (byte) 0x90, (byte) 0x47, (byte) 0x86, (byte) 0x57, (byte) 0xcf, (byte) 0xc7,  -      (byte) 0x7b, (byte) 0x8f, (byte) 0xac, (byte) 0x20, (byte) 0xbd, (byte) 0x46, (byte) 0xea, (byte) 0xa2,  -      (byte) 0x10, (byte) 0xe1, (byte) 0x72, (byte) 0x3e, (byte) 0xe3, (byte) 0x72, (byte) 0x20, (byte) 0x24,  -      (byte) 0xa5, (byte) 0x2f, (byte) 0xc5 -    };    protected static final int KID_PIN_DEC = 0x81; - -  protected static byte[] FID_EF_INFOBOX = new byte[] { (byte) 0xc0, (byte) 0x02 }; -  protected static byte[] FCI_EF_INFOBOX = new byte[] { (byte) 0x6f, (byte) 0x07, -    (byte) 0x80, (byte) 0x02, (byte) 0x05, (byte) 0xdc, (byte) 0x82, -    (byte) 0x01, (byte) 0x01}; -   -  protected byte[] EF_INFOBOX = new byte[1500]; - -  protected byte[] EF_C_CH_EKEY = new byte[2000]; -   -  public ACOSApplDEC() { -    System.arraycopy(C_CH_EKEY, 0, EF_C_CH_EKEY, 0, C_CH_EKEY.length); -    putFile(new File(FID_EF_C_CH_EKEY, EF_C_CH_EKEY, FCI_EF_C_CH_EKEY)); -    try { -      pins.put(KID_PIN_DEC, new PIN("1234\0\0\0\0".getBytes("ASCII"), KID_PIN_DEC, 10, PIN.STATE_RESET)); -    } catch (UnsupportedEncodingException e) { -      throw new RuntimeException(e); -    } -  } - -  @Override -  public byte[] getAID() { -    return AID_DEC; -  } - -  @Override -  public byte[] getFID() { -    return FID_DEC; -  } - -  @Override -  public byte[] getFCI() { -    return FCI; -  } - -  public void clearInfobox() { -    Arrays.fill(EF_INFOBOX, (byte) 0x00); -  } -   -  public void setInfoboxHeader(byte b) { -    EF_INFOBOX[0] = b; -  } -   -  public void clearCert() { -    Arrays.fill(EF_C_CH_EKEY, (byte) 0x00); -  } -  }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplSIG.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplSIG.java index 6ab5903a..e7e844ba 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplSIG.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSApplSIG.java @@ -16,232 +16,18 @@  */  package at.gv.egiz.smcc.acos; -import java.io.UnsupportedEncodingException; -import java.util.Arrays;  import java.util.Random;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public abstract class ACOSApplSIG extends ACOSAppl { -  private static byte[] FCI = new byte[] { (byte) 0x6f, (byte) 0x1a, -        (byte) 0x84, (byte) 0x07, (byte) 0xa0, (byte) 0x00, (byte) 0x00, -        (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x43, (byte) 0x85, -        (byte) 0x0f, (byte) 0x50, (byte) 0x0d, (byte) 0x44, (byte) 0x49, -        (byte) 0x47, (byte) 0x53, (byte) 0x49, (byte) 0x47, (byte) 0x20, -        (byte) 0x43, (byte) 0x43, (byte) 0x20, (byte) 0x45, (byte) 0x43, -        (byte) 0x43 }; -  protected static byte[] FID_EF_C_CH_DS = new byte[] { (byte) 0xc0, (byte) 0x02 }; -  protected static byte[] FCI_EF_C_CH_DS = new byte[] { (byte) 0x6f, (byte) 0x07, -        (byte) 0x80, (byte) 0x02, (byte) 0x07, (byte) 0xd0, (byte) 0x82, -        (byte) 0x01, (byte) 0x01 }; -  protected static byte[] C_CH_DS = new byte[] { -      (byte) 0x30, (byte) 0x82, (byte) 0x05, (byte) 0x2b, (byte) 0x30, (byte) 0x82, (byte) 0x04, (byte) 0x13,  -      (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x03, (byte) 0x02,  -      (byte) 0x05, (byte) 0x52, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,  -      (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0xa1, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41,  -      (byte) 0x54, (byte) 0x31, (byte) 0x48, (byte) 0x30, (byte) 0x46, (byte) 0x06, (byte) 0x03, (byte) 0x55,  -      (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x3f, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72,  -      (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x47, (byte) 0x65, (byte) 0x73, (byte) 0x2e,  -      (byte) 0x20, (byte) 0x66, (byte) 0x2e, (byte) 0x20, (byte) 0x53, (byte) 0x69, (byte) 0x63, (byte) 0x68,  -      (byte) 0x65, (byte) 0x72, (byte) 0x68, (byte) 0x65, (byte) 0x69, (byte) 0x74, (byte) 0x73, (byte) 0x73,  -      (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x20, (byte) 0x69,  -      (byte) 0x6d, (byte) 0x20, (byte) 0x65, (byte) 0x6c, (byte) 0x65, (byte) 0x6b, (byte) 0x74, (byte) 0x72,  -      (byte) 0x2e, (byte) 0x20, (byte) 0x44, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x6e, (byte) 0x76,  -      (byte) 0x65, (byte) 0x72, (byte) 0x6b, (byte) 0x65, (byte) 0x68, (byte) 0x72, (byte) 0x20, (byte) 0x47,  -      (byte) 0x6d, (byte) 0x62, (byte) 0x48, (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06,  -      (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0b, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65,  -      (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73,  -      (byte) 0x74, (byte) 0x2d, (byte) 0x53, (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30, (byte) 0x32,  -      (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -      (byte) 0x03, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67,  -      (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75,  -      (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53,  -      (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x30, (byte) 0x1e, (byte) 0x17,  -      (byte) 0x0d, (byte) 0x30, (byte) 0x39, (byte) 0x30, (byte) 0x31, (byte) 0x31, (byte) 0x33, (byte) 0x30,  -      (byte) 0x39, (byte) 0x34, (byte) 0x35, (byte) 0x31, (byte) 0x32, (byte) 0x5a, (byte) 0x17, (byte) 0x0d,  -      (byte) 0x31, (byte) 0x32, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x31, (byte) 0x30, (byte) 0x39,  -      (byte) 0x34, (byte) 0x35, (byte) 0x31, (byte) 0x32, (byte) 0x5a, (byte) 0x30, (byte) 0x70, (byte) 0x31,  -      (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06,  -      (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x54, (byte) 0x31, (byte) 0x1f, (byte) 0x30, (byte) 0x1d,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c, (byte) 0x16, (byte) 0x58,  -      (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x58,  -      (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x61, (byte) 0x6b, (byte) 0x72,  -      (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x65, (byte) 0x72, (byte) 0x31, (byte) 0x17, (byte) 0x30,  -      (byte) 0x15, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x04, (byte) 0x0c, (byte) 0x0e,  -      (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x61, (byte) 0x6b,  -      (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x67, (byte) 0x65, (byte) 0x72, (byte) 0x31, (byte) 0x10,  -      (byte) 0x30, (byte) 0x0e, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x2a, (byte) 0x0c,  -      (byte) 0x07, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x4f, (byte) 0x74, (byte) 0x74, (byte) 0x6f,  -      (byte) 0x31, (byte) 0x15, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -      (byte) 0x05, (byte) 0x13, (byte) 0x0c, (byte) 0x39, (byte) 0x37, (byte) 0x30, (byte) 0x30, (byte) 0x31,  -      (byte) 0x36, (byte) 0x38, (byte) 0x36, (byte) 0x36, (byte) 0x31, (byte) 0x37, (byte) 0x34, (byte) 0x30,  -      (byte) 0x59, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x07, (byte) 0x2a, (byte) 0x86, (byte) 0x48,  -      (byte) 0xce, (byte) 0x3d, (byte) 0x02, (byte) 0x01, (byte) 0x06, (byte) 0x08, (byte) 0x2a, (byte) 0x86,  -      (byte) 0x48, (byte) 0xce, (byte) 0x3d, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x03, (byte) 0x42,  -      (byte) 0x00, (byte) 0x04, (byte) 0x6b, (byte) 0xde, (byte) 0x5f, (byte) 0x5e, (byte) 0xd5, (byte) 0x2b,  -      (byte) 0xbe, (byte) 0x1e, (byte) 0xb9, (byte) 0x82, (byte) 0x19, (byte) 0x75, (byte) 0xf4, (byte) 0x3b,  -      (byte) 0xc1, (byte) 0x34, (byte) 0xe9, (byte) 0xdb, (byte) 0x0b, (byte) 0x25, (byte) 0x31, (byte) 0x33,  -      (byte) 0xfa, (byte) 0x8b, (byte) 0x72, (byte) 0xd4, (byte) 0x9f, (byte) 0x21, (byte) 0xf5, (byte) 0x62,  -      (byte) 0xb9, (byte) 0xf6, (byte) 0x50, (byte) 0xdb, (byte) 0xcc, (byte) 0xbf, (byte) 0x43, (byte) 0xb9,  -      (byte) 0x5e, (byte) 0x75, (byte) 0x2a, (byte) 0x37, (byte) 0xbe, (byte) 0x32, (byte) 0xa6, (byte) 0x83,  -      (byte) 0xb1, (byte) 0x5c, (byte) 0xc3, (byte) 0x9d, (byte) 0xf0, (byte) 0xab, (byte) 0xe6, (byte) 0x8f,  -      (byte) 0xe4, (byte) 0x97, (byte) 0x83, (byte) 0x57, (byte) 0x89, (byte) 0xe0, (byte) 0x13, (byte) 0xe3,  -      (byte) 0x13, (byte) 0xa8, (byte) 0xa3, (byte) 0x82, (byte) 0x02, (byte) 0x65, (byte) 0x30, (byte) 0x82,  -      (byte) 0x02, (byte) 0x61, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,  -      (byte) 0x23, (byte) 0x04, (byte) 0x0c, (byte) 0x30, (byte) 0x0a, (byte) 0x80, (byte) 0x08, (byte) 0x46,  -      (byte) 0x06, (byte) 0x9f, (byte) 0x8e, (byte) 0x41, (byte) 0x8e, (byte) 0x15, (byte) 0xbd, (byte) 0x30,  -      (byte) 0x27, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x07, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x04, (byte) 0x18,  -      (byte) 0x30, (byte) 0x16, (byte) 0x30, (byte) 0x08, (byte) 0x06, (byte) 0x06, (byte) 0x04, (byte) 0x00,  -      (byte) 0x8e, (byte) 0x46, (byte) 0x01, (byte) 0x01, (byte) 0x30, (byte) 0x0a, (byte) 0x06, (byte) 0x08,  -      (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x0b, (byte) 0x01,  -      (byte) 0x30, (byte) 0x81, (byte) 0x84, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01,  -      (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x01, (byte) 0x01, (byte) 0x04, (byte) 0x78, (byte) 0x30,  -      (byte) 0x76, (byte) 0x30, (byte) 0x2c, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01,  -      (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30, (byte) 0x01, (byte) 0x86, (byte) 0x20, (byte) 0x68,  -      (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x6f, (byte) 0x63,  -      (byte) 0x73, (byte) 0x70, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e,  -      (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e,  -      (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x70, (byte) 0x30,  -      (byte) 0x46, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -      (byte) 0x07, (byte) 0x30, (byte) 0x02, (byte) 0x86, (byte) 0x3a, (byte) 0x68, (byte) 0x74, (byte) 0x74,  -      (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e,  -      (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e,  -      (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x63, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x73,  -      (byte) 0x2f, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d,  -      (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d,  -      (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53, (byte) 0x69, (byte) 0x67,  -      (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x2e, (byte) 0x63, (byte) 0x72, (byte) 0x74, (byte) 0x30,  -      (byte) 0x81, (byte) 0x9d, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x20, (byte) 0x04,  -      (byte) 0x81, (byte) 0x95, (byte) 0x30, (byte) 0x81, (byte) 0x92, (byte) 0x30, (byte) 0x81, (byte) 0x85,  -      (byte) 0x06, (byte) 0x06, (byte) 0x2a, (byte) 0x28, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x03,  -      (byte) 0x30, (byte) 0x7b, (byte) 0x30, (byte) 0x3d, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06,  -      (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x01, (byte) 0x16, (byte) 0x31,  -      (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x77,  -      (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75,  -      (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x64, (byte) 0x6f,  -      (byte) 0x63, (byte) 0x73, (byte) 0x2f, (byte) 0x63, (byte) 0x70, (byte) 0x2f, (byte) 0x61, (byte) 0x2d,  -      (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x70, (byte) 0x72, (byte) 0x65,  -      (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73,  -      (byte) 0x74, (byte) 0x30, (byte) 0x3a, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01,  -      (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x02, (byte) 0x30, (byte) 0x2e, (byte) 0x1a,  -      (byte) 0x2c, (byte) 0x44, (byte) 0x69, (byte) 0x65, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x20,  -      (byte) 0x5a, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x6b,  -      (byte) 0x61, (byte) 0x74, (byte) 0x20, (byte) 0x64, (byte) 0x69, (byte) 0x65, (byte) 0x6e, (byte) 0x74,  -      (byte) 0x20, (byte) 0x6e, (byte) 0x75, (byte) 0x72, (byte) 0x20, (byte) 0x7a, (byte) 0x75, (byte) 0x20,  -      (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x7a, (byte) 0x77, (byte) 0x65, (byte) 0x63,  -      (byte) 0x6b, (byte) 0x65, (byte) 0x6e, (byte) 0x20, (byte) 0x21, (byte) 0x30, (byte) 0x08, (byte) 0x06,  -      (byte) 0x06, (byte) 0x04, (byte) 0x00, (byte) 0x8b, (byte) 0x30, (byte) 0x01, (byte) 0x01, (byte) 0x30,  -      (byte) 0x81, (byte) 0xa4, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x1f, (byte) 0x04,  -      (byte) 0x81, (byte) 0x9c, (byte) 0x30, (byte) 0x81, (byte) 0x99, (byte) 0x30, (byte) 0x81, (byte) 0x96,  -      (byte) 0xa0, (byte) 0x81, (byte) 0x93, (byte) 0xa0, (byte) 0x81, (byte) 0x90, (byte) 0x86, (byte) 0x81,  -      (byte) 0x8d, (byte) 0x6c, (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -      (byte) 0x6c, (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73,  -      (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73,  -      (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f, (byte) 0x75, (byte) 0x3d,  -      (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50,  -      (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54,  -      (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53, (byte) 0x69, (byte) 0x67, (byte) 0x2d,  -      (byte) 0x30, (byte) 0x32, (byte) 0x2c, (byte) 0x6f, (byte) 0x3d, (byte) 0x41, (byte) 0x2d, (byte) 0x54,  -      (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2c, (byte) 0x63, (byte) 0x3d, (byte) 0x41,  -      (byte) 0x54, (byte) 0x3f, (byte) 0x63, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66,  -      (byte) 0x69, (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x76,  -      (byte) 0x6f, (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x6c,  -      (byte) 0x69, (byte) 0x73, (byte) 0x74, (byte) 0x3f, (byte) 0x62, (byte) 0x61, (byte) 0x73, (byte) 0x65,  -      (byte) 0x3f, (byte) 0x6f, (byte) 0x62, (byte) 0x6a, (byte) 0x65, (byte) 0x63, (byte) 0x74, (byte) 0x63,  -      (byte) 0x6c, (byte) 0x61, (byte) 0x73, (byte) 0x73, (byte) 0x3d, (byte) 0x65, (byte) 0x69, (byte) 0x64,  -      (byte) 0x43, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63,  -      (byte) 0x61, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x41, (byte) 0x75, (byte) 0x74,  -      (byte) 0x68, (byte) 0x6f, (byte) 0x72, (byte) 0x69, (byte) 0x74, (byte) 0x79, (byte) 0x30, (byte) 0x11,  -      (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e, (byte) 0x04, (byte) 0x0a, (byte) 0x04,  -      (byte) 0x08, (byte) 0x46, (byte) 0x08, (byte) 0xda, (byte) 0x9e, (byte) 0x68, (byte) 0xf8, (byte) 0xe5,  -      (byte) 0x81, (byte) 0x30, (byte) 0x0e, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0f,  -      (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x04, (byte) 0x04, (byte) 0x03, (byte) 0x02, (byte) 0x06,  -      (byte) 0xc0, (byte) 0x30, (byte) 0x25, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x11,  -      (byte) 0x04, (byte) 0x1e, (byte) 0x30, (byte) 0x1c, (byte) 0x81, (byte) 0x1a, (byte) 0x74, (byte) 0x68,  -      (byte) 0x6f, (byte) 0x6d, (byte) 0x61, (byte) 0x73, (byte) 0x2e, (byte) 0x72, (byte) 0x6f, (byte) 0x65,  -      (byte) 0x73, (byte) 0x73, (byte) 0x6c, (byte) 0x65, (byte) 0x72, (byte) 0x40, (byte) 0x65, (byte) 0x67,  -      (byte) 0x69, (byte) 0x7a, (byte) 0x2e, (byte) 0x67, (byte) 0x76, (byte) 0x2e, (byte) 0x61, (byte) 0x74,  -      (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04,  -      (byte) 0x02, (byte) 0x30, (byte) 0x00, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a,  -      (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05,  -      (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0xd8,  -      (byte) 0xec, (byte) 0xe5, (byte) 0x5c, (byte) 0x17, (byte) 0x42, (byte) 0xe8, (byte) 0x2f, (byte) 0x04,  -      (byte) 0x1f, (byte) 0xe2, (byte) 0x04, (byte) 0x57, (byte) 0x07, (byte) 0x30, (byte) 0xdc, (byte) 0x4f,  -      (byte) 0x61, (byte) 0x7d, (byte) 0xd8, (byte) 0x89, (byte) 0x36, (byte) 0x31, (byte) 0x26, (byte) 0x45,  -      (byte) 0x55, (byte) 0x64, (byte) 0xd3, (byte) 0x55, (byte) 0x1b, (byte) 0x83, (byte) 0x51, (byte) 0xa0,  -      (byte) 0x39, (byte) 0x1b, (byte) 0x6a, (byte) 0x7e, (byte) 0xfa, (byte) 0x7e, (byte) 0x2c, (byte) 0xd0,  -      (byte) 0xd3, (byte) 0x86, (byte) 0x7b, (byte) 0x8d, (byte) 0x29, (byte) 0x8f, (byte) 0xa3, (byte) 0x83,  -      (byte) 0xd2, (byte) 0x72, (byte) 0xce, (byte) 0x43, (byte) 0xcf, (byte) 0xc1, (byte) 0x27, (byte) 0xf1,  -      (byte) 0x4d, (byte) 0x11, (byte) 0xe2, (byte) 0x67, (byte) 0xbe, (byte) 0x6e, (byte) 0x34, (byte) 0x7d,  -      (byte) 0x04, (byte) 0x1f, (byte) 0xba, (byte) 0x55, (byte) 0x34, (byte) 0xea, (byte) 0xc2, (byte) 0xcf,  -      (byte) 0x0f, (byte) 0x64, (byte) 0x7b, (byte) 0x84, (byte) 0xe0, (byte) 0x55, (byte) 0x05, (byte) 0x82,  -      (byte) 0xdd, (byte) 0x9d, (byte) 0xd7, (byte) 0xeb, (byte) 0x91, (byte) 0x78, (byte) 0x69, (byte) 0x49,  -      (byte) 0x58, (byte) 0x70, (byte) 0xff, (byte) 0x83, (byte) 0x70, (byte) 0xa0, (byte) 0xb3, (byte) 0xb7,  -      (byte) 0x3d, (byte) 0x0f, (byte) 0x8e, (byte) 0xe9, (byte) 0x1b, (byte) 0x21, (byte) 0xef, (byte) 0x31,  -      (byte) 0x0b, (byte) 0xe3, (byte) 0xac, (byte) 0xc6, (byte) 0x0f, (byte) 0x57, (byte) 0x4f, (byte) 0xd8,  -      (byte) 0xd6, (byte) 0xb2, (byte) 0xd0, (byte) 0xca, (byte) 0xd9, (byte) 0x6f, (byte) 0x3f, (byte) 0x6e,  -      (byte) 0x83, (byte) 0x8c, (byte) 0xff, (byte) 0x47, (byte) 0xca, (byte) 0xbc, (byte) 0x81, (byte) 0x60,  -      (byte) 0x5f, (byte) 0xe2, (byte) 0xdd, (byte) 0xbd, (byte) 0x89, (byte) 0xb2, (byte) 0x52, (byte) 0xac,  -      (byte) 0xc3, (byte) 0x8b, (byte) 0x44, (byte) 0x99, (byte) 0x70, (byte) 0xe7, (byte) 0x2c, (byte) 0x52,  -      (byte) 0x21, (byte) 0xaa, (byte) 0xa2, (byte) 0x0f, (byte) 0x38, (byte) 0xc6, (byte) 0x98, (byte) 0x4d,  -      (byte) 0x48, (byte) 0xda, (byte) 0x65, (byte) 0x41, (byte) 0xa4, (byte) 0xad, (byte) 0x41, (byte) 0x7c,  -      (byte) 0x99, (byte) 0x14, (byte) 0xe5, (byte) 0xcb, (byte) 0x51, (byte) 0xd7, (byte) 0xab, (byte) 0x76,  -      (byte) 0xb1, (byte) 0x20, (byte) 0xce, (byte) 0x32, (byte) 0x1b, (byte) 0x11, (byte) 0x5c, (byte) 0xef,  -      (byte) 0x8b, (byte) 0x4f, (byte) 0xf3, (byte) 0x46, (byte) 0x5b, (byte) 0x11, (byte) 0xd7, (byte) 0x91,  -      (byte) 0xb6, (byte) 0x41, (byte) 0xd3, (byte) 0x23, (byte) 0xb6, (byte) 0x03, (byte) 0xa8, (byte) 0x98,  -      (byte) 0x40, (byte) 0x76, (byte) 0x13, (byte) 0x5d, (byte) 0x4c, (byte) 0xb2, (byte) 0xe9, (byte) 0xfe,  -      (byte) 0x90, (byte) 0x27, (byte) 0x04, (byte) 0xfc, (byte) 0x10, (byte) 0x45, (byte) 0x8b, (byte) 0x10,  -      (byte) 0xc3, (byte) 0xb2, (byte) 0x4b, (byte) 0x3c, (byte) 0xd2, (byte) 0x5b, (byte) 0x0f, (byte) 0xe8,  -      (byte) 0xfb, (byte) 0xb9, (byte) 0x45, (byte) 0xaf, (byte) 0x05, (byte) 0xc4, (byte) 0xba, (byte) 0xc7,  -      (byte) 0xfc, (byte) 0xa5, (byte) 0x7d, (byte) 0xdb, (byte) 0x4f, (byte) 0xa9, (byte) 0x76, (byte) 0xe2,  -      (byte) 0xfa, (byte) 0xc7, (byte) 0xe0, (byte) 0xad, (byte) 0x70, (byte) 0xaa, (byte) 0x40, (byte) 0x15,  -      (byte) 0x64, (byte) 0x01, (byte) 0xba, (byte) 0xc6, (byte) 0xc3, (byte) 0x83, (byte) 0x65, (byte) 0x95,  -      (byte) 0x3c, (byte) 0x05, (byte) 0x53, (byte) 0x88, (byte) 0xe7, (byte) 0x19, (byte) 0x98 -    }; -      protected static final int KID_PIN_SIG = 0x81; -  protected byte[] EF_C_CH_DS = new byte[2000]; -   -  public ACOSApplSIG() { -    // Files -    System.arraycopy(C_CH_DS, 0, EF_C_CH_DS, 0, C_CH_DS.length); -    putFile(new File(FID_EF_C_CH_DS, EF_C_CH_DS, FCI_EF_C_CH_DS)); -     -    // PINs -    try { -      pins.put(KID_PIN_SIG, new PIN(Arrays.copyOf("123456".getBytes("ASCII"), 8), KID_PIN_SIG, 3, PIN.STATE_RESET)); -    } catch (UnsupportedEncodingException e) { -      throw new RuntimeException(e); -    } -  } - -  @Override -  public byte[] getAID() { -    return AID_SIG; -  } - -  @Override -  public byte[] getFID() { -    return FID_SIG; -  } - -  @Override -  public byte[] getFCI() { -    return FCI; -  } -    @Override    public ResponseAPDU cmdPERFORM_SECURITY_OPERATION(CommandAPDU command, CardChannelEmul channel) { @@ -295,8 +81,4 @@ public abstract class ACOSApplSIG extends ACOSAppl {    } -  public void clearCert() { -    Arrays.fill(EF_C_CH_DS, (byte) 0x00); -  } -  }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardChannelEmul.java index 25923686..5fcf2e37 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardChannelEmul.java @@ -18,34 +18,17 @@ package at.gv.egiz.smcc.acos;  import java.util.Arrays; -import javax.smartcardio.Card;  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.AbstractAppl;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.CardEmul;  import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public abstract class ACOSCardChannelEmul extends CardChannelEmul { -  /** -   *  -   */ -  protected CardEmul cardEmul; - -  public ACOSCardChannelEmul(CardEmul cardEmul) { -    this.cardEmul = cardEmul; -  } - -  @Override -  public Card getCard() { -    return cardEmul; -  } -    protected ResponseAPDU cmdSELECT(CommandAPDU command) throws CardException {      byte[] fid = command.getData(); @@ -58,7 +41,7 @@ public abstract class ACOSCardChannelEmul extends CardChannelEmul {        }        currentAppl = appl; -      byte[] fci = currentAppl.getFCI(); +      byte[] fci = currentAppl.getFCX();        byte[] response = new byte[fci.length + 2];        System.arraycopy(fci, 0, response, 0, fci.length);        response[fci.length] = (byte) 0x90; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardEmul.java deleted file mode 100644 index b9f70a5d..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardEmul.java +++ /dev/null @@ -1,38 +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.acos; - - -import javax.smartcardio.ATR; - -import at.gv.egiz.smcc.CardEmul; - -@SuppressWarnings("restriction") -public abstract class ACOSCardEmul extends CardEmul { - -  protected static ATR ATR = new ATR(new byte[] { -        (byte) 0x3b, (byte) 0xbf, (byte) 0x11, (byte) 0x00, (byte) 0x81, (byte) 0x31, (byte) 0xfe, (byte) 0x45,  -        (byte) 0x45, (byte) 0x50, (byte) 0x41, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,  -        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xf1 -  }); -   -  @Override -  public ATR getATR() { -    return ATR; -  } - -}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardTest.java deleted file mode 100644 index 4f012739..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardTest.java +++ /dev/null @@ -1,230 +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.acos; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; - -import org.junit.Test; - -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.CardNotSupportedException; -import at.gv.egiz.smcc.CardTest; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.SignatureCard.KeyboxName; - -public abstract class ACOSCardTest extends CardTest { - -  public ACOSCardTest() { -    super(); -  } - -  protected abstract int getVersion(); - -  @Test -  public void testGetInfoboxIdentityLinkEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplDEC appl = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    appl.clearInfobox(); - -    byte[] idlink = signatureCard.getInfobox("IdentityLink", -        new SMCCTestPINProvider(pin), null); -    assertNull(idlink); - -  } -   -  @Test(expected = SignatureCardException.class) -  public void testGetInfoboxIdentityInvalid() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplDEC appl = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    appl.setInfoboxHeader((byte) 0xFF); - -    signatureCard.getInfobox("IdentityLink", new SMCCTestPINProvider(pin), null); - -  } - -  @Test -  public void testGetCerts() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); - -    byte[] cert; - -    cert = signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); -    assertNotNull(cert); -    assertTrue(Arrays.equals(cert, A04ApplSIG.C_CH_DS)); - -    cert = signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); -    assertNotNull(cert); -    assertTrue(Arrays.equals(cert, A04ApplDEC.C_CH_EKEY)); - -  } - -  @Test(expected = NotActivatedException.class) -  public void testGetSIGCertEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplSIG appl = (ACOSApplSIG) card.getApplication(ACOSAppl.AID_SIG); -    appl.clearCert(); - -    signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); - -  } - -  @Test(expected = NotActivatedException.class) -  public void testGetDECCertEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplDEC appl = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    appl.clearCert(); - -    signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); - -  } - -  @Test -  public void testSignSIG() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    char[] pin = "123456".toCharArray(); - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplSIG appl = (ACOSApplSIG) card.getApplication(ACOSAppl.AID_SIG); -    appl.setPin(ACOSApplSIG.KID_PIN_SIG, pin); - -    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), -        KeyboxName.SECURE_SIGNATURE_KEYPAIR, new SMCCTestPINProvider(pin), null); - -    assertNotNull(signature); - -  } - -  @Test -  public void testSignDEC() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    char[] pin = "1234".toCharArray(); - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplDEC appl = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    appl.setPin(ACOSApplDEC.KID_PIN_DEC, pin); - -    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), -        KeyboxName.CERITIFIED_KEYPAIR, new SMCCTestPINProvider(pin), null); - -    assertNotNull(signature); - -  } - -  @Test(expected = LockedException.class) -  public void testSignSIGInvalidPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("000000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignDECInvalidPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("0000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignSIGBlockedPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplSIG appl = (ACOSApplSIG) card.getApplication(ACOSAppl.AID_SIG); -    appl.setPin(ACOSApplSIG.KID_PIN_SIG, null); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("000000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignDECBlockedPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    ACOSApplDEC appl = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); -    appl.setPin(ACOSApplDEC.KID_PIN_DEC, null); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("0000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -        pinProvider, null); - -  } - -}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java index 814ced11..5c0065bc 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java @@ -19,7 +19,6 @@ package at.gv.egiz.smcc.pin.gui;  import at.gv.egiz.smcc.CancelledException;  import at.gv.egiz.smcc.PinInfo; -@SuppressWarnings("restriction")  public class InterruptPINProvider extends DummyPINGUI implements PINGUI {    public InterruptPINProvider() { diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSAppl.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSAppl.java index 62528e6e..7267e79b 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSAppl.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSAppl.java @@ -16,9 +16,6 @@  */  package at.gv.egiz.smcc.starcos; -import java.io.UnsupportedEncodingException; -import java.math.BigInteger; -import java.util.Arrays;  import java.util.Iterator;  import javax.smartcardio.CommandAPDU; @@ -29,31 +26,15 @@ import at.gv.egiz.smcc.CardAppl;  import at.gv.egiz.smcc.CardChannelEmul;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public abstract class STARCOSAppl extends AbstractAppl implements CardAppl { -  public static byte[] AID_SichereSignatur = new byte[] { (byte) 0xD0, (byte) 0x40, -        (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01 }; -   -  public static byte[] FID_SichereSignatur = new byte[] { (byte) 0x3F, (byte) 0x04 }; -   -  public static byte[] AID_Infobox = new byte[] { (byte) 0xD0, (byte) 0x40, -    (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x18, (byte) 0x01 }; - -  public static byte[] FID_Infobox = new byte[] { (byte) 0x3F, (byte) 0x06 }; - -  public static byte[] AID_GewoehnlicheSignatur = new byte[] { (byte) 0xD0, (byte) 0x40, -    (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x13, (byte) 0x01 }; - -  public static byte[] FID_GewoehnlicheSignatur = new byte[] { (byte) 0x3F, (byte) 0x05 }; -      protected STARCOSCardChannelEmul channel;    protected byte[] securityEnv;    protected byte[] hash; -  public STARCOSAppl(STARCOSCardChannelEmul channel) { +  public void setCardChannel(STARCOSCardChannelEmul channel) {      this.channel = channel;    } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplGewoehnlicheSignatur.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplGewoehnlicheSignatur.java index 8741dd2d..d443ef38 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplGewoehnlicheSignatur.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplGewoehnlicheSignatur.java @@ -16,220 +16,41 @@  */  package at.gv.egiz.smcc.starcos; +import java.security.GeneralSecurityException; +import java.security.interfaces.RSAPrivateKey;  import java.util.Arrays;  import java.util.Random; +import javax.crypto.Cipher;  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -@SuppressWarnings("restriction")  public class STARCOSApplGewoehnlicheSignatur extends STARCOSAppl { - -  private static byte[] FCI = new byte[] { (byte) 0x6f, (byte) 0x14, -      (byte) 0x84, (byte) 0x08, (byte) 0xd0, (byte) 0x40, (byte) 0x00, -      (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x13, (byte) 0x01, -      (byte) 0xa5, (byte) 0x08, (byte) 0x53, (byte) 0x02, (byte) 0x01, -      (byte) 0x10, (byte) 0x54, (byte) 0x02, (byte) 0x01, (byte) 0x00 }; -   -  protected static byte[] FID_EF_C_X509_CH_AUT = new byte[] { (byte) 0x2f, -      (byte) 0x01 }; -   -  protected static byte[] FCI_EF_C_X509_CH_AUT = new byte[] { (byte) 0x62, -      (byte) 0x16, (byte) 0x80, (byte) 0x02, (byte) 0x04, (byte) 0x9c, -      (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x83, (byte) 0x02, -      (byte) 0x2f, (byte) 0x01, (byte) 0x88, (byte) 0x01, (byte) 0x08, -      (byte) 0x8a, (byte) 0x01, (byte) 0x05, (byte) 0xa1, (byte) 0x03, -      (byte) 0x8b, (byte) 0x01, (byte) 0x08 }; -  protected static byte[] C_X509_CH_AUT = new byte[] { -    (byte) 0x30, (byte) 0x82, (byte) 0x04, (byte) 0x98, (byte) 0x30, (byte) 0x82, (byte) 0x03, (byte) 0x80,  -    (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x03, (byte) 0x02,  -    (byte) 0x06, (byte) 0x5f, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,  -    (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -    (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x95, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09,  -    (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41,  -    (byte) 0x54, (byte) 0x31, (byte) 0x48, (byte) 0x30, (byte) 0x46, (byte) 0x06, (byte) 0x03, (byte) 0x55,  -    (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x3f, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x47, (byte) 0x65, (byte) 0x73, (byte) 0x2e,  -    (byte) 0x20, (byte) 0x66, (byte) 0x2e, (byte) 0x20, (byte) 0x53, (byte) 0x69, (byte) 0x63, (byte) 0x68,  -    (byte) 0x65, (byte) 0x72, (byte) 0x68, (byte) 0x65, (byte) 0x69, (byte) 0x74, (byte) 0x73, (byte) 0x73,  -    (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x20, (byte) 0x69,  -    (byte) 0x6d, (byte) 0x20, (byte) 0x65, (byte) 0x6c, (byte) 0x65, (byte) 0x6b, (byte) 0x74, (byte) 0x72,  -    (byte) 0x2e, (byte) 0x20, (byte) 0x44, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x6e, (byte) 0x76,  -    (byte) 0x65, (byte) 0x72, (byte) 0x6b, (byte) 0x65, (byte) 0x68, (byte) 0x72, (byte) 0x20, (byte) 0x47,  -    (byte) 0x6d, (byte) 0x62, (byte) 0x48, (byte) 0x31, (byte) 0x1d, (byte) 0x30, (byte) 0x1b, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0b, (byte) 0x0c, (byte) 0x14, (byte) 0x61, (byte) 0x2d,  -    (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x6f, (byte) 0x6b,  -    (byte) 0x65, (byte) 0x6e, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d,  -    (byte) 0x30, (byte) 0x33, (byte) 0x31, (byte) 0x1d, (byte) 0x30, (byte) 0x1b, (byte) 0x06, (byte) 0x03,  -    (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c, (byte) 0x14, (byte) 0x61, (byte) 0x2d, (byte) 0x73,  -    (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x6f, (byte) 0x6b, (byte) 0x65,  -    (byte) 0x6e, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x30,  -    (byte) 0x33, (byte) 0x30, (byte) 0x1e, (byte) 0x17, (byte) 0x0d, (byte) 0x30, (byte) 0x39, (byte) 0x30,  -    (byte) 0x33, (byte) 0x30, (byte) 0x36, (byte) 0x31, (byte) 0x35, (byte) 0x32, (byte) 0x32, (byte) 0x33,  -    (byte) 0x38, (byte) 0x5a, (byte) 0x17, (byte) 0x0d, (byte) 0x31, (byte) 0x32, (byte) 0x30, (byte) 0x33,  -    (byte) 0x30, (byte) 0x36, (byte) 0x31, (byte) 0x35, (byte) 0x32, (byte) 0x32, (byte) 0x33, (byte) 0x38,  -    (byte) 0x5a, (byte) 0x30, (byte) 0x72, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x54,  -    (byte) 0x31, (byte) 0x20, (byte) 0x30, (byte) 0x1e, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -    (byte) 0x03, (byte) 0x0c, (byte) 0x17, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0xc5, (byte) 0x90,  -    (byte) 0x7a, (byte) 0x67, (byte) 0xc3, (byte) 0xbc, (byte) 0x72, (byte) 0x20, (byte) 0x58, (byte) 0x58,  -    (byte) 0x58, (byte) 0x54, (byte) 0xc3, (byte) 0xbc, (byte) 0x7a, (byte) 0x65, (byte) 0x6b, (byte) 0xc3,  -    (byte) 0xa7, (byte) 0x69, (byte) 0x31, (byte) 0x15, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03,  -    (byte) 0x55, (byte) 0x04, (byte) 0x04, (byte) 0x0c, (byte) 0x0c, (byte) 0x58, (byte) 0x58, (byte) 0x58,  -    (byte) 0x54, (byte) 0xc3, (byte) 0xbc, (byte) 0x7a, (byte) 0x65, (byte) 0x6b, (byte) 0xc3, (byte) 0xa7,  -    (byte) 0x69, (byte) 0x31, (byte) 0x13, (byte) 0x30, (byte) 0x11, (byte) 0x06, (byte) 0x03, (byte) 0x55,  -    (byte) 0x04, (byte) 0x2a, (byte) 0x0c, (byte) 0x0a, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0xc5,  -    (byte) 0x90, (byte) 0x7a, (byte) 0x67, (byte) 0xc3, (byte) 0xbc, (byte) 0x72, (byte) 0x31, (byte) 0x15,  -    (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x05, (byte) 0x13,  -    (byte) 0x0c, (byte) 0x37, (byte) 0x30, (byte) 0x34, (byte) 0x38, (byte) 0x37, (byte) 0x31, (byte) 0x30,  -    (byte) 0x35, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x38, (byte) 0x30, (byte) 0x49, (byte) 0x30,  -    (byte) 0x13, (byte) 0x06, (byte) 0x07, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0xce, (byte) 0x3d,  -    (byte) 0x02, (byte) 0x01, (byte) 0x06, (byte) 0x08, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0xce,  -    (byte) 0x3d, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0x03, (byte) 0x32, (byte) 0x00, (byte) 0x04,  -    (byte) 0x02, (byte) 0x55, (byte) 0x51, (byte) 0xf9, (byte) 0x2a, (byte) 0xea, (byte) 0x6f, (byte) 0xd3,  -    (byte) 0xf5, (byte) 0xda, (byte) 0xa9, (byte) 0x7a, (byte) 0x22, (byte) 0xfc, (byte) 0xb4, (byte) 0x38,  -    (byte) 0xe9, (byte) 0x5c, (byte) 0xdc, (byte) 0x6b, (byte) 0x86, (byte) 0xa6, (byte) 0x77, (byte) 0xa7,  -    (byte) 0x90, (byte) 0xf3, (byte) 0x36, (byte) 0xe0, (byte) 0xc4, (byte) 0xde, (byte) 0x72, (byte) 0xf2,  -    (byte) 0x1a, (byte) 0x07, (byte) 0xfa, (byte) 0xd0, (byte) 0xc8, (byte) 0x1c, (byte) 0xa0, (byte) 0xc8,  -    (byte) 0x8b, (byte) 0x5d, (byte) 0xde, (byte) 0x9e, (byte) 0xf8, (byte) 0x3b, (byte) 0x7c, (byte) 0x8c,  -    (byte) 0xa3, (byte) 0x82, (byte) 0x01, (byte) 0xec, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0xe8,  -    (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x23, (byte) 0x04,  -    (byte) 0x0c, (byte) 0x30, (byte) 0x0a, (byte) 0x80, (byte) 0x08, (byte) 0x47, (byte) 0x7e, (byte) 0x5b,  -    (byte) 0xdb, (byte) 0x37, (byte) 0x33, (byte) 0xb1, (byte) 0xfa, (byte) 0x30, (byte) 0x7e, (byte) 0x06,  -    (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x01,  -    (byte) 0x01, (byte) 0x04, (byte) 0x72, (byte) 0x30, (byte) 0x70, (byte) 0x30, (byte) 0x2c, (byte) 0x06,  -    (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30,  -    (byte) 0x01, (byte) 0x86, (byte) 0x20, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a,  -    (byte) 0x2f, (byte) 0x2f, (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x70, (byte) 0x2d, (byte) 0x74,  -    (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f,  -    (byte) 0x63, (byte) 0x73, (byte) 0x70, (byte) 0x30, (byte) 0x40, (byte) 0x06, (byte) 0x08, (byte) 0x2b,  -    (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30, (byte) 0x02, (byte) 0x86,  -    (byte) 0x34, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -    (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x63,  -    (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x73, (byte) 0x2f, (byte) 0x61, (byte) 0x2d, (byte) 0x73,  -    (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x6f, (byte) 0x6b, (byte) 0x65,  -    (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x30,  -    (byte) 0x33, (byte) 0x2e, (byte) 0x63, (byte) 0x72, (byte) 0x74, (byte) 0x30, (byte) 0x81, (byte) 0x86,  -    (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x20, (byte) 0x04, (byte) 0x7f, (byte) 0x30,  -    (byte) 0x7d, (byte) 0x30, (byte) 0x7b, (byte) 0x06, (byte) 0x06, (byte) 0x2a, (byte) 0x28, (byte) 0x00,  -    (byte) 0x11, (byte) 0x01, (byte) 0x03, (byte) 0x30, (byte) 0x71, (byte) 0x30, (byte) 0x35, (byte) 0x06,  -    (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02,  -    (byte) 0x01, (byte) 0x16, (byte) 0x29, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a,  -    (byte) 0x2f, (byte) 0x2f, (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d,  -    (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74,  -    (byte) 0x2f, (byte) 0x64, (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x2f, (byte) 0x63, (byte) 0x70,  -    (byte) 0x2f, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d,  -    (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x30, (byte) 0x38, (byte) 0x06, (byte) 0x08,  -    (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x02,  -    (byte) 0x30, (byte) 0x2c, (byte) 0x1a, (byte) 0x2a, (byte) 0x44, (byte) 0x69, (byte) 0x65, (byte) 0x73,  -    (byte) 0x65, (byte) 0x73, (byte) 0x20, (byte) 0x5a, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69,  -    (byte) 0x66, (byte) 0x69, (byte) 0x6b, (byte) 0x61, (byte) 0x74, (byte) 0x20, (byte) 0x64, (byte) 0x69,  -    (byte) 0x65, (byte) 0x6e, (byte) 0x74, (byte) 0x20, (byte) 0x6e, (byte) 0x75, (byte) 0x72, (byte) 0x20,  -    (byte) 0x7a, (byte) 0x75, (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x7a,  -    (byte) 0x77, (byte) 0x65, (byte) 0x63, (byte) 0x6b, (byte) 0x65, (byte) 0x6e, (byte) 0x30, (byte) 0x81,  -    (byte) 0x99, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x1f, (byte) 0x04, (byte) 0x81,  -    (byte) 0x91, (byte) 0x30, (byte) 0x81, (byte) 0x8e, (byte) 0x30, (byte) 0x81, (byte) 0x8b, (byte) 0xa0,  -    (byte) 0x81, (byte) 0x88, (byte) 0xa0, (byte) 0x81, (byte) 0x85, (byte) 0x86, (byte) 0x81, (byte) 0x82,  -    (byte) 0x6c, (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x6c,  -    (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74,  -    (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74,  -    (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f, (byte) 0x75, (byte) 0x3d, (byte) 0x61,  -    (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x6f,  -    (byte) 0x6b, (byte) 0x65, (byte) 0x6e, (byte) 0x2d, (byte) 0x30, (byte) 0x33, (byte) 0x2c, (byte) 0x6f,  -    (byte) 0x3d, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74,  -    (byte) 0x2c, (byte) 0x63, (byte) 0x3d, (byte) 0x41, (byte) 0x54, (byte) 0x3f, (byte) 0x63, (byte) 0x65,  -    (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63, (byte) 0x61, (byte) 0x74,  -    (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x76, (byte) 0x6f, (byte) 0x63, (byte) 0x61, (byte) 0x74,  -    (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x6c, (byte) 0x69, (byte) 0x73, (byte) 0x74, (byte) 0x3f,  -    (byte) 0x62, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x3f, (byte) 0x6f, (byte) 0x62, (byte) 0x6a,  -    (byte) 0x65, (byte) 0x63, (byte) 0x74, (byte) 0x63, (byte) 0x6c, (byte) 0x61, (byte) 0x73, (byte) 0x73,  -    (byte) 0x3d, (byte) 0x65, (byte) 0x69, (byte) 0x64, (byte) 0x43, (byte) 0x65, (byte) 0x72, (byte) 0x74,  -    (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x69, (byte) 0x6f,  -    (byte) 0x6e, (byte) 0x41, (byte) 0x75, (byte) 0x74, (byte) 0x68, (byte) 0x6f, (byte) 0x72, (byte) 0x69,  -    (byte) 0x74, (byte) 0x79, (byte) 0x30, (byte) 0x11, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,  -    (byte) 0x0e, (byte) 0x04, (byte) 0x0a, (byte) 0x04, (byte) 0x08, (byte) 0x4a, (byte) 0x43, (byte) 0x51,  -    (byte) 0x30, (byte) 0x45, (byte) 0xfc, (byte) 0x2a, (byte) 0x00, (byte) 0x30, (byte) 0x0e, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0f, (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x04,  -    (byte) 0x04, (byte) 0x03, (byte) 0x02, (byte) 0x04, (byte) 0xb0, (byte) 0x30, (byte) 0x09, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x02, (byte) 0x30, (byte) 0x00,  -    (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86,  -    (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x03,  -    (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x31, (byte) 0xdc, (byte) 0xf3, (byte) 0x43,  -    (byte) 0x79, (byte) 0xdd, (byte) 0xa9, (byte) 0x2a, (byte) 0xdc, (byte) 0x21, (byte) 0xf9, (byte) 0xd9,  -    (byte) 0x8f, (byte) 0x9a, (byte) 0x4e, (byte) 0x01, (byte) 0x40, (byte) 0x9a, (byte) 0xf1, (byte) 0x14,  -    (byte) 0x8d, (byte) 0x3a, (byte) 0x5e, (byte) 0x88, (byte) 0x36, (byte) 0x45, (byte) 0x1f, (byte) 0x16,  -    (byte) 0x3e, (byte) 0xeb, (byte) 0xa2, (byte) 0xef, (byte) 0xbf, (byte) 0x55, (byte) 0xbd, (byte) 0x5e,  -    (byte) 0x0e, (byte) 0x19, (byte) 0xc7, (byte) 0x0c, (byte) 0xbd, (byte) 0xed, (byte) 0xdf, (byte) 0xb8,  -    (byte) 0x75, (byte) 0x4e, (byte) 0x6a, (byte) 0x3a, (byte) 0x9a, (byte) 0x10, (byte) 0xfa, (byte) 0x49,  -    (byte) 0xc1, (byte) 0xd2, (byte) 0x35, (byte) 0xc5, (byte) 0x9a, (byte) 0xd7, (byte) 0xf4, (byte) 0xf0,  -    (byte) 0xcd, (byte) 0x13, (byte) 0xd1, (byte) 0x24, (byte) 0x06, (byte) 0xf8, (byte) 0x1f, (byte) 0xea,  -    (byte) 0xd6, (byte) 0x7a, (byte) 0xcb, (byte) 0x4f, (byte) 0xb5, (byte) 0x3e, (byte) 0x6c, (byte) 0xb2,  -    (byte) 0xfc, (byte) 0xe3, (byte) 0xaa, (byte) 0x2b, (byte) 0x20, (byte) 0x91, (byte) 0xf5, (byte) 0x5b,  -    (byte) 0xf1, (byte) 0x94, (byte) 0x0e, (byte) 0x06, (byte) 0x0a, (byte) 0xfd, (byte) 0x25, (byte) 0x71,  -    (byte) 0x11, (byte) 0xfc, (byte) 0x84, (byte) 0x46, (byte) 0xef, (byte) 0x5b, (byte) 0x0b, (byte) 0xa4,  -    (byte) 0x4a, (byte) 0x5d, (byte) 0x42, (byte) 0x99, (byte) 0xc8, (byte) 0x4e, (byte) 0x51, (byte) 0xd8,  -    (byte) 0x63, (byte) 0xd1, (byte) 0xbd, (byte) 0x00, (byte) 0xa3, (byte) 0xdd, (byte) 0x8f, (byte) 0x12,  -    (byte) 0x42, (byte) 0xbe, (byte) 0xca, (byte) 0x15, (byte) 0x37, (byte) 0x4c, (byte) 0xd2, (byte) 0xc9,  -    (byte) 0xa7, (byte) 0x37, (byte) 0xb2, (byte) 0x76, (byte) 0xb7, (byte) 0x34, (byte) 0x92, (byte) 0x98,  -    (byte) 0x60, (byte) 0xe7, (byte) 0x3d, (byte) 0x55, (byte) 0xa2, (byte) 0x6c, (byte) 0xb6, (byte) 0x66,  -    (byte) 0x67, (byte) 0xe1, (byte) 0xe4, (byte) 0x8f, (byte) 0xe3, (byte) 0xa5, (byte) 0xb8, (byte) 0xb5,  -    (byte) 0xc8, (byte) 0x8f, (byte) 0x9e, (byte) 0xe3, (byte) 0xf1, (byte) 0xaa, (byte) 0x8e, (byte) 0xe6,  -    (byte) 0xe2, (byte) 0x47, (byte) 0x49, (byte) 0x3d, (byte) 0xbe, (byte) 0x8c, (byte) 0xdd, (byte) 0xce,  -    (byte) 0x8d, (byte) 0x52, (byte) 0xac, (byte) 0xb9, (byte) 0x83, (byte) 0xe9, (byte) 0x9d, (byte) 0x98,  -    (byte) 0x7b, (byte) 0xda, (byte) 0x2b, (byte) 0xbc, (byte) 0x83, (byte) 0xcb, (byte) 0x74, (byte) 0x64,  -    (byte) 0x17, (byte) 0x4c, (byte) 0x33, (byte) 0xbb, (byte) 0x88, (byte) 0xc2, (byte) 0xdd, (byte) 0x08,  -    (byte) 0x69, (byte) 0xd8, (byte) 0xa2, (byte) 0xac, (byte) 0x95, (byte) 0x71, (byte) 0xd3, (byte) 0xf8,  -    (byte) 0xc9, (byte) 0xd1, (byte) 0xd6, (byte) 0x0e, (byte) 0xc3, (byte) 0x67, (byte) 0xa1, (byte) 0xdb,  -    (byte) 0xca, (byte) 0x58, (byte) 0xaa, (byte) 0x4b, (byte) 0xec, (byte) 0x37, (byte) 0x46, (byte) 0x73,  -    (byte) 0xc3, (byte) 0xa3, (byte) 0x7b, (byte) 0x1e, (byte) 0xdd, (byte) 0xf9, (byte) 0xb3, (byte) 0xbb,  -    (byte) 0xe0, (byte) 0x16, (byte) 0x39, (byte) 0xaf, (byte) 0xa0, (byte) 0x19, (byte) 0x9e, (byte) 0x89,  -    (byte) 0x37, (byte) 0x1e, (byte) 0x6e, (byte) 0x41, (byte) 0x59, (byte) 0xe1, (byte) 0x86, (byte) 0xea,  -    (byte) 0x0b, (byte) 0x39, (byte) 0x03, (byte) 0x89, (byte) 0xd2, (byte) 0xba, (byte) 0xd5, (byte) 0x0c,  -    (byte) 0x84, (byte) 0x09, (byte) 0xdd, (byte) 0xc7, (byte) 0x00, (byte) 0x2c, (byte) 0x2e, (byte) 0x1a,  -    (byte) 0x69, (byte) 0xeb, (byte) 0xdf, (byte) 0xb1 -  }; -   - -  protected byte[] EF_C_X509_CH_AUT = new byte[2000]; +  private static byte[] SE_DECIPHER = new byte[] { +    (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x03, (byte) 0x00, +    (byte) 0x80, (byte) 0x01, (byte) 0x81}; +  private RSAPrivateKey privateKey; +      protected byte[] dst; +   +  protected byte[] ct; -  public static final byte[] DST = new byte[] { (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x02, (byte) 0x00, (byte) 0x89, (byte) 0x03, (byte) 0x13, (byte) 0x35, (byte) 0x10}; -  public static final byte[] DST_G3 = new byte[] { (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x02, (byte) 0x00, (byte) 0x80, (byte) 0x01, (byte) 0x04 }; - -  public STARCOSApplGewoehnlicheSignatur(STARCOSCardChannelEmul channel, byte[] dst) { -    super(channel); -    // Files -    System.arraycopy(C_X509_CH_AUT, 0, EF_C_X509_CH_AUT, 0, C_X509_CH_AUT.length); -    putFile(new File(FID_EF_C_X509_CH_AUT, EF_C_X509_CH_AUT, FCI_EF_C_X509_CH_AUT)); -    this.dst = dst; -  } - -  @Override -  public byte[] getAID() { -    return AID_GewoehnlicheSignatur; -  } - -  @Override -  public byte[] getFID() { -    return FID_GewoehnlicheSignatur; +  public void setPrivateKey(RSAPrivateKey privateKey) { +    this.privateKey = privateKey;    } -  @Override -  public byte[] getFCI() { -    return FCI; +  public void setDst(byte[] dst) { +    this.dst = dst;    } -  public void clearCert() { -    Arrays.fill(EF_C_X509_CH_AUT, (byte) 0x00); +  public void setCt(byte[] ct) { +    this.ct = ct;    }    @Override @@ -271,9 +92,15 @@ public class STARCOSApplGewoehnlicheSignatur extends STARCOSAppl {      case 0xB8:        switch (command.getP1()) {        case 0x41: -        // PSO � DECIPHER +        // PSO - DECIPHER +        if (Arrays.equals(ct, command.getData())) { +          securityEnv = command.getData(); +          return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +        } else { +          return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +        }        case 0x81: -        // PSO � ENCIPHER +        // PSO - ENCIPHER        }      default:        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); @@ -333,6 +160,44 @@ public class STARCOSApplGewoehnlicheSignatur extends STARCOSAppl {        hash = null;        return new ResponseAPDU(response); +     +    } else if (command.getP1() == 0x80 && command.getP2() == 0x86) { +       +      // DECIPHER +      if (!Arrays.equals(securityEnv, SE_DECIPHER)) { +        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x05}); +      } + +      byte[] data = command.getData(); +       +      if (data.length != 193) { +        return new ResponseAPDU(new byte[] {(byte) 0x67, (byte) 0x00}); +      } + +      if (((STARCOSCardChannelEmul) channel).globalPins +          .get(STARCOSCardChannelEmul.KID_PIN_Glob).state != PIN.STATE_PIN_VERIFIED) { +        // Security Status not satisfied +        return new ResponseAPDU(new byte[] {(byte) 0x69, (byte) 0x82}); +      } + +      byte[] cipherText = Arrays.copyOfRange(data, 1, data.length); +       +      byte[] plainText; +      try { +        Cipher cipher = Cipher.getInstance("RSA"); +        cipher.init(Cipher.DECRYPT_MODE, privateKey); +        plainText = cipher.doFinal(cipherText); +      } catch (GeneralSecurityException e) { +        throw new CardException(e); +      } +       +      byte[] response = new byte[plainText.length + 2]; +      System.arraycopy(plainText, 0, response, 0, plainText.length); +      response[plainText.length] = (byte) 0x90; +      response[plainText.length + 1] = (byte) 0x00; +       +      return new ResponseAPDU(response); +            } else {        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x00}); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplInfobox.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplInfobox.java index c470351a..9ac2cdb5 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplInfobox.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplInfobox.java @@ -16,132 +16,15 @@  */  package at.gv.egiz.smcc.starcos; -import java.util.Arrays; -  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File; -@SuppressWarnings("restriction")  public class STARCOSApplInfobox extends STARCOSAppl { -  public static final byte[] IDLINK = new byte[] { -    (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x11, (byte) 0x02, (byte) 0x01, (byte) 0x01, (byte) 0x0c,  -    (byte) 0x26, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -    (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x7a,  -    (byte) 0x6d, (byte) 0x72, (byte) 0x2f, (byte) 0x70, (byte) 0x65, (byte) 0x72, (byte) 0x73, (byte) 0x62,  -    (byte) 0x32, (byte) 0x30, (byte) 0x34, (byte) 0x2e, (byte) 0x78, (byte) 0x73, (byte) 0x6c, (byte) 0x0c,  -    (byte) 0x29, (byte) 0x73, (byte) 0x7a, (byte) 0x72, (byte) 0x2e, (byte) 0x62, (byte) 0x6d, (byte) 0x69,  -    (byte) 0x2e, (byte) 0x67, (byte) 0x76, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2d, (byte) 0x41,  -    (byte) 0x73, (byte) 0x73, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e,  -    (byte) 0x49, (byte) 0x44, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x36, (byte) 0x33, (byte) 0x35,  -    (byte) 0x36, (byte) 0x33, (byte) 0x36, (byte) 0x36, (byte) 0x37, (byte) 0x39, (byte) 0x39, (byte) 0x39,  -    (byte) 0x31, (byte) 0x39, (byte) 0x0c, (byte) 0x19, (byte) 0x32, (byte) 0x30, (byte) 0x30, (byte) 0x39,  -    (byte) 0x2d, (byte) 0x30, (byte) 0x33, (byte) 0x2d, (byte) 0x30, (byte) 0x36, (byte) 0x54, (byte) 0x31,  -    (byte) 0x36, (byte) 0x3a, (byte) 0x31, (byte) 0x39, (byte) 0x3a, (byte) 0x32, (byte) 0x36, (byte) 0x2b,  -    (byte) 0x30, (byte) 0x31, (byte) 0x3a, (byte) 0x30, (byte) 0x30, (byte) 0xa0, (byte) 0x42, (byte) 0x30,  -    (byte) 0x40, (byte) 0x0c, (byte) 0x18, (byte) 0x45, (byte) 0x68, (byte) 0x42, (byte) 0x53, (byte) 0x36,  -    (byte) 0x54, (byte) 0x6f, (byte) 0x31, (byte) 0x49, (byte) 0x6c, (byte) 0x54, (byte) 0x4b, (byte) 0x4f,  -    (byte) 0x4a, (byte) 0x45, (byte) 0x39, (byte) 0x75, (byte) 0x62, (byte) 0x74, (byte) 0x48, (byte) 0x69,  -    (byte) 0x51, (byte) 0x3d, (byte) 0x3d, (byte) 0x0c, (byte) 0x0a, (byte) 0x58, (byte) 0x58, (byte) 0x58,  -    (byte) 0xc5, (byte) 0x90, (byte) 0x7a, (byte) 0x67, (byte) 0xc3, (byte) 0xbc, (byte) 0x72, (byte) 0x0c,  -    (byte) 0x0c, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x54, (byte) 0xc3, (byte) 0xbc, (byte) 0x7a,  -    (byte) 0x65, (byte) 0x6b, (byte) 0xc3, (byte) 0xa7, (byte) 0x69, (byte) 0x0c, (byte) 0x0a, (byte) 0x31,  -    (byte) 0x39, (byte) 0x37, (byte) 0x33, (byte) 0x2d, (byte) 0x30, (byte) 0x36, (byte) 0x2d, (byte) 0x30,  -    (byte) 0x34, (byte) 0x30, (byte) 0x0a, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x00,  -    (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x01, (byte) 0x03, (byte) 0x82, (byte) 0x01,  -    (byte) 0x01, (byte) 0x00, (byte) 0x9f, (byte) 0xa5, (byte) 0x68, (byte) 0xa9, (byte) 0x14, (byte) 0x4c,  -    (byte) 0xa4, (byte) 0x5d, (byte) 0x9d, (byte) 0x09, (byte) 0x99, (byte) 0x2e, (byte) 0xe7, (byte) 0x45,  -    (byte) 0x2e, (byte) 0x42, (byte) 0x49, (byte) 0x02, (byte) 0x16, (byte) 0xd9, (byte) 0xcb, (byte) 0x90,  -    (byte) 0x43, (byte) 0x27, (byte) 0x03, (byte) 0x43, (byte) 0x6d, (byte) 0xb4, (byte) 0x8c, (byte) 0xdc,  -    (byte) 0x1c, (byte) 0x77, (byte) 0xd4, (byte) 0x2e, (byte) 0xa1, (byte) 0x40, (byte) 0xe7, (byte) 0xe0,  -    (byte) 0x03, (byte) 0x60, (byte) 0x15, (byte) 0xf7, (byte) 0xdb, (byte) 0x03, (byte) 0x5e, (byte) 0xca,  -    (byte) 0xe4, (byte) 0x35, (byte) 0xba, (byte) 0x2b, (byte) 0xfd, (byte) 0xe6, (byte) 0xb8, (byte) 0xd8,  -    (byte) 0xb7, (byte) 0x2a, (byte) 0x80, (byte) 0xdd, (byte) 0x38, (byte) 0xe0, (byte) 0x8a, (byte) 0x69,  -    (byte) 0xad, (byte) 0x67, (byte) 0x60, (byte) 0x65, (byte) 0x42, (byte) 0xc9, (byte) 0x41, (byte) 0x60,  -    (byte) 0x94, (byte) 0xde, (byte) 0x84, (byte) 0x54, (byte) 0xad, (byte) 0xb3, (byte) 0xf4, (byte) 0xf7,  -    (byte) 0x44, (byte) 0xd5, (byte) 0xf3, (byte) 0xd3, (byte) 0xb6, (byte) 0x87, (byte) 0x8a, (byte) 0x22,  -    (byte) 0x38, (byte) 0x00, (byte) 0xcb, (byte) 0xa4, (byte) 0x4f, (byte) 0x96, (byte) 0xc2, (byte) 0x28,  -    (byte) 0xc2, (byte) 0x8d, (byte) 0x91, (byte) 0x95, (byte) 0xb4, (byte) 0xea, (byte) 0x00, (byte) 0x59,  -    (byte) 0x2e, (byte) 0xec, (byte) 0x78, (byte) 0xd8, (byte) 0x0f, (byte) 0x26, (byte) 0x04, (byte) 0xee,  -    (byte) 0xed, (byte) 0x13, (byte) 0xbf, (byte) 0x81, (byte) 0x68, (byte) 0x81, (byte) 0x43, (byte) 0xbe,  -    (byte) 0x15, (byte) 0x0e, (byte) 0xba, (byte) 0xf9, (byte) 0x6a, (byte) 0x18, (byte) 0xeb, (byte) 0x95,  -    (byte) 0xad, (byte) 0xb4, (byte) 0x0f, (byte) 0x3c, (byte) 0x94, (byte) 0x63, (byte) 0x32, (byte) 0x81,  -    (byte) 0x90, (byte) 0xcf, (byte) 0x3f, (byte) 0x95, (byte) 0xff, (byte) 0x8d, (byte) 0x86, (byte) 0xed,  -    (byte) 0xe4, (byte) 0x75, (byte) 0xd5, (byte) 0x09, (byte) 0x32, (byte) 0x17, (byte) 0x38, (byte) 0xb2,  -    (byte) 0x68, (byte) 0x35, (byte) 0x49, (byte) 0x8c, (byte) 0xa6, (byte) 0xd0, (byte) 0x3e, (byte) 0xde,  -    (byte) 0x6e, (byte) 0x47, (byte) 0x68, (byte) 0xbf, (byte) 0x98, (byte) 0x33, (byte) 0xae, (byte) 0x59,  -    (byte) 0x9f, (byte) 0xe0, (byte) 0x19, (byte) 0x9b, (byte) 0x5b, (byte) 0x1b, (byte) 0x8f, (byte) 0x74,  -    (byte) 0xd2, (byte) 0x9c, (byte) 0x01, (byte) 0x1a, (byte) 0xdf, (byte) 0xaf, (byte) 0xf8, (byte) 0x96,  -    (byte) 0x91, (byte) 0xcb, (byte) 0xf8, (byte) 0xbf, (byte) 0x06, (byte) 0xc7, (byte) 0xd5, (byte) 0x17,  -    (byte) 0x95, (byte) 0xef, (byte) 0xc5, (byte) 0x97, (byte) 0x37, (byte) 0x1b, (byte) 0xb0, (byte) 0xa1,  -    (byte) 0x4f, (byte) 0x9f, (byte) 0x01, (byte) 0x82, (byte) 0x90, (byte) 0x4a, (byte) 0x6a, (byte) 0x04,  -    (byte) 0xdb, (byte) 0x31, (byte) 0x1a, (byte) 0x58, (byte) 0xeb, (byte) 0xcd, (byte) 0x68, (byte) 0xe3,  -    (byte) 0x68, (byte) 0x0b, (byte) 0xa0, (byte) 0x11, (byte) 0x44, (byte) 0x08, (byte) 0xa0, (byte) 0x5c,  -    (byte) 0xfc, (byte) 0x61, (byte) 0x15, (byte) 0x1f, (byte) 0xbb, (byte) 0x22, (byte) 0x87, (byte) 0x18,  -    (byte) 0xa3, (byte) 0x07, (byte) 0x9b, (byte) 0x0d, (byte) 0x13, (byte) 0x7c, (byte) 0xff, (byte) 0x30,  -    (byte) 0xcf, (byte) 0xf3, (byte) 0xaf, (byte) 0xe4, (byte) 0x45, (byte) 0x05, (byte) 0xa0, (byte) 0x8e,  -    (byte) 0x6b, (byte) 0xef, (byte) 0x70, (byte) 0xf5, (byte) 0x4b, (byte) 0x68, (byte) 0x8f, (byte) 0x61,  -    (byte) 0xd6, (byte) 0xf5, (byte) 0xa0, (byte) 0x17, (byte) 0x03, (byte) 0x15, (byte) 0x00, (byte) 0x8e,  -    (byte) 0xa8, (byte) 0xdf, (byte) 0xa9, (byte) 0x77, (byte) 0xfd, (byte) 0x9b, (byte) 0x4b, (byte) 0x91,  -    (byte) 0x89, (byte) 0x34, (byte) 0x84, (byte) 0xf3, (byte) 0x24, (byte) 0xb2, (byte) 0x5a, (byte) 0x39,  -    (byte) 0xa9, (byte) 0xf2, (byte) 0x17, (byte) 0xa1, (byte) 0x17, (byte) 0x03, (byte) 0x15, (byte) 0x00,  -    (byte) 0xdb, (byte) 0xa2, (byte) 0xfd, (byte) 0xa4, (byte) 0xe7, (byte) 0x65, (byte) 0x2e, (byte) 0x7e,  -    (byte) 0xb0, (byte) 0xc8, (byte) 0xfa, (byte) 0x4d, (byte) 0x13, (byte) 0x28, (byte) 0xdf, (byte) 0xb1,  -    (byte) 0x58, (byte) 0x3b, (byte) 0x9e, (byte) 0x29, (byte) 0xa2, (byte) 0x17, (byte) 0x03, (byte) 0x15,  -    (byte) 0x00, (byte) 0x68, (byte) 0xa0, (byte) 0x17, (byte) 0x18, (byte) 0xb7, (byte) 0xb3, (byte) 0xc3,  -    (byte) 0x60, (byte) 0x77, (byte) 0x82, (byte) 0x8d, (byte) 0xf1, (byte) 0x5e, (byte) 0x10, (byte) 0xc3,  -    (byte) 0x2d, (byte) 0x78, (byte) 0x2c, (byte) 0x11, (byte) 0x0b -  }; -   -  private static byte[] FCP = new byte[] { (byte) 0x6f, (byte) 0x14, -      (byte) 0x84, (byte) 0x08, (byte) 0xd0, (byte) 0x40, (byte) 0x00, -      (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x18, (byte) 0x01, -      (byte) 0xa5, (byte) 0x08, (byte) 0x53, (byte) 0x02, (byte) 0x01, -      (byte) 0x11, (byte) 0x54, (byte) 0x02, (byte) 0x01, (byte) 0x00 }; -   -  protected static byte[] FID_EF_IdentityLink = new byte[] { (byte) 0xef, (byte) 0x01 }; -   -  protected static byte[] FCP_EF_IdentityLink = new byte[] { (byte) 0x62, -      (byte) 0x16, (byte) 0x80, (byte) 0x02, (byte) 0x04, (byte) 0x00, -      (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x83, (byte) 0x02, -      (byte) 0xef, (byte) 0x01, (byte) 0x88, (byte) 0x01, (byte) 0x08, -      (byte) 0x8a, (byte) 0x01, (byte) 0x05, (byte) 0xa1, (byte) 0x03, -      (byte) 0x8b, (byte) 0x01, (byte) 0x02 }; -   -  protected static byte[] EF_IdentityLink = new byte[1500]; - -  public STARCOSApplInfobox(STARCOSCardChannelEmul channel) { -    super(channel); -    System.arraycopy(IDLINK, 0, EF_IdentityLink, 0, IDLINK.length); -    putFile(new File(FID_EF_IdentityLink, EF_IdentityLink, FCP_EF_IdentityLink, 0x01)); -  } - -  @Override -  public byte[] getAID() { -    return AID_Infobox; -  } - -  @Override -  public byte[] getFID() { -    return FID_Infobox; -  } - -  @Override -  public byte[] getFCI() { -    return FCP; -  } - -  public void clearInfobox() { -    Arrays.fill(EF_IdentityLink, (byte) 0x00); -  } -   -  public void setInfoboxHeader(byte b) { -    EF_IdentityLink[0] = b; +  public STARCOSApplInfobox() {    }    @Override diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplSichereSignatur.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplSichereSignatur.java deleted file mode 100644 index 4036ca41..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSApplSichereSignatur.java +++ /dev/null @@ -1,375 +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.starcos; - -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.Random; - -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.File; -import at.gv.egiz.smcc.PIN; - -@SuppressWarnings("restriction") -public class STARCOSApplSichereSignatur extends STARCOSAppl { - -  private static byte[] FCI = new byte[] { (byte) 0x6f, (byte) 0x16, -      (byte) 0x84, (byte) 0x08, (byte) 0xd0, (byte) 0x40, (byte) 0x00, -      (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01, -      (byte) 0xa5, (byte) 0x0a, (byte) 0x53, (byte) 0x02, (byte) 0x01, -      (byte) 0x10, (byte) 0x54, (byte) 0x04, (byte) 0x01, (byte) 0x00, -      (byte) 0x03, (byte) 0x00 }; -   -  protected static byte[] FID_EF_C_X509_CH_DS = new byte[] { (byte) 0xc0, -      (byte) 0x00 }; -   -  protected static byte[] FCI_EF_C_X509_CH_DS = new byte[] { (byte) 0x62, -      (byte) 0x16, (byte) 0x80, (byte) 0x02, (byte) 0x04, (byte) 0xef, -      (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x83, (byte) 0x02, -      (byte) 0xc0, (byte) 0x00, (byte) 0x88, (byte) 0x01, (byte) 0x08, -      (byte) 0x8a, (byte) 0x01, (byte) 0x05, (byte) 0xa1, (byte) 0x03, -      (byte) 0x8b, (byte) 0x01, (byte) 0x0e }; -   -  protected static byte[] C_X509_CH_DS = new byte[] { -    (byte) 0x30, (byte) 0x82, (byte) 0x04, (byte) 0xeb, (byte) 0x30, (byte) 0x82, (byte) 0x03, (byte) 0xd3,  -    (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x03, (byte) 0x02,  -    (byte) 0x06, (byte) 0x5e, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,  -    (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05,  -    (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0xa1, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09,  -    (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41,  -    (byte) 0x54, (byte) 0x31, (byte) 0x48, (byte) 0x30, (byte) 0x46, (byte) 0x06, (byte) 0x03, (byte) 0x55,  -    (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x3f, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x47, (byte) 0x65, (byte) 0x73, (byte) 0x2e,  -    (byte) 0x20, (byte) 0x66, (byte) 0x2e, (byte) 0x20, (byte) 0x53, (byte) 0x69, (byte) 0x63, (byte) 0x68,  -    (byte) 0x65, (byte) 0x72, (byte) 0x68, (byte) 0x65, (byte) 0x69, (byte) 0x74, (byte) 0x73, (byte) 0x73,  -    (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x65, (byte) 0x20, (byte) 0x69,  -    (byte) 0x6d, (byte) 0x20, (byte) 0x65, (byte) 0x6c, (byte) 0x65, (byte) 0x6b, (byte) 0x74, (byte) 0x72,  -    (byte) 0x2e, (byte) 0x20, (byte) 0x44, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x6e, (byte) 0x76,  -    (byte) 0x65, (byte) 0x72, (byte) 0x6b, (byte) 0x65, (byte) 0x68, (byte) 0x72, (byte) 0x20, (byte) 0x47,  -    (byte) 0x6d, (byte) 0x62, (byte) 0x48, (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0b, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d,  -    (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65,  -    (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73,  -    (byte) 0x74, (byte) 0x2d, (byte) 0x53, (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30, (byte) 0x32,  -    (byte) 0x31, (byte) 0x23, (byte) 0x30, (byte) 0x21, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,  -    (byte) 0x03, (byte) 0x0c, (byte) 0x1a, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67,  -    (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75,  -    (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53,  -    (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x30, (byte) 0x1e, (byte) 0x17,  -    (byte) 0x0d, (byte) 0x30, (byte) 0x39, (byte) 0x30, (byte) 0x33, (byte) 0x30, (byte) 0x36, (byte) 0x31,  -    (byte) 0x35, (byte) 0x32, (byte) 0x32, (byte) 0x33, (byte) 0x37, (byte) 0x5a, (byte) 0x17, (byte) 0x0d,  -    (byte) 0x31, (byte) 0x32, (byte) 0x30, (byte) 0x33, (byte) 0x30, (byte) 0x36, (byte) 0x31, (byte) 0x35,  -    (byte) 0x32, (byte) 0x32, (byte) 0x33, (byte) 0x37, (byte) 0x5a, (byte) 0x30, (byte) 0x72, (byte) 0x31,  -    (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06,  -    (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x54, (byte) 0x31, (byte) 0x20, (byte) 0x30, (byte) 0x1e,  -    (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c, (byte) 0x17, (byte) 0x58,  -    (byte) 0x58, (byte) 0x58, (byte) 0xc5, (byte) 0x90, (byte) 0x7a, (byte) 0x67, (byte) 0xc3, (byte) 0xbc,  -    (byte) 0x72, (byte) 0x20, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x54, (byte) 0xc3, (byte) 0xbc,  -    (byte) 0x7a, (byte) 0x65, (byte) 0x6b, (byte) 0xc3, (byte) 0xa7, (byte) 0x69, (byte) 0x31, (byte) 0x15,  -    (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x04, (byte) 0x0c,  -    (byte) 0x0c, (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0x54, (byte) 0xc3, (byte) 0xbc, (byte) 0x7a,  -    (byte) 0x65, (byte) 0x6b, (byte) 0xc3, (byte) 0xa7, (byte) 0x69, (byte) 0x31, (byte) 0x13, (byte) 0x30,  -    (byte) 0x11, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x2a, (byte) 0x0c, (byte) 0x0a,  -    (byte) 0x58, (byte) 0x58, (byte) 0x58, (byte) 0xc5, (byte) 0x90, (byte) 0x7a, (byte) 0x67, (byte) 0xc3,  -    (byte) 0xbc, (byte) 0x72, (byte) 0x31, (byte) 0x15, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03,  -    (byte) 0x55, (byte) 0x04, (byte) 0x05, (byte) 0x13, (byte) 0x0c, (byte) 0x37, (byte) 0x30, (byte) 0x34,  -    (byte) 0x38, (byte) 0x37, (byte) 0x31, (byte) 0x30, (byte) 0x35, (byte) 0x30, (byte) 0x30, (byte) 0x30,  -    (byte) 0x38, (byte) 0x30, (byte) 0x49, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x07, (byte) 0x2a,  -    (byte) 0x86, (byte) 0x48, (byte) 0xce, (byte) 0x3d, (byte) 0x02, (byte) 0x01, (byte) 0x06, (byte) 0x08,  -    (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0xce, (byte) 0x3d, (byte) 0x03, (byte) 0x01, (byte) 0x01,  -    (byte) 0x03, (byte) 0x32, (byte) 0x00, (byte) 0x04, (byte) 0xde, (byte) 0x75, (byte) 0x22, (byte) 0x4c,  -    (byte) 0xc4, (byte) 0xd4, (byte) 0x14, (byte) 0x16, (byte) 0x48, (byte) 0x4a, (byte) 0x65, (byte) 0x9d,  -    (byte) 0x5a, (byte) 0x39, (byte) 0x71, (byte) 0x11, (byte) 0x1c, (byte) 0x33, (byte) 0x7e, (byte) 0x7f,  -    (byte) 0xb4, (byte) 0x06, (byte) 0x33, (byte) 0x74, (byte) 0xe6, (byte) 0xf3, (byte) 0xc2, (byte) 0x56,  -    (byte) 0x46, (byte) 0x18, (byte) 0x39, (byte) 0xb9, (byte) 0xc4, (byte) 0x47, (byte) 0x84, (byte) 0xf5,  -    (byte) 0x46, (byte) 0x41, (byte) 0x60, (byte) 0x78, (byte) 0x81, (byte) 0x45, (byte) 0x4a, (byte) 0x0f,  -    (byte) 0x67, (byte) 0x77, (byte) 0x77, (byte) 0xb2, (byte) 0xa3, (byte) 0x82, (byte) 0x02, (byte) 0x33,  -    (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x2f, (byte) 0x30, (byte) 0x13, (byte) 0x06, (byte) 0x03,  -    (byte) 0x55, (byte) 0x1d, (byte) 0x23, (byte) 0x04, (byte) 0x0c, (byte) 0x30, (byte) 0x0a, (byte) 0x80,  -    (byte) 0x08, (byte) 0x46, (byte) 0x06, (byte) 0x9f, (byte) 0x8e, (byte) 0x41, (byte) 0x8e, (byte) 0x15,  -    (byte) 0xbd, (byte) 0x30, (byte) 0x27, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01,  -    (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0xff,  -    (byte) 0x04, (byte) 0x18, (byte) 0x30, (byte) 0x16, (byte) 0x30, (byte) 0x08, (byte) 0x06, (byte) 0x06,  -    (byte) 0x04, (byte) 0x00, (byte) 0x8e, (byte) 0x46, (byte) 0x01, (byte) 0x01, (byte) 0x30, (byte) 0x0a,  -    (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07,  -    (byte) 0x0b, (byte) 0x01, (byte) 0x30, (byte) 0x81, (byte) 0x84, (byte) 0x06, (byte) 0x08, (byte) 0x2b,  -    (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x01, (byte) 0x01, (byte) 0x04,  -    (byte) 0x78, (byte) 0x30, (byte) 0x76, (byte) 0x30, (byte) 0x2c, (byte) 0x06, (byte) 0x08, (byte) 0x2b,  -    (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30, (byte) 0x01, (byte) 0x86,  -    (byte) 0x20, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -    (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x70, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73,  -    (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73,  -    (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f, (byte) 0x63, (byte) 0x73,  -    (byte) 0x70, (byte) 0x30, (byte) 0x46, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06, (byte) 0x01,  -    (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x30, (byte) 0x02, (byte) 0x86, (byte) 0x3a, (byte) 0x68,  -    (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x77, (byte) 0x77,  -    (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73,  -    (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x63, (byte) 0x65, (byte) 0x72,  -    (byte) 0x74, (byte) 0x73, (byte) 0x2f, (byte) 0x61, (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67,  -    (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72, (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75,  -    (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53,  -    (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30, (byte) 0x32, (byte) 0x2e, (byte) 0x63, (byte) 0x72,  -    (byte) 0x74, (byte) 0x30, (byte) 0x81, (byte) 0x92, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,  -    (byte) 0x20, (byte) 0x04, (byte) 0x81, (byte) 0x8a, (byte) 0x30, (byte) 0x81, (byte) 0x87, (byte) 0x30,  -    (byte) 0x7b, (byte) 0x06, (byte) 0x06, (byte) 0x2a, (byte) 0x28, (byte) 0x00, (byte) 0x11, (byte) 0x01,  -    (byte) 0x03, (byte) 0x30, (byte) 0x71, (byte) 0x30, (byte) 0x35, (byte) 0x06, (byte) 0x08, (byte) 0x2b,  -    (byte) 0x06, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x01, (byte) 0x16,  -    (byte) 0x29, (byte) 0x68, (byte) 0x74, (byte) 0x74, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f,  -    (byte) 0x77, (byte) 0x77, (byte) 0x77, (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x64,  -    (byte) 0x6f, (byte) 0x63, (byte) 0x73, (byte) 0x2f, (byte) 0x63, (byte) 0x70, (byte) 0x2f, (byte) 0x61,  -    (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x74, (byte) 0x65,  -    (byte) 0x73, (byte) 0x74, (byte) 0x30, (byte) 0x38, (byte) 0x06, (byte) 0x08, (byte) 0x2b, (byte) 0x06,  -    (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x07, (byte) 0x02, (byte) 0x02, (byte) 0x30, (byte) 0x2c,  -    (byte) 0x1a, (byte) 0x2a, (byte) 0x44, (byte) 0x69, (byte) 0x65, (byte) 0x73, (byte) 0x65, (byte) 0x73,  -    (byte) 0x20, (byte) 0x5a, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69,  -    (byte) 0x6b, (byte) 0x61, (byte) 0x74, (byte) 0x20, (byte) 0x64, (byte) 0x69, (byte) 0x65, (byte) 0x6e,  -    (byte) 0x74, (byte) 0x20, (byte) 0x6e, (byte) 0x75, (byte) 0x72, (byte) 0x20, (byte) 0x7a, (byte) 0x75,  -    (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x7a, (byte) 0x77, (byte) 0x65,  -    (byte) 0x63, (byte) 0x6b, (byte) 0x65, (byte) 0x6e, (byte) 0x30, (byte) 0x08, (byte) 0x06, (byte) 0x06,  -    (byte) 0x04, (byte) 0x00, (byte) 0x8b, (byte) 0x30, (byte) 0x01, (byte) 0x01, (byte) 0x30, (byte) 0x81,  -    (byte) 0xa4, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x1f, (byte) 0x04, (byte) 0x81,  -    (byte) 0x9c, (byte) 0x30, (byte) 0x81, (byte) 0x99, (byte) 0x30, (byte) 0x81, (byte) 0x96, (byte) 0xa0,  -    (byte) 0x81, (byte) 0x93, (byte) 0xa0, (byte) 0x81, (byte) 0x90, (byte) 0x86, (byte) 0x81, (byte) 0x8d,  -    (byte) 0x6c, (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x3a, (byte) 0x2f, (byte) 0x2f, (byte) 0x6c,  -    (byte) 0x64, (byte) 0x61, (byte) 0x70, (byte) 0x2d, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74,  -    (byte) 0x2e, (byte) 0x61, (byte) 0x2d, (byte) 0x74, (byte) 0x72, (byte) 0x75, (byte) 0x73, (byte) 0x74,  -    (byte) 0x2e, (byte) 0x61, (byte) 0x74, (byte) 0x2f, (byte) 0x6f, (byte) 0x75, (byte) 0x3d, (byte) 0x61,  -    (byte) 0x2d, (byte) 0x73, (byte) 0x69, (byte) 0x67, (byte) 0x6e, (byte) 0x2d, (byte) 0x50, (byte) 0x72,  -    (byte) 0x65, (byte) 0x6d, (byte) 0x69, (byte) 0x75, (byte) 0x6d, (byte) 0x2d, (byte) 0x54, (byte) 0x65,  -    (byte) 0x73, (byte) 0x74, (byte) 0x2d, (byte) 0x53, (byte) 0x69, (byte) 0x67, (byte) 0x2d, (byte) 0x30,  -    (byte) 0x32, (byte) 0x2c, (byte) 0x6f, (byte) 0x3d, (byte) 0x41, (byte) 0x2d, (byte) 0x54, (byte) 0x72,  -    (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x2c, (byte) 0x63, (byte) 0x3d, (byte) 0x41, (byte) 0x54,  -    (byte) 0x3f, (byte) 0x63, (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69,  -    (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x65, (byte) 0x76, (byte) 0x6f,  -    (byte) 0x63, (byte) 0x61, (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x6c, (byte) 0x69,  -    (byte) 0x73, (byte) 0x74, (byte) 0x3f, (byte) 0x62, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x3f,  -    (byte) 0x6f, (byte) 0x62, (byte) 0x6a, (byte) 0x65, (byte) 0x63, (byte) 0x74, (byte) 0x63, (byte) 0x6c,  -    (byte) 0x61, (byte) 0x73, (byte) 0x73, (byte) 0x3d, (byte) 0x65, (byte) 0x69, (byte) 0x64, (byte) 0x43,  -    (byte) 0x65, (byte) 0x72, (byte) 0x74, (byte) 0x69, (byte) 0x66, (byte) 0x69, (byte) 0x63, (byte) 0x61,  -    (byte) 0x74, (byte) 0x69, (byte) 0x6f, (byte) 0x6e, (byte) 0x41, (byte) 0x75, (byte) 0x74, (byte) 0x68,  -    (byte) 0x6f, (byte) 0x72, (byte) 0x69, (byte) 0x74, (byte) 0x79, (byte) 0x30, (byte) 0x11, (byte) 0x06,  -    (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e, (byte) 0x04, (byte) 0x0a, (byte) 0x04, (byte) 0x08,  -    (byte) 0x47, (byte) 0x64, (byte) 0x6e, (byte) 0xbb, (byte) 0x92, (byte) 0xa0, (byte) 0xf6, (byte) 0xf4,  -    (byte) 0x30, (byte) 0x0e, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0f, (byte) 0x01,  -    (byte) 0x01, (byte) 0xff, (byte) 0x04, (byte) 0x04, (byte) 0x03, (byte) 0x02, (byte) 0x06, (byte) 0xc0,  -    (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04,  -    (byte) 0x02, (byte) 0x30, (byte) 0x00, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a,  -    (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05,  -    (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x82, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x06,  -    (byte) 0x63, (byte) 0x76, (byte) 0x0a, (byte) 0xd5, (byte) 0x54, (byte) 0xfa, (byte) 0x51, (byte) 0x2a,  -    (byte) 0xb0, (byte) 0x41, (byte) 0xdc, (byte) 0xa4, (byte) 0x9b, (byte) 0x52, (byte) 0x1c, (byte) 0x0e,  -    (byte) 0x1d, (byte) 0x65, (byte) 0x46, (byte) 0x2b, (byte) 0xa3, (byte) 0xcd, (byte) 0xd4, (byte) 0x46,  -    (byte) 0x36, (byte) 0x40, (byte) 0xc3, (byte) 0x49, (byte) 0xe8, (byte) 0xa4, (byte) 0xdc, (byte) 0x01,  -    (byte) 0xde, (byte) 0x70, (byte) 0x97, (byte) 0x31, (byte) 0xb0, (byte) 0xcd, (byte) 0xdf, (byte) 0x69,  -    (byte) 0xf8, (byte) 0xc3, (byte) 0x83, (byte) 0xee, (byte) 0xc6, (byte) 0xed, (byte) 0xe3, (byte) 0x18,  -    (byte) 0x1a, (byte) 0x80, (byte) 0xc1, (byte) 0x30, (byte) 0xa9, (byte) 0xd6, (byte) 0xb1, (byte) 0xb8,  -    (byte) 0xa8, (byte) 0xe0, (byte) 0x3d, (byte) 0xb1, (byte) 0x8e, (byte) 0x2c, (byte) 0xc9, (byte) 0xa6,  -    (byte) 0x05, (byte) 0x6e, (byte) 0x4a, (byte) 0xd2, (byte) 0xb2, (byte) 0x03, (byte) 0xa4, (byte) 0x2b,  -    (byte) 0xa2, (byte) 0xad, (byte) 0xad, (byte) 0xe5, (byte) 0xba, (byte) 0x0d, (byte) 0x54, (byte) 0x8d,  -    (byte) 0x92, (byte) 0x51, (byte) 0xda, (byte) 0x58, (byte) 0xed, (byte) 0xd3, (byte) 0x8d, (byte) 0x61,  -    (byte) 0xa1, (byte) 0xfc, (byte) 0x49, (byte) 0xf6, (byte) 0x80, (byte) 0xdb, (byte) 0x65, (byte) 0x92,  -    (byte) 0xe0, (byte) 0xd5, (byte) 0x23, (byte) 0x69, (byte) 0x0f, (byte) 0x38, (byte) 0x11, (byte) 0x61,  -    (byte) 0x1e, (byte) 0xcd, (byte) 0xa2, (byte) 0x8e, (byte) 0x68, (byte) 0xec, (byte) 0x70, (byte) 0xfb,  -    (byte) 0x55, (byte) 0x95, (byte) 0xcb, (byte) 0xb4, (byte) 0x18, (byte) 0x6b, (byte) 0x3a, (byte) 0x25,  -    (byte) 0x4a, (byte) 0x3e, (byte) 0x07, (byte) 0xb0, (byte) 0x18, (byte) 0x26, (byte) 0x51, (byte) 0x39,  -    (byte) 0x46, (byte) 0xfa, (byte) 0xe2, (byte) 0xae, (byte) 0xe6, (byte) 0x1c, (byte) 0xd2, (byte) 0xcb,  -    (byte) 0x28, (byte) 0xa1, (byte) 0x8b, (byte) 0x56, (byte) 0xbb, (byte) 0xe9, (byte) 0x6c, (byte) 0xf7,  -    (byte) 0x0b, (byte) 0x84, (byte) 0xdd, (byte) 0x7f, (byte) 0x64, (byte) 0x8b, (byte) 0x43, (byte) 0x93,  -    (byte) 0x62, (byte) 0x39, (byte) 0xfb, (byte) 0x91, (byte) 0xfa, (byte) 0x3a, (byte) 0x57, (byte) 0x56,  -    (byte) 0x4a, (byte) 0xaa, (byte) 0x99, (byte) 0x1e, (byte) 0x9b, (byte) 0xcc, (byte) 0xa4, (byte) 0xc0,  -    (byte) 0x18, (byte) 0x46, (byte) 0xae, (byte) 0x15, (byte) 0x24, (byte) 0xf5, (byte) 0xf3, (byte) 0xe6,  -    (byte) 0x36, (byte) 0x55, (byte) 0x29, (byte) 0xa8, (byte) 0xa9, (byte) 0xaf, (byte) 0x7b, (byte) 0x44,  -    (byte) 0x19, (byte) 0xda, (byte) 0x66, (byte) 0x4d, (byte) 0x11, (byte) 0x89, (byte) 0x28, (byte) 0x34,  -    (byte) 0x01, (byte) 0x15, (byte) 0x24, (byte) 0x93, (byte) 0x43, (byte) 0x6a, (byte) 0x8f, (byte) 0xe4,  -    (byte) 0x54, (byte) 0x3a, (byte) 0x3d, (byte) 0x9b, (byte) 0x2f, (byte) 0xc3, (byte) 0xdb, (byte) 0x7e,  -    (byte) 0x5e, (byte) 0x12, (byte) 0x00, (byte) 0xaa, (byte) 0xe7, (byte) 0xc1, (byte) 0x82, (byte) 0x1c,  -    (byte) 0x1d, (byte) 0x1d, (byte) 0x23, (byte) 0x1d, (byte) 0xa3, (byte) 0xcc, (byte) 0x59, (byte) 0xe4,  -    (byte) 0x7a, (byte) 0xf0, (byte) 0x14, (byte) 0x17, (byte) 0xfb, (byte) 0x96, (byte) 0x90, (byte) 0xc1,  -    (byte) 0xc0, (byte) 0xde, (byte) 0xdb, (byte) 0x91, (byte) 0xfb, (byte) 0x49, (byte) 0x39, (byte) 0x70,  -    (byte) 0x76, (byte) 0x2f, (byte) 0x7b, (byte) 0x22, (byte) 0xcd, (byte) 0x35, (byte) 0xcb, (byte) 0xed,  -    (byte) 0x8f, (byte) 0xb3, (byte) 0x66, (byte) 0xae, (byte) 0x95, (byte) 0x49, (byte) 0x75 -  }; -   -  protected static final int KID_PIN_SS = 0x81; - -  protected byte[] EF_C_X509_CH_DS = new byte[2000]; -   -  public STARCOSApplSichereSignatur(STARCOSCardChannelEmul channel, byte[] SS_pin, int pinState) { -    super(channel); -    // Files -    System.arraycopy(C_X509_CH_DS, 0, EF_C_X509_CH_DS, 0, C_X509_CH_DS.length); -    putFile(new File(FID_EF_C_X509_CH_DS, EF_C_X509_CH_DS, FCI_EF_C_X509_CH_DS)); -     -    // PINs -    pins.put(KID_PIN_SS, new PIN(SS_pin, KID_PIN_SS, 3, pinState)); -  } - -  @Override -  public byte[] getAID() { -    return AID_SichereSignatur; -  } - -  @Override -  public byte[] getFID() { -    return FID_SichereSignatur; -  } - -  @Override -  public byte[] getFCI() { -    return FCI; -  } - -  @Override -  public ResponseAPDU cmdPERFORM_SECURITY_OPERATION(CommandAPDU command, CardChannelEmul channel) throws CardException { -     -    checkINS(command, 0x2A); -   -    if (command.getP1() == 0x90 && command.getP2() == 0xA0) { -       -      // HASH -      byte[] data = command.getData(); -      if (data[0] == (byte) 0x90 && data[1] == (byte) 0x14) { -        hash = Arrays.copyOfRange(data, 2, data.length); -        return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); -      } else { -        throw new CardException("HASH command only supports complete hash."); -      } -       -    } else if (command.getP1() == 0x9E && command.getP2() == 0x9A) { -       -      // COMPUTE DIGITAL SIGNATURE -      if (securityEnv == null) { -        // No security environment -        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x05}); -      } -      if (hash == null) { -        // Command sequence not correct -        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x03}); -      } -      if (hash.length != 20) { -        // Invalid hash length -        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); -      } -      if (pins.get(KID_PIN_SS).state != PIN.STATE_PIN_VERIFIED) { -        // Security Status not satisfied -        return new ResponseAPDU(new byte[] {(byte) 0x69, (byte) 0x82}); -      } -       -      byte[] signature = new byte[48];  -       -      // TODO replace by signature creation -      Random random = new Random(); -      random.nextBytes(signature); -       -      byte[] response = new byte[signature.length + 2]; -      System.arraycopy(signature, 0, response, 0, signature.length); -      response[signature.length] = (byte) 0x90; -      response[signature.length + 1] = (byte) 0x00; -       -      hash = null; -      pins.get(KID_PIN_SS).state = PIN.STATE_RESET; -       -      return new ResponseAPDU(response); -       -    } else { -      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x00}); -    } -     -  } -   -  public void clearCert() { -    Arrays.fill(EF_C_X509_CH_DS, (byte) 0x00); -  } - -  @Override -  public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) throws CardException { - -    checkINS(command, 0x22); - -    switch (command.getP2()) { -    case 0xA4: -      switch (command.getP1()) { -      case 0x41: -        // INTERNAL AUTHENTICATE -      case 0x81: -        // EXTERNAL AUTHENTICATE -      } -    case 0xB6: -      switch (command.getP1()) { -      case 0x41: { -        // PSO - COMPUTE DIGITAL SIGNATURE -        byte[] dst = new byte[] { (byte) 0x84, (byte) 0x03, (byte) 0x80, -            (byte) 0x02, (byte) 0x00, (byte) 0x89, (byte) 0x03, (byte) 0x13, (byte) 0x35, (byte) 0x10}; -        if (Arrays.equals(dst, command.getData())) { -          securityEnv = command.getData(); -          return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); -        } else { -          return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); -        } -      } -      case 0x81: -        // PSO - VERIFY DGITAL SIGNATURE -      } -    case 0xB8: -      switch (command.getP1()) { -      case 0x41: -        // PSO � DECIPHER -      case 0x81: -        // PSO � ENCIPHER -      } -    default: -      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); -    } -   -  } - -  /** -   * set and activate pin -   * @param value if null, pin will be set to NOTACTIVE -   */ -  @Override -  public void setPin(int kid, char[] value) { -    PIN pin = pins.get(kid); -    if (pin != null) { -      if (value == null) { -//        pin.pin = null; -        //TransportPIN -//        pin.pin = new byte[] { (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; -        pin.state = PIN.STATE_PIN_NOTACTIVE; -      } else { -        byte[] b = new byte[8]; -        b[0] = (byte) (0x20 | value.length); -        for(int i = 1, j = 0; i < b.length; i++) { -          int h = ((j < value.length) -                  ? Character.digit(value[j++], 10) -                  : 0x0F); -          int l = ((j < value.length) -                  ? Character.digit(value[j++], 10) -                  : 0x0F); -          b[i] = (byte) ((h << 4) | l); -        } -        pin.pin = b; -        pin.state = PIN.STATE_RESET; -      } -    } -  } -}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java index f37f12dd..7eecd7fc 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java @@ -16,43 +16,34 @@  */  package at.gv.egiz.smcc.starcos; +import java.util.ArrayList;  import java.util.Arrays;  import java.util.HashMap; +import java.util.List; -import javax.smartcardio.Card;  import javax.smartcardio.CardException;  import javax.smartcardio.CommandAPDU;  import javax.smartcardio.ResponseAPDU;  import at.gv.egiz.smcc.AbstractAppl;  import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.CardEmul;  import at.gv.egiz.smcc.File;  import at.gv.egiz.smcc.PIN; -import java.util.ArrayList; -import java.util.List; -@SuppressWarnings("restriction")  public class STARCOSCardChannelEmul extends CardChannelEmul {    public static final int KID_PIN_Glob = 0x01; -  /** -   *  -   */ -  protected CardEmul cardEmul; - -  public final List<File> globalFiles = new ArrayList<File>(); -  public final HashMap<Integer, PIN> globalPins = new HashMap<Integer, PIN>(); - -  public STARCOSCardChannelEmul(CardEmul cardEmul, byte[] Glob_PIN, int PIN_STATE) { -    this.cardEmul = cardEmul; -    globalPins.put(KID_PIN_Glob, new PIN(Glob_PIN, KID_PIN_Glob, 10, PIN_STATE)); - } +  protected List<File> globalFiles = new ArrayList<File>(); +   +  protected HashMap<Integer, PIN> globalPins = new HashMap<Integer, PIN>(); -  @Override -  public Card getCard() { -    return cardEmul; +  public void setGlobalFiles(List<File> globalFiles) { +    this.globalFiles = globalFiles; +  } +   +  public void setGlobalPins(HashMap<Integer, PIN> globalPins) { +    this.globalPins = globalPins;    }    protected ResponseAPDU cmdSELECT(CommandAPDU command) throws CardException { @@ -122,7 +113,7 @@ public class STARCOSCardChannelEmul extends CardChannelEmul {          }          currentAppl = appl; -        byte[] fci = currentAppl.getFCI(); +        byte[] fci = currentAppl.getFCX();          byte[] response = new byte[fci.length + 2];          System.arraycopy(fci, 0, response, 0, fci.length);          response[fci.length] = (byte) 0x90; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardEmul.java deleted file mode 100644 index 5963fb63..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardEmul.java +++ /dev/null @@ -1,54 +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.starcos; - - -import javax.smartcardio.ATR; - -import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.PIN; - -@SuppressWarnings("restriction") -public class STARCOSCardEmul extends CardEmul { - -  public static byte[] DEFAULT_SS_PIN = new byte[] { (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; -  public static byte[] DEFAULT_Glob_PIN = new byte[] { (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; - -  protected static ATR ATR = new ATR(new byte[] { -      (byte) 0x3b, (byte) 0xbd, (byte) 0x18, (byte) 0x00, (byte) 0x81, (byte) 0x31, (byte) 0xfe, (byte) 0x45,  -      (byte) 0x80, (byte) 0x51, (byte) 0x02, (byte) 0x67, (byte) 0x05, (byte) 0x18, (byte) 0xb1, (byte) 0x02,  -      (byte) 0x02, (byte) 0x02, (byte) 0x01, (byte) 0x81, (byte) 0x05, (byte) 0x31 -  }); - -  public STARCOSCardEmul() { -    this(DEFAULT_SS_PIN, DEFAULT_Glob_PIN, PIN.STATE_RESET); -  } - -  public STARCOSCardEmul(byte[] SS_PIN, byte[] Glob_PIN, int PIN_STATE) { -    channel = new STARCOSCardChannelEmul(this, Glob_PIN, PIN_STATE); -    applications.add(new STARCOSApplSichereSignatur((STARCOSCardChannelEmul) channel, SS_PIN, PIN_STATE)); -    applications.add(new STARCOSApplInfobox((STARCOSCardChannelEmul) channel)); -    applications.add(new STARCOSApplGewoehnlicheSignatur((STARCOSCardChannelEmul) channel, -            STARCOSApplGewoehnlicheSignatur.DST)); -  } - -  @Override -  public ATR getATR() { -    return ATR; -  } -}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java deleted file mode 100644 index 82e48d64..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java +++ /dev/null @@ -1,346 +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.starcos; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; - - -import org.junit.Test; - -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.CardNotSupportedException; -import at.gv.egiz.smcc.CardTerminalEmul; -import at.gv.egiz.smcc.CardTest; -import at.gv.egiz.smcc.pin.gui.ChangePINProvider; -import at.gv.egiz.smcc.pin.gui.InvalidChangePINProvider; -import at.gv.egiz.smcc.pin.gui.InvalidPINProvider; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PIN; -import at.gv.egiz.smcc.PINFormatException; -import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PinInfo; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.SignatureCardFactory; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import at.gv.egiz.smcc.SignatureCard.KeyboxName; -import org.junit.Ignore; - -public class STARCOSCardTest extends CardTest { - -  @Override -  protected SignatureCard createSignatureCard() -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    STARCOSCardEmul card = new STARCOSCardEmul(); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  protected SignatureCard createSignatureCard(byte[] SS_PIN, byte[] Glob_PIN, int pinState) -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    STARCOSCardEmul card = new STARCOSCardEmul(SS_PIN, Glob_PIN, pinState); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  @Test -  public void testGetInfoboxIdentityLinkEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSApplInfobox appl = (STARCOSApplInfobox) card.getApplication(STARCOSAppl.AID_Infobox); -    appl.clearInfobox(); - -    byte[] idlink = signatureCard.getInfobox("IdentityLink", -        new SMCCTestPINProvider(pin), null); -    assertNull(idlink); - -  } - -  @Test(expected = SignatureCardException.class) -  public void testGetInfoboxIdentityInvalid() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    char[] pin = "0000".toCharArray(); -     -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSApplInfobox appl = (STARCOSApplInfobox) card.getApplication(STARCOSAppl.AID_Infobox); -    appl.setInfoboxHeader((byte) 0xFF); - -    signatureCard.getInfobox("IdentityLink", new SMCCTestPINProvider(pin), null); - -  } - -  @Test -  public void testGetCerts() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); - -    byte[] cert; - -    cert = signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); -    assertNotNull(cert); -    assertTrue(Arrays.equals(cert, STARCOSApplSichereSignatur.C_X509_CH_DS)); - -    cert = signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); -    assertNotNull(cert); -    assertTrue(Arrays.equals(cert, STARCOSApplGewoehnlicheSignatur.C_X509_CH_AUT)); - -  } - -  @Test(expected = NotActivatedException.class) -  public void testGetDSCertEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSApplSichereSignatur appl = (STARCOSApplSichereSignatur) card.getApplication(STARCOSApplSichereSignatur.AID_SichereSignatur); -    appl.clearCert(); - -    signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); - -  } - -  @Test(expected = NotActivatedException.class) -  public void testGetAUTCertEmpty() throws SignatureCardException, -      InterruptedException, CardNotSupportedException { - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSApplGewoehnlicheSignatur appl = (STARCOSApplGewoehnlicheSignatur) card.getApplication(STARCOSApplGewoehnlicheSignatur.AID_GewoehnlicheSignatur); -    appl.clearCert(); - -    signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); - -  } - -  @Test -  public void testSignSichereSignatur() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    char[] pin = "123456".toCharArray(); - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSApplSichereSignatur appl = (STARCOSApplSichereSignatur) card.getApplication(STARCOSApplSichereSignatur.AID_SichereSignatur); -    appl.setPin(STARCOSApplSichereSignatur.KID_PIN_SS, pin); - -    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), -        KeyboxName.SECURE_SIGNATURE_KEYPAIR, new SMCCTestPINProvider(pin), null); - -    assertNotNull(signature); - -  } - -  @Test -  public void testSignGewoehnlicheSignatur() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    char[] pin = "1234".toCharArray(); - -    SignatureCard signatureCard = createSignatureCard(); -    CardEmul card = (CardEmul) signatureCard.getCard(); -    STARCOSCardChannelEmul channel = (STARCOSCardChannelEmul) card.getBasicChannel(); -    channel.setPin(STARCOSCardChannelEmul.KID_PIN_Glob, pin); - -    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), -        KeyboxName.CERITIFIED_KEYPAIR, new SMCCTestPINProvider(pin), null); - -    assertNotNull(signature); - -  } - -  @Test(expected = LockedException.class) -  public void testSignSichereSignaturInvalidPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("000000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignGewoehnlicheSignaturInvalidPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("1234".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignSichereSignaturBlockedPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(null, null, PIN.STATE_PIN_BLOCKED); - -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("000000".toCharArray()); -    assertTrue(pinProvider.getProvided() <= 0); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.SECURE_SIGNATURE_KEYPAIR, -        pinProvider, null); - -  } - -  @Test(expected = LockedException.class) -  public void testSignGewoehnlicheSignaturBlockedPin() throws SignatureCardException, -      InterruptedException, CardNotSupportedException, -      NoSuchAlgorithmException, IOException { - -    SignatureCard signatureCard = createSignatureCard(null, null, PIN.STATE_PIN_BLOCKED); -     -    SMCCTestPINProvider pinProvider = new SMCCTestPINProvider("0000".toCharArray()); - -    signatureCard.createSignature(new ByteArrayInputStream("MOCCA" -        .getBytes("ASCII")), KeyboxName.CERITIFIED_KEYPAIR, -        pinProvider, null); - -  } - -  @Test -  public void testChangePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    // set all initial pins to DEFAULT_SS_PIN (123456) -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( -            STARCOSCardEmul.DEFAULT_SS_PIN, STARCOSCardEmul.DEFAULT_SS_PIN, PIN.STATE_RESET); -     -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] pin = "123456".toCharArray(); - -      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -        char[] newPin = new char[i]; -        Arrays.fill(newPin, '0'); -        signatureCard -            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); -        pin = newPin; -      } -    } -  } - -  @Test -  @Override -  public void testActivatePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( -            null, null, PIN.STATE_PIN_NOTACTIVE); - -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] pin = "1234567890".substring(0, pinInfo.getMinLength()).toCharArray(); - -      boolean notActive = false; -      try { -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -      } catch (NotActivatedException ex) { -        notActive = true; -      } -      assertTrue(notActive); - -      signatureCard.activatePIN(pinInfo, new ChangePINProvider(null, pin)); -      signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -    } -  } - -  @Test -  public void testVerifyInvalidPin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); - -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] invalidPin = "999999".toCharArray(); -      int numInvalidTries = 2; -      InvalidPINProvider invalidPinProvider = new InvalidPINProvider(invalidPin, numInvalidTries); -      try { -        signatureCard.verifyPIN(pinInfo, invalidPinProvider); -      } catch (CancelledException ex) { -      } finally { -        assertTrue(invalidPinProvider.getProvided() == numInvalidTries); -      } -    } -  } - -  @Test -  public void testChangeInvalidPin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); -     -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] invalidPin = "999999".toCharArray(); -      int numInvalidTries = 2; -      InvalidChangePINProvider invalidPinProvider = -              new InvalidChangePINProvider(invalidPin, invalidPin, numInvalidTries); - -      try { -        signatureCard.changePIN(pinInfo, invalidPinProvider); -      } catch (CancelledException ex) { -      } finally { -        assertTrue(invalidPinProvider.getProvided() == numInvalidTries); -      } -    } -  } -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG2ApplSichereSignatur.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG2ApplSichereSignatur.java new file mode 100644 index 00000000..4e04baea --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG2ApplSichereSignatur.java @@ -0,0 +1,168 @@ +/* +* 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.starcos; + +import java.util.Arrays; +import java.util.Random; + +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import at.gv.egiz.smcc.CardChannelEmul; +import at.gv.egiz.smcc.PIN; + +public class STARCOSG2ApplSichereSignatur extends STARCOSAppl { + +  protected static final int KID_PIN_SS = 0x81; + +  protected byte[] dst = new byte[] { (byte) 0x84, (byte) 0x03, (byte) 0x80, +      (byte) 0x02, (byte) 0x00, (byte) 0x89, (byte) 0x03, (byte) 0x13, (byte) 0x35, (byte) 0x10}; + +  public void setDst(byte[] dst) { +    this.dst = dst; +  } + +  @Override +  public ResponseAPDU cmdPERFORM_SECURITY_OPERATION(CommandAPDU command, CardChannelEmul channel) throws CardException { +     +    checkINS(command, 0x2A); +   +    if (command.getP1() == 0x90 && command.getP2() == 0xA0) { +       +      // HASH +      byte[] data = command.getData(); +      if (data[0] == (byte) 0x90 && data[1] == (byte) 0x14) { +        hash = Arrays.copyOfRange(data, 2, data.length); +        return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +      } else { +        throw new CardException("HASH command only supports complete hash."); +      } +       +    } else if (command.getP1() == 0x9E && command.getP2() == 0x9A) { +       +      // COMPUTE DIGITAL SIGNATURE +      if (securityEnv == null) { +        // No security environment +        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x05}); +      } +      if (hash == null) { +        // Command sequence not correct +        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x03}); +      } +      if (hash.length != 20) { +        // Invalid hash length +        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +      } +      if (pins.get(KID_PIN_SS).state != PIN.STATE_PIN_VERIFIED) { +        // Security Status not satisfied +        return new ResponseAPDU(new byte[] {(byte) 0x69, (byte) 0x82}); +      } +       +      byte[] signature = new byte[48];  +       +      // TODO replace by signature creation +      Random random = new Random(); +      random.nextBytes(signature); +       +      byte[] response = new byte[signature.length + 2]; +      System.arraycopy(signature, 0, response, 0, signature.length); +      response[signature.length] = (byte) 0x90; +      response[signature.length + 1] = (byte) 0x00; +       +      hash = null; +      pins.get(KID_PIN_SS).state = PIN.STATE_RESET; +       +      return new ResponseAPDU(response); +       +    } else { +      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x00}); +    } +     +  } +   +  @Override +  public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) throws CardException { + +    checkINS(command, 0x22); + +    switch (command.getP2()) { +    case 0xA4: +      switch (command.getP1()) { +      case 0x41: +        // INTERNAL AUTHENTICATE +      case 0x81: +        // EXTERNAL AUTHENTICATE +      } +    case 0xB6: +      switch (command.getP1()) { +      case 0x41: { +        // PSO - COMPUTE DIGITAL SIGNATURE +        if (Arrays.equals(dst, command.getData())) { +          securityEnv = command.getData(); +          return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +        } else { +          return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +        } +      } +      case 0x81: +        // PSO - VERIFY DGITAL SIGNATURE +      } +    case 0xB8: +      switch (command.getP1()) { +      case 0x41: +        // PSO - DECIPHER +      case 0x81: +        // PSO - ENCIPHER +      } +    default: +      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); +    } +   +  } + +  /** +   * set and activate pin +   * @param value if null, pin will be set to NOTACTIVE +   */ +  @Override +  public void setPin(int kid, char[] value) { +    PIN pin = pins.get(kid); +    if (pin != null) { +      if (value == null) { +//        pin.pin = null; +        //TransportPIN +//        pin.pin = new byte[] { (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; +        pin.state = PIN.STATE_PIN_NOTACTIVE; +      } else { +        byte[] b = new byte[8]; +        b[0] = (byte) (0x20 | value.length); +        for(int i = 1, j = 0; i < b.length; i++) { +          int h = ((j < value.length) +                  ? Character.digit(value[j++], 10) +                  : 0x0F); +          int l = ((j < value.length) +                  ? Character.digit(value[j++], 10) +                  : 0x0F); +          b[i] = (byte) ((h << 4) | l); +        } +        pin.pin = b; +        pin.state = PIN.STATE_RESET; +      } +    } +  } +}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3ApplSichereSignatur.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3ApplSichereSignatur.java new file mode 100644 index 00000000..0f474a36 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3ApplSichereSignatur.java @@ -0,0 +1,189 @@ +/* +* 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.starcos; + +import java.util.Arrays; +import java.util.Random; + +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import at.gv.egiz.smcc.CardChannelEmul; +import at.gv.egiz.smcc.PIN; + +public class STARCOSG3ApplSichereSignatur extends STARCOSAppl { + +  protected static final int KID_PIN_SS = 0x81; + +  protected byte[] dst = { (byte) 0x84, (byte) 0x03, (byte) 0x80, (byte) 0x02, +      (byte) 0x00, (byte) 0x80, (byte) 0x01, (byte) 0x04 }; +   +  protected byte[] ht = { (byte) 0x80, (byte) 0x01, (byte) 0x10 }; +   +  public void setHt1(byte[] ht) { +    this.ht = ht; +  } + +  public void setDst1(byte[] dst) { +    this.dst = dst; +  } + +  @Override +  public ResponseAPDU cmdPERFORM_SECURITY_OPERATION(CommandAPDU command, CardChannelEmul channel) throws CardException { +     +    checkINS(command, 0x2A); +   +    if (command.getP1() == 0x90 && command.getP2() == 0xA0) { +       +      // HASH +      byte[] data = command.getData(); +      if (data[0] == (byte) 0x90 && data[1] == (byte) 0x14) { +        hash = Arrays.copyOfRange(data, 2, data.length); +        return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +      } else { +        throw new CardException("HASH command only supports complete hash."); +      } +       +    } else if (command.getP1() == 0x9E && command.getP2() == 0x9A) { +       +      // COMPUTE DIGITAL SIGNATURE +      if (securityEnv == null) { +        // No security environment +        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x05}); +      } +       +      if (command.getData() != null) { +        hash = command.getData(); +      } +       +      if (hash == null) { +        // Command sequence not correct +        return new ResponseAPDU(new byte[] {(byte) 0x6F, (byte) 0x03}); +      } +      if (hash.length != 20) { +        // Invalid hash length +        return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +      } +      if (pins.get(KID_PIN_SS).state != PIN.STATE_PIN_VERIFIED) { +        // Security Status not satisfied +        return new ResponseAPDU(new byte[] {(byte) 0x69, (byte) 0x82}); +      } +       +      byte[] signature = new byte[48];  +       +      // TODO replace by signature creation +      Random random = new Random(); +      random.nextBytes(signature); +       +      byte[] response = new byte[signature.length + 2]; +      System.arraycopy(signature, 0, response, 0, signature.length); +      response[signature.length] = (byte) 0x90; +      response[signature.length + 1] = (byte) 0x00; +       +      hash = null; +      pins.get(KID_PIN_SS).state = PIN.STATE_RESET; +       +      return new ResponseAPDU(response); +       +    } else { +      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x00}); +    } +     +  } +   +  @Override +  public ResponseAPDU cmdMANAGE_SECURITY_ENVIRONMENT(CommandAPDU command, CardChannelEmul channel) throws CardException { + +    checkINS(command, 0x22); + +    switch (command.getP2()) { +    case 0xA4: +      switch (command.getP1()) { +      case 0x41: +        // INTERNAL AUTHENTICATE +      case 0x81: +        // EXTERNAL AUTHENTICATE +      } +    case 0xAA: +      switch (command.getP1()) { +      case 0x41: +        // SET HT +        if (Arrays.equals(ht, command.getData())) { +          return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +        } else { +          return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +        } +      } +    case 0xB6: +      switch (command.getP1()) { +      case 0x41: { +        // PSO - COMPUTE DIGITAL SIGNATURE +        if (Arrays.equals(dst, command.getData())) { +          securityEnv = command.getData(); +          return new ResponseAPDU(new byte[] {(byte) 0x90, (byte) 0x00}); +        } else { +          return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x80}); +        } +      } +      case 0x81: +        // PSO - VERIFY DGITAL SIGNATURE +      } +    case 0xB8: +      switch (command.getP1()) { +      case 0x41: +        // PSO - DECIPHER +      case 0x81: +        // PSO - ENCIPHER +      } +    default: +      return new ResponseAPDU(new byte[] {(byte) 0x6A, (byte) 0x81}); +    } +   +  } + +  /** +   * set and activate pin +   * @param value if null, pin will be set to NOTACTIVE +   */ +  @Override +  public void setPin(int kid, char[] value) { +    PIN pin = pins.get(kid); +    if (pin != null) { +      if (value == null) { +//        pin.pin = null; +        //TransportPIN +//        pin.pin = new byte[] { (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; +        pin.state = PIN.STATE_PIN_NOTACTIVE; +      } else { +        byte[] b = new byte[8]; +        b[0] = (byte) (0x20 | value.length); +        for(int i = 1, j = 0; i < b.length; i++) { +          int h = ((j < value.length) +                  ? Character.digit(value[j++], 10) +                  : 0x0F); +          int l = ((j < value.length) +                  ? Character.digit(value[j++], 10) +                  : 0x0F); +          b[i] = (byte) ((h << 4) | l); +        } +        pin.pin = b; +        pin.state = PIN.STATE_RESET; +      } +    } +  } +}
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardChannelEmul.java deleted file mode 100644 index dc6836ae..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardChannelEmul.java +++ /dev/null @@ -1,46 +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.starcos; - -import at.gv.egiz.smcc.CardEmul; -import at.gv.egiz.smcc.File; -import at.gv.egiz.smcc.PIN; - -/** - * - * @author clemens - */ -public class STARCOSG3CardChannelEmul extends STARCOSCardChannelEmul { - -  public STARCOSG3CardChannelEmul(CardEmul cardEmul, byte[] Glob_PIN, int PIN_STATE) { -    super(cardEmul, Glob_PIN, PIN_STATE); - -    // G3 version file -    byte[] versionFileFID = new byte[]{(byte) 0x00, (byte) 0x32}; -    byte[] versionFile = new byte[]{ -      (byte) 0xa5, (byte) 0x0e, (byte) 0x53, (byte) 0x02, (byte) 0x01, (byte) 0x20, (byte) 0x54, (byte) 0x08, -      (byte) 0x01, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x04, (byte) 0x01, (byte) 0x70, (byte) 0x01}; -    byte[] versionFileFCX = new byte[]{ -      (byte) 0x62, (byte) 0x1a, (byte) 0x80, (byte) 0x02, (byte) 0x00, (byte) 0x14, (byte) 0x82, (byte) 0x05, -      (byte) 0x44, (byte) 0x41, (byte) 0x00, (byte) 0x14, (byte) 0x01, (byte) 0x83, (byte) 0x02, (byte) 0x00, -      (byte) 0x32, (byte) 0x88, (byte) 0x01, (byte) 0xd8, (byte) 0x8a, (byte) 0x01, (byte) 0x05, (byte) 0xa1, -      (byte) 0x03, (byte) 0x8b, (byte) 0x01, (byte) 0x03}; - -    globalFiles.add(new File(versionFileFID, versionFile, versionFileFCX)); - -  } - } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardEmul.java deleted file mode 100644 index 7583b3ad..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardEmul.java +++ /dev/null @@ -1,57 +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.starcos; - -import at.gv.egiz.smcc.CardEmul; -import javax.smartcardio.ATR; - -import at.gv.egiz.smcc.PIN; - -@SuppressWarnings("restriction") -public class STARCOSG3CardEmul extends CardEmul { - -  public static byte[] TRANSPORT_SS_PIN = new byte[] { (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; -  public static byte[] TRANSPORT_Glob_PIN = new byte[] { (byte) 0x24, (byte) 0x12, (byte) 0x34, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; - -  public static byte[] DEFAULT_SS_PIN = TRANSPORT_SS_PIN; -  public static byte[] DEFAULT_Glob_PIN = new byte[] { (byte) 0x24, (byte) 0x00, (byte) 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}; - -  protected static ATR ATR = new ATR(new byte[] { -      (byte) 0x3b, (byte) 0xbd, (byte) 0x18, (byte) 0x00, (byte) 0x81, (byte) 0x31, (byte) 0xfe, (byte) 0x45, -      (byte) 0x80, (byte) 0x51, (byte) 0x02, (byte) 0x67, (byte) 0x05, (byte) 0x18, (byte) 0xb1, (byte) 0x02, -      (byte) 0x02, (byte) 0x02, (byte) 0x01, (byte) 0x81, (byte) 0x05, (byte) 0x31 -  }); - -  public STARCOSG3CardEmul(byte[] SS_PIN, byte[] Glob_PIN, int PIN_STATE){ -    channel = new STARCOSG3CardChannelEmul(this, Glob_PIN, PIN_STATE); -    applications.add(new STARCOSApplSichereSignatur((STARCOSCardChannelEmul) channel, -            SS_PIN, PIN_STATE)); -    applications.add(new STARCOSApplInfobox((STARCOSCardChannelEmul) channel)); -    applications.add(new STARCOSApplGewoehnlicheSignatur((STARCOSCardChannelEmul) channel, -            STARCOSApplGewoehnlicheSignatur.DST_G3)); -  } - - -  public STARCOSG3CardEmul() { -    this(DEFAULT_SS_PIN, DEFAULT_Glob_PIN, PIN.STATE_RESET); -  } - -  @Override -  public ATR getATR() { -    return ATR; -  } -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java deleted file mode 100644 index 1d8507b2..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java +++ /dev/null @@ -1,117 +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.starcos; - -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; - - -import org.junit.Test; - -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.CardNotSupportedException; -import at.gv.egiz.smcc.CardTerminalEmul; -import at.gv.egiz.smcc.CardTest; -import at.gv.egiz.smcc.pin.gui.ChangePINProvider; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PIN; -import at.gv.egiz.smcc.PINFormatException; -import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PinInfo; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.SignatureCardFactory; -import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; - -public class STARCOSG3CardTest extends CardTest { - -  @Override -  protected SignatureCard createSignatureCard() -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    STARCOSG3CardEmul card = new STARCOSG3CardEmul(); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  protected SignatureCard createSignatureCard(byte[] SS_PIN, byte[] Glob_PIN, int pinState) -      throws CardNotSupportedException { -    SignatureCardFactory factory = SignatureCardFactory.getInstance(); -    STARCOSG3CardEmul card = new STARCOSG3CardEmul(SS_PIN, Glob_PIN, pinState); -    SignatureCard signatureCard = factory.createSignatureCard(card, -        new CardTerminalEmul(card)); -    assertTrue(signatureCard instanceof PINMgmtSignatureCard); -    return signatureCard; -  } - -  @Test -  public void testChangePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( -            STARCOSG3CardEmul.DEFAULT_SS_PIN, STARCOSG3CardEmul.DEFAULT_SS_PIN, PIN.STATE_RESET); -     -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] pin = "123456".toCharArray(); - -      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -        char[] newPin = new char[i]; -        Arrays.fill(newPin, '0'); -        signatureCard -            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); -        pin = newPin; -      } -    } -  } - -  @Test -  @Override -  public void testActivatePin() throws CardNotSupportedException, -      LockedException, NotActivatedException, CancelledException, -      PINFormatException, SignatureCardException, InterruptedException { - -    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( -            STARCOSG3CardEmul.TRANSPORT_SS_PIN, STARCOSG3CardEmul.TRANSPORT_SS_PIN, PIN.STATE_PIN_NOTACTIVE); -     -    for (PinInfo pinInfo : signatureCard.getPinInfos()) { - -      char[] pin = "123456789".substring(0, pinInfo.getMinLength()).toCharArray(); -      char[] transportPIN = "123456".toCharArray(); - -      boolean notActive = false; -      try { -        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -      } catch (NotActivatedException ex) { -        notActive = true; -      } -      assertTrue(notActive); - -      signatureCard.activatePIN(pinInfo, new ChangePINProvider(transportPIN, pin)); -      signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); -    } -  } - -   -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTest.java new file mode 100644 index 00000000..ca3efa38 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTest.java @@ -0,0 +1,228 @@ +/* +* Copyright 2009 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.test; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.NoSuchAlgorithmException; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.SignatureCard.KeyboxName; +import at.gv.egiz.smcc.pin.gui.CancelPINProvider; +import at.gv.egiz.smcc.pin.gui.DummyPINGUI; +import at.gv.egiz.smcc.pin.gui.InterruptPINProvider; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + +public abstract class AbstractCardTest extends AbstractCardTestBase { +   +  @Test +  public void testGetCertificates() throws SignatureCardException, InterruptedException { +     +    byte[] certificateSSRef = (byte[]) applicationContext.getBean("certificateSS", byte[].class); +     +    byte[] certificateSS = signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); +     +    assertArrayEquals(certificateSSRef, certificateSS); +     +    byte[] certificateGSRef = (byte[]) applicationContext.getBean("certificateGS", byte[].class); +     +    byte[] certificateGS = signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); +     +    assertArrayEquals(certificateGSRef, certificateGS); +     +  } +   +  @Test +  public void testSignSIG() throws UnsupportedEncodingException, SignatureCardException, InterruptedException, IOException { +     +    char[] pin = "123456".toCharArray(); + +    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" +        .getBytes("ASCII")), +        KeyboxName.SECURE_SIGNATURE_KEYPAIR, new SMCCTestPINProvider(pin), null); + +    assertNotNull(signature); +     +  } + +  @Test(expected = LockedException.class) +  public void testSignSIGWrongPIN() throws UnsupportedEncodingException, SignatureCardException, InterruptedException, IOException { +     +    char[] pin = "00000".toCharArray(); + +    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" +        .getBytes("ASCII")), +        KeyboxName.SECURE_SIGNATURE_KEYPAIR, new SMCCTestPINProvider(pin), null); + +    assertNotNull(signature); +     +  } +   +  @Test(expected = CancelledException.class) +  public void testSignSIGCancel() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new CancelPINProvider(); + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.SECURE_SIGNATURE_KEYPAIR, pinProvider, null); + +  } + +  @Test +  public void testSignDEC() throws UnsupportedEncodingException, SignatureCardException, InterruptedException, IOException { +     +    char[] pin = "1234".toCharArray(); + +    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" +        .getBytes("ASCII")), +        KeyboxName.CERITIFIED_KEYPAIR, new SMCCTestPINProvider(pin), null); + +    assertNotNull(signature); +     +  } +   +  @Test(expected = LockedException.class) +  public void testSignDECWrongPIN() throws UnsupportedEncodingException, SignatureCardException, InterruptedException, IOException { +     +    char[] pin = "00000".toCharArray(); + +    byte[] signature = signatureCard.createSignature(new ByteArrayInputStream("MOCCA" +        .getBytes("ASCII")), +        KeyboxName.CERITIFIED_KEYPAIR, new SMCCTestPINProvider(pin), null); + +    assertNotNull(signature); +     +  } +   +  @Test(expected = CancelledException.class) +  public void testSignDECCancel() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new CancelPINProvider(); + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.CERITIFIED_KEYPAIR, pinProvider, null); + +  } +   +  @Test(expected = InterruptedException.class) +  public void testSignSIGInterrrupted() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new InterruptPINProvider(); + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.SECURE_SIGNATURE_KEYPAIR, pinProvider, null); + +  } + +  @Test(expected = InterruptedException.class) +  public void testSignDECInterrrupted() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new InterruptPINProvider(); + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.CERITIFIED_KEYPAIR, pinProvider, null); + +  } +   +  @Test(expected = CancelledException.class) +  public void testSignSIGConcurrent() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new DummyPINGUI() { +      @Override +      public char[] providePIN(PinInfo spec, int retries) +          throws CancelledException, InterruptedException { + +        try { +          signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); +          assertTrue(false); +          return null; +        } catch (SignatureCardException e) { +          // expected +          throw new CancelledException(); +        } + +      } +    }; + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.SECURE_SIGNATURE_KEYPAIR, pinProvider, null); + +  } + +  @Test(expected = CancelledException.class) +  public void testSignDECConcurrent() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, IOException { + +    PINGUI pinProvider = new DummyPINGUI() { +      @Override +      public char[] providePIN(PinInfo spec, int retries) +          throws CancelledException, InterruptedException { + +        try { +          signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); +          assertTrue(false); +          return null; +        } catch (SignatureCardException e) { +          // expected +          throw new CancelledException(); +        } +      } +    }; + +    signatureCard.createSignature(new ByteArrayInputStream(MOCCA), +        KeyboxName.CERITIFIED_KEYPAIR, pinProvider, null); + +  } +   +  @Test +  public void testGetPinSpecs() throws CardNotSupportedException, +      SignatureCardException { + +    assertTrue(signatureCard instanceof PINMgmtSignatureCard); + +    PinInfo[] specs = ((PINMgmtSignatureCard) signatureCard).getPinInfos(); +    assertNotNull(specs); +    assertTrue(specs.length > 0); + +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTestBase.java b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTestBase.java new file mode 100644 index 00000000..f809ca71 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractCardTestBase.java @@ -0,0 +1,62 @@ +/* +* Copyright 2009 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.test; + +import static org.junit.Assert.assertNotNull; +import iaik.security.provider.IAIK; + +import javax.smartcardio.Card; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.CardTerminalEmul; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.SignatureCardFactory; + +public abstract class AbstractCardTestBase { +   +  public static byte[] MOCCA = { 'M', 'O', 'C', 'C', 'A' }; + +  protected ApplicationContext applicationContext; +   +  protected Card card; +   +  protected SignatureCard signatureCard; +   +  @BeforeClass +  public static void setupClass() { +    IAIK.addAsJDK14Provider(); +  } +   +  @Before +  public void setup() throws CardNotSupportedException { +    applicationContext = new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass()); + +    card = (Card) applicationContext.getBean("card", Card.class); +    assertNotNull(card); + +    SignatureCardFactory factory = SignatureCardFactory.getInstance(); +    signatureCard = factory.createSignatureCard(card, new CardTerminalEmul(card)); +    assertNotNull(signatureCard); +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractInvalidCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractInvalidCardTest.java new file mode 100644 index 00000000..7b9f9f83 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractInvalidCardTest.java @@ -0,0 +1,66 @@ +/* +* Copyright 2009 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.test; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import org.junit.Test; + +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.SignatureCard.KeyboxName; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + +public abstract class AbstractInvalidCardTest extends AbstractCardTestBase { + +  @Test +  public void testGetCertificates() throws SignatureCardException, InterruptedException { +     +    try { +      signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); +      fail(); +    } catch (SignatureCardException e) { +      // expected +    } catch (Exception e) { +      fail(); +    } +     +    try { +      signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); +      fail(); +    } catch (SignatureCardException e) { +      // expected +    } catch (Exception e) { +      fail(); +    } +     +  } + +  @Test(expected = SignatureCardException.class) +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("0000".toCharArray()); +     +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertNull(idlink); +     +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractNotActivatedCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractNotActivatedCardTest.java new file mode 100644 index 00000000..9736531f --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/AbstractNotActivatedCardTest.java @@ -0,0 +1,69 @@ +/* +* Copyright 2009 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.test; + +import static org.junit.Assert.fail; + +import org.junit.Test; + +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.SignatureCard.KeyboxName; + +public abstract class AbstractNotActivatedCardTest extends AbstractCardTestBase { + +  @Test(expected = NotActivatedException.class) +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    signatureCard.getInfobox("IdentityLink", null, null); +     +  } +   +  @Test +  public void testGetCertificates() throws SignatureCardException, InterruptedException { +     +    try { +      signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); +      fail(); +    } catch (NotActivatedException e) { +      // expected +    } catch (Exception e) { +      fail(); +    } + +    try { +      signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); +      fail(); +    } catch (NotActivatedException e) { +      // expected +    } catch (Exception e) { +      fail(); +    } +     +  } + +  @Test (expected = NotActivatedException.class) +  public void getPINInfos() throws SignatureCardException { + +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    signatureCard.getPinInfos(); + +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA03Test.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA03Test.java new file mode 100644 index 00000000..ccb46b4b --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA03Test.java @@ -0,0 +1,87 @@ +/* + * Copyright 2009 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.test.acos; + +import static org.junit.Assert.assertArrayEquals; + +import java.util.Arrays; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PIN; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.ChangePINProvider; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + + +public class ACOSA03Test extends ACOSTest { + +  @Test +  public void testChangePins() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    byte[] referenceData = { (byte) 0x31, (byte) 0x32, (byte) 0x33, +        (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x00, (byte) 0x00 }; +     +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    PIN signaturPIN = (PIN) applicationContext.getBean("signaturPIN"); +    signaturPIN.setPin(referenceData); +    PIN infoboxPIN = (PIN) applicationContext.getBean("infoboxPIN"); +    infoboxPIN.setPin(referenceData); +    PIN geheimhaltungsPIN = (PIN) applicationContext.getBean("geheimhaltungsPIN"); +    geheimhaltungsPIN.setPin(referenceData); +     +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] pin = "123456".toCharArray(); + +      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +        char[] newPin = new char[i]; +        Arrays.fill(newPin, '0'); +        signatureCard +            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); +        pin = newPin; +      } +    } +  } +   +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("0000".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.java new file mode 100644 index 00000000..d22c45a0 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.java @@ -0,0 +1,44 @@ +/* +* Copyright 2009 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.test.acos; + +import static org.junit.Assert.assertArrayEquals; + +import org.junit.Test; + +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; +import at.gv.egiz.smcc.test.AbstractCardTestBase; + +public class ACOSA04InfoboxContainerEncryptedTest extends AbstractCardTestBase { + +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("1234".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardTestSuite.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04InvalidTest.java index 101f7edc..9696cb7d 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/ACOSCardTestSuite.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04InvalidTest.java @@ -1,5 +1,5 @@  /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and  * Graz University of Technology  *  * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,14 +14,11 @@  * See the License for the specific language governing permissions and  * limitations under the License.  */ -package at.gv.egiz.smcc.acos; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; +package at.gv.egiz.smcc.test.acos; -@RunWith(Suite.class) -@SuiteClasses( { A03CardTest.class, A04CardTest.class }) -public class ACOSCardTestSuite { +import at.gv.egiz.smcc.test.AbstractInvalidCardTest; + +public class ACOSA04InvalidTest extends AbstractInvalidCardTest {  } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.java new file mode 100644 index 00000000..56ce476c --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.java @@ -0,0 +1,24 @@ +/* + * Copyright 2009 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.test.acos; + +import at.gv.egiz.smcc.test.AbstractNotActivatedCardTest; + +public class ACOSA04NotActivatedTest extends AbstractNotActivatedCardTest { + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04Test.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04Test.java new file mode 100644 index 00000000..a5645da6 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSA04Test.java @@ -0,0 +1,85 @@ +/* + * Copyright 2009 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.test.acos; + +import static org.junit.Assert.assertArrayEquals; + +import java.util.Arrays; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PIN; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.ChangePINProvider; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + + +public class ACOSA04Test extends ACOSTest { + +  @Test +  public void testChangePins() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    byte[] referenceData = { (byte) 0x31, (byte) 0x32, (byte) 0x33, +        (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x00, (byte) 0x00 }; +     +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    PIN signaturPIN = (PIN) applicationContext.getBean("signaturPIN"); +    signaturPIN.setPin(referenceData); +    PIN infoboxPIN = (PIN) applicationContext.getBean("geheimhaltungsPIN"); +    infoboxPIN.setPin(referenceData); +     +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] pin = "123456".toCharArray(); + +      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +        char[] newPin = new char[i]; +        Arrays.fill(newPin, '0'); +        signatureCard +            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); +        pin = newPin; +      } +    } +  } +   +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("0000".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSTest.java index 7394bae7..d8d07393 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/acos/ACOSTest.java @@ -1,5 +1,5 @@  /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and  * Graz University of Technology  *  * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,18 +14,17 @@  * See the License for the specific language governing permissions and  * limitations under the License.  */ -package at.gv.egiz.smcc.acos; -import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.CardEmul; +package at.gv.egiz.smcc.test.acos; +import org.junit.Test; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.test.AbstractCardTest; -public class A03CardEmul extends ACOSCardEmul { +public abstract class ACOSTest extends AbstractCardTest { -  public A03CardEmul(A03ApplSIG applSIG, A03ApplDEC applDEC) { -    channel = new A03CardChannelEmul(this); -    applications.add(applSIG); -    applications.add(applDEC); -  } +  @Test +  public abstract void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException; +    } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG2Test.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG2Test.java new file mode 100644 index 00000000..904c8c06 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG2Test.java @@ -0,0 +1,85 @@ +/* + * Copyright 2009 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.test.ecard; + +import static org.junit.Assert.assertArrayEquals; + +import java.util.Arrays; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PIN; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.ChangePINProvider; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + + +public class ECardG2Test extends ECardTest { + +  @Test +  public void testChangeCardPin() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    byte[] referenceData = { (byte) 0x26, (byte) 0x12, (byte) 0x34, +        (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }; +     +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    PIN signaturPIN = (PIN) applicationContext.getBean("signaturPIN"); +    signaturPIN.setPin(referenceData); +    PIN kartenPIN = (PIN) applicationContext.getBean("kartenPIN"); +    kartenPIN.setPin(referenceData); +     +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] pin = "123456".toCharArray(); + +      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +        char[] newPin = new char[i]; +        Arrays.fill(newPin, '0'); +        signatureCard +            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); +        pin = newPin; +      } +    } +  } +   +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("1234".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.java new file mode 100644 index 00000000..6270e3b8 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.java @@ -0,0 +1,64 @@ +/* +* Copyright 2009 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.test.ecard; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.ChangePINProvider; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; +import at.gv.egiz.smcc.test.AbstractCardTestBase; + +public class ECardG3ActivateTest extends AbstractCardTestBase { + +  @Test +  public void testActivatePin() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +     +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] pin = "123456789".substring(0, pinInfo.getMinLength()).toCharArray(); +      char[] transportPIN = "123456".toCharArray(); + +      boolean notActive = false; +      try { +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +      } catch (NotActivatedException ex) { +        notActive = true; +      } +      assertTrue(notActive); + +      signatureCard.activatePIN(pinInfo, new ChangePINProvider(transportPIN, pin)); +      signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +    } +  } + +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.java new file mode 100644 index 00000000..2f240729 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.java @@ -0,0 +1,44 @@ +/* +* Copyright 2009 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.test.ecard; + +import static org.junit.Assert.assertArrayEquals; + +import org.junit.Test; + +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; +import at.gv.egiz.smcc.test.AbstractCardTestBase; + +public class ECardG3InfoboxContainerEncryptedTest extends AbstractCardTestBase { + +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("1234".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.java new file mode 100644 index 00000000..112556a6 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.java @@ -0,0 +1,55 @@ +/* +* Copyright 2009 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.test.ecard; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.DummyPINGUI; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.test.AbstractCardTestBase; + +public class ECardG3InfoboxContainerTest extends AbstractCardTestBase { + +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new DummyPINGUI() { +      @Override +      public char[] providePIN(PinInfo pinSpec, int retries) +          throws CancelledException, InterruptedException { +        // must not require a PIN! +        fail(); +        return null; +      } +    }; +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } + +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardTestSuite.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InvalidTest.java index 3c275a8d..f5a78448 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardTestSuite.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3InvalidTest.java @@ -1,5 +1,5 @@  /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and  * Graz University of Technology  *  * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,16 +14,11 @@  * See the License for the specific language governing permissions and  * limitations under the License.  */ -package at.gv.egiz.smcc; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; +package at.gv.egiz.smcc.test.ecard; -import at.gv.egiz.smcc.acos.ACOSCardTestSuite; +import at.gv.egiz.smcc.test.AbstractInvalidCardTest; -@RunWith(Suite.class) -@SuiteClasses( { ACOSCardTestSuite.class, at.gv.egiz.smcc.starcos.STARCOSCardTest.class }) -public class CardTestSuite { +public class ECardG3InvalidTest extends AbstractInvalidCardTest {  } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.java new file mode 100644 index 00000000..5dfcfb21 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2009 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.test.ecard; + +import org.junit.Test; + +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.test.AbstractNotActivatedCardTest; + +public class ECardG3NotActivatedTest extends AbstractNotActivatedCardTest { + +  @Test(expected = NotActivatedException.class) +  public void getPINInfos() throws SignatureCardException { + +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    signatureCard.getPinInfos(); + +  } + +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3Test.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3Test.java new file mode 100644 index 00000000..d8528b62 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardG3Test.java @@ -0,0 +1,132 @@ +/* + * Copyright 2009 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.test.ecard; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.junit.Test; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PIN; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.ChangePINProvider; +import at.gv.egiz.smcc.pin.gui.InvalidChangePINProvider; +import at.gv.egiz.smcc.pin.gui.InvalidPINProvider; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; + + +public class ECardG3Test extends ECardTest { + +  @Test +  public void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException { + +    PINGUI pinProvider = new SMCCTestPINProvider("1234".toCharArray()); +     +    byte[] idlinkRef = (byte[]) applicationContext.getBean("identityLink", byte[].class); + +    byte[] idlink = signatureCard.getInfobox("IdentityLink", pinProvider, null); +     +    assertArrayEquals(idlinkRef, idlink); +     +  } +   +  @Test +  public void testChangePin() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    byte[] referenceData = { (byte) 0x26, (byte) 0x12, (byte) 0x34, +        (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }; +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +    PIN signaturPIN = (PIN) applicationContext.getBean("signaturPIN"); +    signaturPIN.setPin(referenceData); +    PIN kartenPIN = (PIN) applicationContext.getBean("kartenPIN"); +    kartenPIN.setPin(referenceData); + +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] pin = "123456".toCharArray(); + +      for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); +        char[] newPin = new char[i]; +        Arrays.fill(newPin, '0'); +        signatureCard +            .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); +        signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); +        pin = newPin; +      } +    } +  } + +  @Test +  public void testVerifyInvalidPin() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; + +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] invalidPin = "999999".toCharArray(); +      int numInvalidTries = 2; +      InvalidPINProvider invalidPinProvider = new InvalidPINProvider(invalidPin, numInvalidTries); +      try { +        signatureCard.verifyPIN(pinInfo, invalidPinProvider); +      } catch (CancelledException ex) { +      } finally { +        assertTrue(invalidPinProvider.getProvided() == numInvalidTries); +      } +    } +  } + +  @Test +  public void testChangeInvalidPin() throws CardNotSupportedException, +      LockedException, NotActivatedException, CancelledException, +      PINFormatException, SignatureCardException, InterruptedException { + +    PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) this.signatureCard; +     +    for (PinInfo pinInfo : signatureCard.getPinInfos()) { + +      char[] invalidPin = "999999".toCharArray(); +      int numInvalidTries = 2; +      InvalidChangePINProvider invalidPinProvider = +              new InvalidChangePINProvider(invalidPin, invalidPin, numInvalidTries); + +      try { +        signatureCard.changePIN(pinInfo, invalidPinProvider); +      } catch (CancelledException ex) { +      } finally { +        assertTrue(invalidPinProvider.getProvided() == numInvalidTries); +      } +    } +  } + +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardTest.java new file mode 100644 index 00000000..e95a1615 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/ecard/ECardTest.java @@ -0,0 +1,54 @@ +/* +* Copyright 2009 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.test.ecard; + +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.security.NoSuchAlgorithmException; + +import org.junit.Test; + +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.pin.gui.CancelChangePINProvider; +import at.gv.egiz.smcc.pin.gui.ModifyPINGUI; +import at.gv.egiz.smcc.test.AbstractCardTest; + +public abstract class ECardTest extends AbstractCardTest { + +  @Test +  public abstract void testGetInfoboxIdentityLink() throws SignatureCardException, InterruptedException; +   +  @Test(expected = SignatureCardException.class) +  public void testActivatePin() throws SignatureCardException, +      InterruptedException, CardNotSupportedException, +      NoSuchAlgorithmException, UnsupportedEncodingException { + +    assertTrue(signatureCard instanceof PINMgmtSignatureCard); + +    ModifyPINGUI pinProvider = new CancelChangePINProvider(); + +    PinInfo[] specs = ((PINMgmtSignatureCard) signatureCard).getPinInfos(); + +    ((PINMgmtSignatureCard) signatureCard).activatePIN(specs[0], pinProvider); +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayFactoryBean.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayFactoryBean.java new file mode 100644 index 00000000..91cb7cfb --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayFactoryBean.java @@ -0,0 +1,48 @@ +/* +* Copyright 2009 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.test.spring; + +import org.springframework.beans.factory.FactoryBean; + +public class ByteArrayFactoryBean implements FactoryBean { + +  private byte[] bytes; +   +  /** +   * @param bytes the bytes to set +   */ +  public void setBytes(byte[] bytes) { +    this.bytes = bytes; +  } + +  @Override +  public Object getObject() throws Exception { +    return bytes; +  } + +  @Override +  public Class<?> getObjectType() { +    return byte[].class; +  } + +  @Override +  public boolean isSingleton() { +    return false; +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyDependable.java index dd44d05b..dcae3391 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyDependable.java @@ -1,5 +1,5 @@  /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and  * Graz University of Technology  *  * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,19 +14,25 @@  * See the License for the specific language governing permissions and  * limitations under the License.  */ -package at.gv.egiz.smcc.acos; - -import at.gv.egiz.smcc.CardChannelEmul; -import at.gv.egiz.smcc.CardEmul; +package at.gv.egiz.smcc.test.spring; +public class ByteArrayPropertyDependable { +   +  private byte[] bytes; -public class A04CardEmul extends ACOSCardEmul { +  /** +   * @return the bytes +   */ +  public byte[] getBytes() { +    return bytes; +  } -  public A04CardEmul(A04ApplSIG applSIG, A04ApplDEC applDEC) { -    channel = new A04CardChannelEmul(this); -    applications.add(applSIG); -    applications.add(applDEC); +  /** +   * @param bytes the bytes to set +   */ +  public void setBytes(byte[] bytes) { +    this.bytes = bytes;    } -   +  } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditor.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditor.java new file mode 100644 index 00000000..78dd3f88 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditor.java @@ -0,0 +1,49 @@ +/* +* Copyright 2009 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.test.spring; + +import java.beans.PropertyEditorSupport; +import java.io.ByteArrayOutputStream; + +public class ByteArrayPropertyEditor extends PropertyEditorSupport { + +  @Override +  public void setAsText(String text) throws IllegalArgumentException { +     +    ByteArrayOutputStream os = new ByteArrayOutputStream(); +     +    int hi = 0, n = 0; +    for (int i = 0; i < text.length(); i++) { +      int digit = Character.digit(text.charAt(i), 16); +      if (digit != -1) { +        if (n++ % 2 == 0) { +          hi = digit << 4;  +        } else { +          os.write(hi + digit); +        } +      } +    } +     +    if (n % 2 != 0) { +      throw new IllegalArgumentException(); +    } +     +    setValue(os.toByteArray()); +  } +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorRegistrar.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorRegistrar.java new file mode 100644 index 00000000..7a2bb30c --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorRegistrar.java @@ -0,0 +1,32 @@ +/* +* Copyright 2009 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.test.spring; + +import org.springframework.beans.PropertyEditorRegistrar; +import org.springframework.beans.PropertyEditorRegistry; + + +public class ByteArrayPropertyEditorRegistrar implements +    PropertyEditorRegistrar { + +  @Override +  public void registerCustomEditors(PropertyEditorRegistry registry) { +    registry.registerCustomEditor(byte[].class, new ByteArrayPropertyEditor()); +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorTest.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorTest.java new file mode 100644 index 00000000..6c10c705 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/ByteArrayPropertyEditorTest.java @@ -0,0 +1,53 @@ +/* +* Copyright 2009 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.test.spring; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; + + +public class ByteArrayPropertyEditorTest { + +  public byte[] bytes = { (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, +      (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, +      (byte) 0x09, (byte) 0x0a, (byte) 0x0b, (byte) 0x0c, (byte) 0x0d, +      (byte) 0x0e, (byte) 0x0f, (byte) 0xf0, (byte) 0xe0, (byte) 0xd0, +      (byte) 0xc0, (byte) 0xb0, (byte) 0xa0, (byte) 0x90, (byte) 0x80, +      (byte) 0x70, (byte) 0x60, (byte) 0x50, (byte) 0x40, (byte) 0x30, +      (byte) 0x20, (byte) 0x10, (byte) 0x00 }; +   +  @Test +  public void testByteArrayPropertyEditor() { +     +    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( +        "at/gv/egiz/smcc/spring/PropertyEditorTest.xml"); +     +    ByteArrayPropertyDependable testBean = (ByteArrayPropertyDependable) applicationContext +        .getBean("testBean", ByteArrayPropertyDependable.class); +    assertNotNull(testBean); +     +    assertArrayEquals(bytes, testBean.getBytes()); +     +    System.out.println("" + byte[].class); +     +  } +   +   +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/CertificateFileFactoryBean.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/CertificateFileFactoryBean.java new file mode 100644 index 00000000..8bfd5bd4 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/CertificateFileFactoryBean.java @@ -0,0 +1,118 @@ +/* +* Copyright 2009 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.test.spring; + +import org.springframework.beans.factory.FactoryBean; + +import at.gv.egiz.smcc.File; + +public class CertificateFileFactoryBean implements FactoryBean { + +  private byte[] fid; +   +  private byte[] fcx; +   +  private byte[] certificate; +   +  private int fileSize; +   +  /** +   * @return the certificate +   */ +  public byte[] getCertificate() { +    return certificate; +  } + +  /** +   * @param certificate the certificate to set +   */ +  public void setCertificate(byte[] certificate) { +    this.certificate = certificate; +  } + +  /** +   * @return the fid +   */ +  public byte[] getFid() { +    return fid; +  } + +  /** +   * @param fid the fid to set +   */ +  public void setFid(byte[] fid) { +    this.fid = fid; +  } + +  /** +   * @return the fcx +   */ +  public byte[] getFcx() { +    return fcx; +  } + +  /** +   * @param fcx the fcx to set +   */ +  public void setFcx(byte[] fcx) { +    this.fcx = fcx; +  } + +  /** +   * @return the fileSize +   */ +  public int getFileSize() { +    return fileSize; +  } + +  /** +   * @param fileSize the fileSize to set +   */ +  public void setFileSize(int fileSize) { +    this.fileSize = fileSize; +  } + +  @Override +  public Object getObject() throws Exception { + +    byte[] file = new byte[fileSize]; +     +    if (certificate != null) { +      System.arraycopy(certificate, 0, file, 0, Math.min(certificate.length, file.length)); +    } +     +    File f = new File(); +    f.setFile(file); +    f.setFid(fid); +    f.setFcx(fcx); +     +    return f; +    +  } + +  @Override +  public Class<?> getObjectType() { +    return File.class; +  } + +  @Override +  public boolean isSingleton() { +    return false; +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/InfoboxContainerFileFactoryBean.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/InfoboxContainerFileFactoryBean.java new file mode 100644 index 00000000..6dbccc2a --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/InfoboxContainerFileFactoryBean.java @@ -0,0 +1,236 @@ +/* +* Copyright 2009 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.test.spring; + +import java.nio.charset.Charset; +import java.security.GeneralSecurityException; +import java.security.PublicKey; +import java.util.Arrays; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; + +import org.springframework.beans.factory.FactoryBean; + +import at.gv.egiz.smcc.File; + +public class InfoboxContainerFileFactoryBean implements FactoryBean { + +  private byte[] fid; +   +  private byte[] fcx; +   +  private int kid = -1; +   +  private PublicKey publicKey; +   +  private boolean container; +   +  private byte[] identityLink; +   +  private int fileSize; +   +  /** +   * @return the container +   */ +  public boolean isContainer() { +    return container; +  } + +  /** +   * @param container the container to set +   */ +  public void setContainer(boolean container) { +    this.container = container; +  } + +  /** +   * @return the identityLink +   */ +  public byte[] getIdentityLink() { +    return identityLink; +  } + +  /** +   * @param identityLink the identityLink to set +   */ +  public void setIdentityLink(byte[] identityLink) { +    this.identityLink = identityLink; +  } + +  /** +   * @return the fid +   */ +  public byte[] getFid() { +    return fid; +  } + +  /** +   * @param fid the fid to set +   */ +  public void setFid(byte[] fid) { +    this.fid = fid; +  } + +  /** +   * @return the fcx +   */ +  public byte[] getFcx() { +    return fcx; +  } + +  /** +   * @param fcx the fcx to set +   */ +  public void setFcx(byte[] fcx) { +    this.fcx = fcx; +  } + +  /** +   * @return the kid +   */ +  public int getKid() { +    return kid; +  } + +  /** +   * @param kid the kid to set +   */ +  public void setKid(int kid) { +    this.kid = kid; +  } + +  /** +   * @return the publicKey +   */ +  public PublicKey getPublicKey() { +    return publicKey; +  } + +  /** +   * @param publicKey the publicKey to set +   */ +  public void setPublicKey(PublicKey publicKey) { +    this.publicKey = publicKey; +  } + +  /** +   * @return the fileSize +   */ +  public int getFileSize() { +    return fileSize; +  } + +  /** +   * @param fileSize the fileSize to set +   */ +  public void setFileSize(int fileSize) { +    this.fileSize = fileSize; +  } + +  @Override +  public Object getObject() throws Exception { + +    byte[] file = new byte[fileSize]; +     +    if (container) { +       +      int offset = 0; +       +      // HEADER 'AIK' + version +      byte[] header = "AIK".getBytes(Charset.forName("ASCII")); +      System.arraycopy(header, 0, file, offset, header.length); +      offset += header.length; +      file[offset++] = 1;  +       +      // HEADER identity link +      file[offset++] = (byte) 0x01; // Personenbindung +      if (publicKey != null) { +        file[offset++] = (byte) 0x01; // Modifier + +        byte[] cipherText; +        byte[] encKey; +        try { +          KeyGenerator keyGenerator = KeyGenerator.getInstance("DESede"); +          SecretKey secretKey = keyGenerator.generateKey(); +           +          byte[] keyBytes = secretKey.getEncoded(); +           +          Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); +          byte[] iv = new byte[8]; +          Arrays.fill(iv, (byte) 0x00); +          IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); +          cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec); +          cipherText = cipher.doFinal(identityLink); +           +          cipher = Cipher.getInstance(publicKey.getAlgorithm()); +          cipher.init(Cipher.ENCRYPT_MODE, publicKey); +          encKey = cipher.doFinal(keyBytes); +           +        } catch (GeneralSecurityException e) { +          throw new RuntimeException(e); +        } +         +        int len = encKey.length + cipherText.length + 2; +         +        file[offset++] = (byte) (0xFF & len); +        file[offset++] = (byte) (0xFF & len >> 8); +         +        file[offset++] = (byte) (0xFF & encKey.length); +        file[offset++] = (byte) (0xFF & encKey.length >> 8); +         +        System.arraycopy(encKey, 0, file, offset, encKey.length); +        offset += encKey.length; +         +        System.arraycopy(cipherText, 0, file, offset, cipherText.length); +         +      } else { +        file[offset++] = (byte) 0x00; // Modifier +        file[offset++] = (byte) (0xFF & identityLink.length); +        file[offset++] = (byte) (0xFF & identityLink.length >> 8); +        System.arraycopy(identityLink, 0, file, offset, identityLink.length); +        offset += identityLink.length; +      } + +    } else if (identityLink != null) { +      System.arraycopy(identityLink, 0, file, 0, Math.min(identityLink.length, file.length)); +    } +     +    File f = new File(); +    f.setFile(file); +    f.setFid(fid); +    f.setFcx(fcx); +    f.setKid(kid); +     +    return f; +    +  } + +  @Override +  public Class<?> getObjectType() { +    return File.class; +  } + +  @Override +  public boolean isSingleton() { +    return false; +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PrivateKeyFactoryBean.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PrivateKeyFactoryBean.java new file mode 100644 index 00000000..6470b5ca --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PrivateKeyFactoryBean.java @@ -0,0 +1,62 @@ +/* +* Copyright 2009 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.test.spring; + +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.spec.PKCS8EncodedKeySpec; + +import org.springframework.beans.factory.FactoryBean; + +public class PrivateKeyFactoryBean implements FactoryBean { + +  private byte[] encodedKey; +   +  private String algorithm; + +  /** +   * @param encodedKey the encodedKey to set +   */ +  public void setEncodedKey(byte[] encodedKey) { +    this.encodedKey = encodedKey; +  } + +  /** +   * @param algorithm the algorithm to set +   */ +  public void setAlgorithm(String algorithm) { +    this.algorithm = algorithm; +  } + +  @Override +  public Object getObject() throws Exception { +    KeyFactory keyFactory = KeyFactory.getInstance(algorithm); +    return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(encodedKey)); +  } + +  @Override +  public Class<?> getObjectType() { +    return PrivateKey.class; +  } + +  @Override +  public boolean isSingleton() { +    return false; +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PublicKeyFactoryBean.java b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PublicKeyFactoryBean.java new file mode 100644 index 00000000..83b552cf --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/test/spring/PublicKeyFactoryBean.java @@ -0,0 +1,62 @@ +/* +* Copyright 2009 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.test.spring; + +import java.security.KeyFactory; +import java.security.PublicKey; +import java.security.spec.X509EncodedKeySpec; + +import org.springframework.beans.factory.FactoryBean; + +public class PublicKeyFactoryBean implements FactoryBean { + +  private byte[] encodedKey; +   +  private String algorithm; + +  /** +   * @param encodedKey the encodedKey to set +   */ +  public void setEncodedKey(byte[] encodedKey) { +    this.encodedKey = encodedKey; +  } + +  /** +   * @param algorithm the algorithm to set +   */ +  public void setAlgorithm(String algorithm) { +    this.algorithm = algorithm; +  } + +  @Override +  public Object getObject() throws Exception { +    KeyFactory keyFactory = KeyFactory.getInstance(algorithm); +    return keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); +  } + +  @Override +  public Class<?> getObjectType() { +    return PublicKey.class; +  } + +  @Override +  public boolean isSingleton() { +    return false; +  } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/util/ISO7816UtilsTest.java b/smcc/src/test/java/at/gv/egiz/smcc/util/ISO7816UtilsTest.java index 679f2c02..b629f133 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/util/ISO7816UtilsTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/util/ISO7816UtilsTest.java @@ -16,20 +16,15 @@  */  package at.gv.egiz.smcc.util; +import static org.junit.Assert.assertTrue; +  import java.util.Arrays;  import javax.smartcardio.CommandAPDU; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore;  import org.junit.Test;  import at.gv.egiz.smcc.VerifyAPDUSpec; -import at.gv.egiz.smcc.util.ISO7816Utils; -import static org.junit.Assert.*;  public class ISO7816UtilsTest { @@ -156,20 +151,5 @@ public class ISO7816UtilsTest {      assertTrue(Arrays.equals(apdu.getBytes(), ref));    } -   -  private String toString(byte[] b) { -    StringBuffer sb = new StringBuffer(); -    if (b != null && b.length > 0) { -      sb.append(Integer.toHexString((b[0] & 240) >> 4)); -      sb.append(Integer.toHexString(b[0] & 15)); -    } -    for (int i = 1; i < b.length; i++) { -      sb.append(':'); -      sb.append(Integer.toHexString((b[i] & 240) >> 4)); -      sb.append(Integer.toHexString(b[i] & 15)); -    } -    return sb.toString(); -  } -  } diff --git a/smcc/src/test/resources/IdentityLink.bin b/smcc/src/test/resources/IdentityLink.binBinary files differ deleted file mode 100644 index 16c7375b..00000000 --- a/smcc/src/test/resources/IdentityLink.bin +++ /dev/null diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/spring/PropertyEditorTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/spring/PropertyEditorTest.xml new file mode 100644 index 00000000..32d9d58a --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/spring/PropertyEditorTest.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +  <!-- +    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. +  --> +<beans xmlns="http://www.springframework.org/schema/beans" +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" +  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> + +	<bean name="testBean" class="at.gv.egiz.smcc.test.spring.ByteArrayPropertyDependable"> +		<property name="bytes"> +			<value> +			   00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F +				 f0-e0-d0-c0-b0-a0-90-80-70-60-50-40-30-20-10-00 +      </value> +		</property> +	</bean> + +	<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> +	    <property name="propertyEditorRegistrars"> +	        <list> +	            <bean class="at.gv.egiz.smcc.test.spring.ByteArrayPropertyEditorRegistrar"></bean> +	        </list> +	    </property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOS.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOS.xml new file mode 100644 index 00000000..0dfb8ea5 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOS.xml @@ -0,0 +1,342 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <bean name="privateKeyDEC" class="at.gv.egiz.smcc.test.spring.PrivateKeyFactoryBean"> +    <property name="algorithm" value="RSA" /> +    <property name="encodedKey"> +      <value> +				30:82:03:97:02:01:00:30 0d:06:09:2a:86:48:86:f7 +				0d:01:01:01:05:00:04:82 03:81:30:82:03:7d:02:01 +				00:02:81:c1:00:8e:e9:1a 66:1e:0d:12:65:f1:63:5f +				b7:e4:57:57:5b:c4:5d:98 5e:32:36:ca:82:45:1d:41 +				36:66:2c:bb:35:95:96:22 01:0c:01:07:fd:d1:7c:34 +				70:7c:47:91:e2:72:14:97 54:2e:c3:de:c4:79:0d:e6 +				cc:61:2f:0b:48:36:3e:8b 36:ec:46:a9:55:c2:28:c9 +				c4:13:ba:ca:34:d0:a0:ae 4e:06:c9:30:f4:68:4d:d1 +				d2:ff:a5:6a:81:03:6d:e0 7b:35:c4:1a:d3:89:5f:09 +				51:6a:61:7c:75:21:6e:4e 3a:70:38:2c:11:07:37:b6 +				16:15:ea:82:9e:42:71:9c f1:fe:dd:49:6a:fd:ce:69 +				91:7c:65:5d:d5:ca:a0:90 b5:06:5a:4b:a4:b2:d6:6d +				95:65:eb:e8:ba:33:88:c1 18:f6:2d:ea:0d:d3:26:a4 +				f5:10:31:7e:5a:e2:f6:5e 55:82:29:ba:8d:2c:47:5d +				99:5c:cc:41:27:02:03:01 00:01:02:81:c0:3b:6d:9a +				09:bf:13:66:84:38:06:40 06:a3:90:e2:86:09:b9:76 +				24:2d:b3:75:31:08:f6:aa 68:a9:c2:8e:33:31:3a:56 +				77:a2:fb:46:cc:78:f1:b2 88:d8:55:96:c7:d8:f2:d1 +				1f:33:b7:46:0a:e3:e0:31 0a:ea:9a:fa:91:13:e5:9c +				54:c1:9a:7c:ce:69:c8:36 67:30:61:2b:b7:1c:ce:c4 +				cd:33:ab:34:8d:5e:56:86 1b:bd:2d:97:84:dc:a6:aa +				38:da:cc:c3:58:37:fa:3e d6:75:b2:19:0c:ea:70:fa +				fe:48:fe:5c:f4:3c:c2:a5 5c:a3:dc:52:1c:62:ec:a2 +				be:4d:34:78:b1:fd:75:ce 87:49:18:9c:2d:f1:a4:d6 +				dc:46:75:5c:56:33:82:65 54:05:1c:45:a1:b1:1c:d8 +				6e:58:82:40:66:e4:29:de cc:63:dc:b1:19:d1:b6:b3 +				ad:90:58:09:c8:8a:a6:0e 17:99:1d:0a:e1:02:61:00 +				f6:6c:1b:3c:78:41:f9:13 3f:0d:be:de:21:84:a2:d2 +				96:a7:70:30:f1:4c:01:94 86:aa:7c:70:0b:14:11:80 +				d5:21:e6:c7:82:3d:23:ce 92:c7:20:98:3a:13:ed:e7 +				7f:47:1b:2c:85:92:f5:ee 8f:b2:73:4b:c5:77:88:df +				23:54:35:bc:08:1b:07:4d 48:ee:2e:8a:ef:c9:f1:9d +				8e:74:32:e1:23:ef:3f:f7 ff:32:a2:61:db:a6:c1:b7 +				02:61:00:94:77:0e:f5:c7 f2:b3:a4:22:94:2e:f2:f4 +				9d:ec:fc:3e:ba:74:59:48 b2:87:36:83:9f:d9:ed:32 +				1a:4a:85:1c:97:d8:db:4a 81:13:04:5a:f2:e1:ef:98 +				c1:fa:4a:93:cd:a1:f8:fc 9b:4f:40:bd:3e:7a:69:17 +				3b:6f:06:c8:6a:55:eb:fb ca:c1:13:40:e0:ef:44:b4 +				ca:cf:91:ba:37:4a:70:eb a4:2e:a8:c9:1c:33:98:e7 +				41:bc:11:02:61:00:a9:e1 05:35:be:c1:dc:70:04:3b +				f9:a5:30:fe:3b:31:6a:62 ab:d9:51:bf:d0:27:10:5f +				5f:c1:ee:21:3b:9f:d1:4e b9:c6:38:66:e5:d4:77:23 +				87:b8:e9:f0:eb:45:78:5d 10:c2:b4:a3:07:a0:1a:b8 +				2e:fb:c1:7a:12:85:a1:d9 5f:e1:ec:c4:95:58:16:3a +				fd:23:13:03:e8:e9:71:57 71:eb:fb:d5:e8:07:93:8a +				d8:9f:15:c9:f4:29:02:60 53:19:ad:22:ff:8f:26:e4 +				29:82:be:20:b9:b1:27:f4 2c:fc:5a:a1:9b:22:6a:b2 +				a5:cc:34:c4:22:b6:3a:9d f5:5a:3d:44:c9:98:23:d7 +				dd:3c:74:20:93:65:88:3e 74:2a:b6:8d:d2:7e:f0:46 +				71:66:e6:47:aa:7c:56:f1 f9:fe:23:27:da:a1:2b:9f +				26:42:81:4a:f8:d3:48:89 ee:2c:82:9b:60:1a:5f:0f +				94:ba:17:5b:6f:9e:08:b1 02:61:00:d1:0a:b8:9e:b6 +				03:a2:56:10:18:4a:3f:b7 c6:ca:46:7a:89:8e:e8:e5 +				6f:a9:3f:a8:27:75:f0:85 8d:92:8e:f1:54:e3:0e:82 +				0f:d4:a9:e3:90:c9:da:f0 5d:2e:2a:ed:c4:a4:6f:79 +				e9:4b:dd:19:c2:a3:85:96 48:9b:ec:ad:51:a6:7b:cd +				01:bb:a5:a0:03:14:0a:30 69:43:c4:ba:d1:32:30:5d +				84:be:ad:61:32:cc:3c:cb e5:20:fd        +      </value> +    </property> +  </bean> +   +  <bean name="publicKeyDEC" class="at.gv.egiz.smcc.test.spring.PublicKeyFactoryBean"> +    <property name="algorithm" value="RSA" /> +    <property name="encodedKey"> +      <value> +				30:81:df:30:0d:06:09:2a 86:48:86:f7:0d:01:01:01 +				05:00:03:81:cd:00:30:81 c9:02:81:c1:00:8e:e9:1a +				66:1e:0d:12:65:f1:63:5f b7:e4:57:57:5b:c4:5d:98 +				5e:32:36:ca:82:45:1d:41 36:66:2c:bb:35:95:96:22 +				01:0c:01:07:fd:d1:7c:34 70:7c:47:91:e2:72:14:97 +				54:2e:c3:de:c4:79:0d:e6 cc:61:2f:0b:48:36:3e:8b +				36:ec:46:a9:55:c2:28:c9 c4:13:ba:ca:34:d0:a0:ae +				4e:06:c9:30:f4:68:4d:d1 d2:ff:a5:6a:81:03:6d:e0 +				7b:35:c4:1a:d3:89:5f:09 51:6a:61:7c:75:21:6e:4e +				3a:70:38:2c:11:07:37:b6 16:15:ea:82:9e:42:71:9c +				f1:fe:dd:49:6a:fd:ce:69 91:7c:65:5d:d5:ca:a0:90 +				b5:06:5a:4b:a4:b2:d6:6d 95:65:eb:e8:ba:33:88:c1 +				18:f6:2d:ea:0d:d3:26:a4 f5:10:31:7e:5a:e2:f6:5e +				55:82:29:ba:8d:2c:47:5d 99:5c:cc:41:27:02:03:01 +				00:01                                           +      </value> +    </property> +  </bean> + +  <bean name="certificateSS" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +      <property name="bytes"> +        <value> +				30:82:05:2b:30:82:04:13 a0:03:02:01:02:02:03:02 +				05:52:30:0d:06:09:2a:86 48:86:f7:0d:01:01:05:05 +				00:30:81:a1:31:0b:30:09 06:03:55:04:06:13:02:41 +				54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +				75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +				65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +				6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +				65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +				03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +				6d:69:75:6d:2d:54:65:73 74:2d:53:69:67:2d:30:32 +				31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +				6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:53 +				69:67:2d:30:32:30:1e:17 0d:30:39:30:31:31:33:30 +				39:34:35:31:32:5a:17:0d 31:32:31:32:33:31:30:39 +				34:35:31:32:5a:30:70:31 0b:30:09:06:03:55:04:06 +				13:02:41:54:31:1f:30:1d 06:03:55:04:03:0c:16:58 +				58:58:4f:74:74:6f:20:58 58:58:4f:74:74:61:6b:72 +				69:6e:67:65:72:31:17:30 15:06:03:55:04:04:0c:0e +				58:58:58:4f:74:74:61:6b 72:69:6e:67:65:72:31:10 +				30:0e:06:03:55:04:2a:0c 07:58:58:58:4f:74:74:6f +				31:15:30:13:06:03:55:04 05:13:0c:39:37:30:30:31 +				36:38:36:36:31:37:34:30 59:30:13:06:07:2a:86:48 +				ce:3d:02:01:06:08:2a:86 48:ce:3d:03:01:01:03:42 +				00:04:6b:de:5f:5e:d5:2b be:1e:b9:82:19:75:f4:3b +				c1:34:e9:db:0b:25:31:33 fa:8b:72:d4:9f:21:f5:62 +				b9:f6:50:db:cc:bf:43:b9 5e:75:2a:37:be:32:a6:83 +				b1:5c:c3:9d:f0:ab:e6:8f e4:97:83:57:89:e0:13:e3 +				13:a8:a3:82:02:65:30:82 02:61:30:13:06:03:55:1d +				23:04:0c:30:0a:80:08:46 06:9f:8e:41:8e:15:bd:30 +				27:06:08:2b:06:01:05:05 07:01:03:01:01:ff:04:18 +				30:16:30:08:06:06:04:00 8e:46:01:01:30:0a:06:08 +				2b:06:01:05:05:07:0b:01 30:81:84:06:08:2b:06:01 +				05:05:07:01:01:04:78:30 76:30:2c:06:08:2b:06:01 +				05:05:07:30:01:86:20:68 74:74:70:3a:2f:2f:6f:63 +				73:70:2d:74:65:73:74:2e 61:2d:74:72:75:73:74:2e +				61:74:2f:6f:63:73:70:30 46:06:08:2b:06:01:05:05 +				07:30:02:86:3a:68:74:74 70:3a:2f:2f:77:77:77:2e +				61:2d:74:72:75:73:74:2e 61:74:2f:63:65:72:74:73 +				2f:61:2d:73:69:67:6e:2d 50:72:65:6d:69:75:6d:2d +				54:65:73:74:2d:53:69:67 2d:30:32:2e:63:72:74:30 +				81:9d:06:03:55:1d:20:04 81:95:30:81:92:30:81:85 +				06:06:2a:28:00:11:01:03 30:7b:30:3d:06:08:2b:06 +				01:05:05:07:02:01:16:31 68:74:74:70:3a:2f:2f:77 +				77:77:2e:61:2d:74:72:75 73:74:2e:61:74:2f:64:6f +				63:73:2f:63:70:2f:61:2d 73:69:67:6e:2d:70:72:65 +				6d:69:75:6d:2d:74:65:73 74:30:3a:06:08:2b:06:01 +				05:05:07:02:02:30:2e:1a 2c:44:69:65:73:65:73:20 +				5a:65:72:74:69:66:69:6b 61:74:20:64:69:65:6e:74 +				20:6e:75:72:20:7a:75:20 54:65:73:74:7a:77:65:63 +				6b:65:6e:20:21:30:08:06 06:04:00:8b:30:01:01:30 +				81:a4:06:03:55:1d:1f:04 81:9c:30:81:99:30:81:96 +				a0:81:93:a0:81:90:86:81 8d:6c:64:61:70:3a:2f:2f +				6c:64:61:70:2d:74:65:73 74:2e:61:2d:74:72:75:73 +				74:2e:61:74:2f:6f:75:3d 61:2d:73:69:67:6e:2d:50 +				72:65:6d:69:75:6d:2d:54 65:73:74:2d:53:69:67:2d +				30:32:2c:6f:3d:41:2d:54 72:75:73:74:2c:63:3d:41 +				54:3f:63:65:72:74:69:66 69:63:61:74:65:72:65:76 +				6f:63:61:74:69:6f:6e:6c 69:73:74:3f:62:61:73:65 +				3f:6f:62:6a:65:63:74:63 6c:61:73:73:3d:65:69:64 +				43:65:72:74:69:66:69:63 61:74:69:6f:6e:41:75:74 +				68:6f:72:69:74:79:30:11 06:03:55:1d:0e:04:0a:04 +				08:46:08:da:9e:68:f8:e5 81:30:0e:06:03:55:1d:0f +				01:01:ff:04:04:03:02:06 c0:30:25:06:03:55:1d:11 +				04:1e:30:1c:81:1a:74:68 6f:6d:61:73:2e:72:6f:65 +				73:73:6c:65:72:40:65:67 69:7a:2e:67:76:2e:61:74 +				30:09:06:03:55:1d:13:04 02:30:00:30:0d:06:09:2a +				86:48:86:f7:0d:01:01:05 05:00:03:82:01:01:00:d8 +				ec:e5:5c:17:42:e8:2f:04 1f:e2:04:57:07:30:dc:4f +				61:7d:d8:89:36:31:26:45 55:64:d3:55:1b:83:51:a0 +				39:1b:6a:7e:fa:7e:2c:d0 d3:86:7b:8d:29:8f:a3:83 +				d2:72:ce:43:cf:c1:27:f1 4d:11:e2:67:be:6e:34:7d +				04:1f:ba:55:34:ea:c2:cf 0f:64:7b:84:e0:55:05:82 +				dd:9d:d7:eb:91:78:69:49 58:70:ff:83:70:a0:b3:b7 +				3d:0f:8e:e9:1b:21:ef:31 0b:e3:ac:c6:0f:57:4f:d8 +				d6:b2:d0:ca:d9:6f:3f:6e 83:8c:ff:47:ca:bc:81:60 +				5f:e2:dd:bd:89:b2:52:ac c3:8b:44:99:70:e7:2c:52 +				21:aa:a2:0f:38:c6:98:4d 48:da:65:41:a4:ad:41:7c +				99:14:e5:cb:51:d7:ab:76 b1:20:ce:32:1b:11:5c:ef +				8b:4f:f3:46:5b:11:d7:91 b6:41:d3:23:b6:03:a8:98 +				40:76:13:5d:4c:b2:e9:fe 90:27:04:fc:10:45:8b:10 +				c3:b2:4b:3c:d2:5b:0f:e8 fb:b9:45:af:05:c4:ba:c7 +				fc:a5:7d:db:4f:a9:76:e2 fa:c7:e0:ad:70:aa:40:15 +				64:01:ba:c6:c3:83:65:95 3c:05:53:88:e7:19:98    +      </value> +    </property> +  </bean> +   +  <bean name="certificateGS" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +    <property name="bytes"> +      <value> +				30:82:05:7f:30:82:04:67 a0:03:02:01:02:02:03:02 +				05:51:30:0d:06:09:2a:86 48:86:f7:0d:01:01:05:05 +				00:30:81:a1:31:0b:30:09 06:03:55:04:06:13:02:41 +				54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +				75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +				65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +				6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +				65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +				03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +				6d:69:75:6d:2d:54:65:73 74:2d:45:6e:63:2d:30:32 +				31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +				6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:45 +				6e:63:2d:30:32:30:1e:17 0d:30:39:30:31:31:33:30 +				39:34:35:31:32:5a:17:0d 31:32:31:32:33:31:30:39 +				34:35:31:32:5a:30:70:31 0b:30:09:06:03:55:04:06 +				13:02:41:54:31:1f:30:1d 06:03:55:04:03:0c:16:58 +				58:58:4f:74:74:6f:20:58 58:58:4f:74:74:61:6b:72 +				69:6e:67:65:72:31:17:30 15:06:03:55:04:04:0c:0e +				58:58:58:4f:74:74:61:6b 72:69:6e:67:65:72:31:10 +				30:0e:06:03:55:04:2a:0c 07:58:58:58:4f:74:74:6f +				31:15:30:13:06:03:55:04 05:13:0c:39:37:30:30:31 +				36:38:36:36:31:37:34:30 81:df:30:0d:06:09:2a:86 +				48:86:f7:0d:01:01:01:05 00:03:81:cd:00:30:81:c9 +				02:81:c1:00:ae:e6:07:1d b9:56:0a:98:1a:de:52:f2 +				77:dc:5e:76:7f:e5:c1:79 b9:51:97:08:20:4e:a6:a3 +				ab:df:49:21:2b:65:4f:7c 26:e8:b9:47:df:03:0f:f7 +				4e:f4:47:3d:32:61:05:33 0f:dc:97:3e:bf:9b:f2:f8 +				b3:e2:c4:4d:e0:48:6a:1b d2:fe:fa:ee:24:08:dc:60 +				2a:78:6c:1d:d3:74:43:1f 1f:4e:d2:0f:89:3c:e3:1e +				fa:31:5a:c2:04:24:d1:e5 51:c4:94:26:d1:32:1e:df +				64:aa:af:2c:85:25:88:8f 80:e4:05:74:d5:da:69:88 +				4a:0c:6a:85:5f:67:51:6c 5c:1c:41:88:4c:ad:83:c9 +				10:97:45:00:3f:bd:1d:2f 28:2e:78:97:05:a5:41:42 +				37:08:60:0b:66:b1:b8:dd 98:03:03:33:c9:15:f7:5b +				35:a5:aa:7a:5e:e9:a7:60 ba:d8:0d:6d:b3:85:70:0e +				38:6f:f0:fd:02:03:01:00 01:a3:82:02:32:30:82:02 +				2e:30:13:06:03:55:1d:23 04:0c:30:0a:80:08:4b:5d +				02:5c:6d:58:24:67:30:81 84:06:08:2b:06:01:05:05 +				07:01:01:04:78:30:76:30 2c:06:08:2b:06:01:05:05 +				07:30:01:86:20:68:74:74 70:3a:2f:2f:6f:63:73:70 +				2d:74:65:73:74:2e:61:2d 74:72:75:73:74:2e:61:74 +				2f:6f:63:73:70:30:46:06 08:2b:06:01:05:05:07:30 +				02:86:3a:68:74:74:70:3a 2f:2f:77:77:77:2e:61:2d +				74:72:75:73:74:2e:61:74 2f:63:65:72:74:73:2f:61 +				2d:73:69:67:6e:2d:50:72 65:6d:69:75:6d:2d:54:65 +				73:74:2d:45:6e:63:2d:30 32:2e:63:72:74:30:81:93 +				06:03:55:1d:20:04:81:8b 30:81:88:30:81:85:06:06 +				2a:28:00:11:01:03:30:7b 30:3d:06:08:2b:06:01:05 +				05:07:02:01:16:31:68:74 74:70:3a:2f:2f:77:77:77 +				2e:61:2d:74:72:75:73:74 2e:61:74:2f:64:6f:63:73 +				2f:63:70:2f:61:2d:73:69 67:6e:2d:70:72:65:6d:69 +				75:6d:2d:74:65:73:74:30 3a:06:08:2b:06:01:05:05 +				07:02:02:30:2e:1a:2c:44 69:65:73:65:73:20:5a:65 +				72:74:69:66:69:6b:61:74 20:64:69:65:6e:74:20:6e +				75:72:20:7a:75:20:54:65 73:74:7a:77:65:63:6b:65 +				6e:20:21:30:81:a4:06:03 55:1d:1f:04:81:9c:30:81 +				99:30:81:96:a0:81:93:a0 81:90:86:81:8d:6c:64:61 +				70:3a:2f:2f:6c:64:61:70 2d:74:65:73:74:2e:61:2d +				74:72:75:73:74:2e:61:74 2f:6f:75:3d:61:2d:73:69 +				67:6e:2d:50:72:65:6d:69 75:6d:2d:54:65:73:74:2d +				45:6e:63:2d:30:32:2c:6f 3d:41:2d:54:72:75:73:74 +				2c:63:3d:41:54:3f:63:65 72:74:69:66:69:63:61:74 +				65:72:65:76:6f:63:61:74 69:6f:6e:6c:69:73:74:3f +				62:61:73:65:3f:6f:62:6a 65:63:74:63:6c:61:73:73 +				3d:65:69:64:43:65:72:74 69:66:69:63:61:74:69:6f +				6e:41:75:74:68:6f:72:69 74:79:30:11:06:03:55:1d +				0e:04:0a:04:08:4a:24:43 c0:85:2a:b4:51:30:0e:06 +				03:55:1d:0f:01:01:ff:04 04:03:02:04:b0:30:25:06 +				03:55:1d:11:04:1e:30:1c 81:1a:74:68:6f:6d:61:73 +				2e:72:6f:65:73:73:6c:65 72:40:65:67:69:7a:2e:67 +				76:2e:61:74:30:09:06:03 55:1d:13:04:02:30:00:30 +				0d:06:09:2a:86:48:86:f7 0d:01:01:05:05:00:03:82 +				01:01:00:4a:36:02:b3:ab 02:e9:e1:af:3f:d5:cd:3d +				51:08:b8:73:23:68:0c:22 32:cd:be:c8:77:bc:47:37 +				dd:89:7c:22:24:2f:23:ea 3e:c2:f4:59:78:a6:be:cd +				71:aa:b5:bc:e3:bc:3f:f1 fa:1a:43:2b:91:35:67:a5 +				62:9d:55:85:e0:3f:ed:00 67:80:6a:fb:46:8a:ed:48 +				03:e7:9d:5c:ac:df:ec:2d 53:8b:01:db:14:91:21:af +				a7:91:69:7e:97:68:cc:2a 06:1a:bc:53:35:de:d7:62 +				12:bd:54:b5:4c:3c:af:55 a4:5b:28:61:68:03:c6:72 +				c0:a2:3f:84:02:f8:3d:70 3f:de:9d:6a:71:16:87:9d +				93:3d:46:41:a9:6a:ca:87 d4:d1:3f:1d:6e:6a:bf:02 +				9b:fb:4a:47:e0:20:4a:2d 5a:0c:6b:25:d6:2d:d4:53 +				08:41:a9:16:a2:a0:ef:13 a8:ec:7e:99:15:f9:1a:18 +				5e:75:c7:5d:40:d4:84:4a d2:f7:7c:65:12:c7:ae:bc +				9d:3e:ce:42:fe:e4:98:10 63:0d:aa:2d:73:7d:46:19 +				ca:78:94:e5:11:83:87:b2 f7:59:90:47:86:57:cf:c7 +				7b:8f:ac:20:bd:46:ea:a2 10:e1:72:3e:e3:72:20:24 +				a5:2f:c5 +     </value> +    </property> +  </bean> + +	<bean name="identityLink" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +    <property name="bytes"> +      <value> +				30:82:02:11:02:01:01:0c 26:68:74:74:70:3a:2f:2f +				77:77:77:2e:61:2d:74:72 75:73:74:2e:61:74:2f:7a +				6d:72:2f:70:65:72:73:62 32:30:34:2e:78:73:6c:0c +				29:73:7a:72:2e:62:6d:69 2e:67:76:2e:61:74:2d:41 +				73:73:65:72:74:69:6f:6e 49:44:31:32:33:36:33:35 +				36:33:36:36:37:39:39:39 31:39:0c:19:32:30:30:39 +				2d:30:33:2d:30:36:54:31 36:3a:31:39:3a:32:36:2b +				30:31:3a:30:30:a0:42:30 40:0c:18:45:68:42:53:36 +				54:6f:31:49:6c:54:4b:4f 4a:45:39:75:62:74:48:69 +				51:3d:3d:0c:0a:58:58:58 c5:90:7a:67:c3:bc:72:0c +				0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:0c:0a:31 +				39:37:33:2d:30:36:2d:30 34:30:0a:a0:03:02:01:00 +				a0:03:02:01:01:03:82:01 01:00:9f:a5:68:a9:14:4c +				a4:5d:9d:09:99:2e:e7:45 2e:42:49:02:16:d9:cb:90 +				43:27:03:43:6d:b4:8c:dc 1c:77:d4:2e:a1:40:e7:e0 +				03:60:15:f7:db:03:5e:ca e4:35:ba:2b:fd:e6:b8:d8 +				b7:2a:80:dd:38:e0:8a:69 ad:67:60:65:42:c9:41:60 +				94:de:84:54:ad:b3:f4:f7 44:d5:f3:d3:b6:87:8a:22 +				38:00:cb:a4:4f:96:c2:28 c2:8d:91:95:b4:ea:00:59 +				2e:ec:78:d8:0f:26:04:ee ed:13:bf:81:68:81:43:be +				15:0e:ba:f9:6a:18:eb:95 ad:b4:0f:3c:94:63:32:81 +				90:cf:3f:95:ff:8d:86:ed e4:75:d5:09:32:17:38:b2 +				68:35:49:8c:a6:d0:3e:de 6e:47:68:bf:98:33:ae:59 +				9f:e0:19:9b:5b:1b:8f:74 d2:9c:01:1a:df:af:f8:96 +				91:cb:f8:bf:06:c7:d5:17 95:ef:c5:97:37:1b:b0:a1 +				4f:9f:01:82:90:4a:6a:04 db:31:1a:58:eb:cd:68:e3 +				68:0b:a0:11:44:08:a0:5c fc:61:15:1f:bb:22:87:18 +				a3:07:9b:0d:13:7c:ff:30 cf:f3:af:e4:45:05:a0:8e +				6b:ef:70:f5:4b:68:8f:61 d6:f5:a0:17:03:15:00:8e +				a8:df:a9:77:fd:9b:4b:91 89:34:84:f3:24:b2:5a:39 +				a9:f2:17:a1:17:03:15:00 db:a2:fd:a4:e7:65:2e:7e +				b0:c8:fa:4d:13:28:df:b1 58:3b:9e:29:a2:17:03:15 +				00:68:a0:17:18:b7:b3:c3 60:77:82:8d:f1:5e:10:c3 +				2d:78:2c:11:0b                                  +       </value> +    </property> +	</bean> + +	<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> +		<property name="propertyEditorRegistrars"> +			<list> +				<bean class="at.gv.egiz.smcc.test.spring.ByteArrayPropertyEditorRegistrar"></bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03.xml new file mode 100644 index 00000000..e750d1a1 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> +	<import resource="ACOSA03ApplSIG.xml" /> +	<import resource="ACOSA03ApplDEC.xml" /> + +	<bean name="acosA03" class="at.gv.egiz.smcc.CardEmul" +		abstract="true"> +		<property name="atr" +			value="3b:bf:11:00:81:31:fe:45:45:50:41:00:00:00:00:00:00:00:00:00:00:00:00:f1" /> +		<property name="basicChannel" ref="cardChannel" /> +		<property name="applications"> +			<list> +				<ref bean="applSIG" /> +				<ref bean="applDEC" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel" class="at.gv.egiz.smcc.acos.A03CardChannelEmul"> +		<property name="cardEmul" ref="card" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplDEC.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplDEC.xml new file mode 100644 index 00000000..91bc2722 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplDEC.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> + +	<bean name="applDEC" +		class="at.gv.egiz.smcc.acos.A03ApplDEC"> +		<property name="aid" value="a0:00:00:01:18:45:4e" /> +		<property name="fid" value="df:71" /> +		<property name="fcx" +			value="6f:1a:84:07:a0:00:00:01:18:4e:43:85:0f:50:0d:44:49:47:53:49:47:20:43:43:20:45:4e:43" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_CH_EKEY" /> +				<ref bean="EF_Infobox" /> +			</list> +		</property> +    <property name="pins"> +      <map> +        <entry key="0x81" value-ref="geheimhaltungsPIN" /> +        <entry key="0x83" value-ref="infoboxPIN" /> +      </map> +    </property> +	</bean> + +  <bean name="infoboxPIN" class="at.gv.egiz.smcc.PIN"> +    <property name="pin" value="30:30:30:30:00:00:00:00" /> +    <property name="kfpc" value="10" /> +  </bean> + +  <bean name="geheimhaltungsPIN" class="at.gv.egiz.smcc.PIN"> +    <property name="pin" value="31:32:33:34:00:00:00:00" /> +    <property name="kfpc" value="10" /> +  </bean> + +	<bean name="EF_C_CH_EKEY" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:01" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="6f:07:80:02:07:d0:82:01 01" /> +		<property name="certificate" ref="certificateGS" /> +	</bean> +	 +	 <bean name="EF_Infobox" +    class="at.gv.egiz.smcc.test.spring.InfoboxContainerFileFactoryBean"> +    <property name="fid" value="c0:02" /> +    <property name="fileSize" value="1500" /> +    <property name="fcx" +      value="6f:07:80:02:05:dc:82:01:01" /> +    <property name="identityLink" ref="identityLink"/> +  </bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplSIG.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplSIG.xml new file mode 100644 index 00000000..ef113311 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03ApplSIG.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> + +	<bean name="applSIG" class="at.gv.egiz.smcc.acos.A03ApplSIG"> +		<property name="aid" value="a0:00:00:01:18:45:43" /> +		<property name="fid" value="df:70" /> +		<property name="fcx" +			value="6f:1a:84:07:a0:00:00:01:18:45:43:85:0f:50:0d:44:49:47:53:49:47:20:43:43:20:45:43:43" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_CH_DS" /> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81" value-ref="signaturPIN" /> +			</map> +		</property> +	</bean> + +	<bean name="signaturPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="31:32:33:34:35:36:00:00" /> +		<property name="kfpc" value="3" /> +	</bean> + +	<bean name="EF_C_CH_DS" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:02" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="6f:07:80:02:07:d0:82:01:01" /> +		<property name="certificate" ref="certificateSS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03Test.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03Test.xml new file mode 100644 index 00000000..dd7218a6 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA03Test.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <import resource="ACOSA03.xml"/> + +  <bean name="card" parent="acosA03"/> +   +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04.xml new file mode 100644 index 00000000..12763029 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> +	<import resource="ACOSA04ApplSIG.xml" /> +	<import resource="ACOSA04ApplDEC.xml" /> + +	<bean name="acosA04" class="at.gv.egiz.smcc.CardEmul" +		abstract="true"> +		<property name="atr" +			value="3b:bf:11:00:81:31:fe:45:45:50:41:00:00:00:00:00:00:00:00:00:00:00:00:f1" /> +		<property name="basicChannel" ref="cardChannel" /> +		<property name="applications"> +			<list> +				<ref bean="applSIG" /> +				<ref bean="applDEC" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel" class="at.gv.egiz.smcc.acos.A04CardChannelEmul"> +		<property name="cardEmul" ref="card" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplDEC.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplDEC.xml new file mode 100644 index 00000000..eeaaeb69 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplDEC.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> + +	<bean name="applDEC" class="at.gv.egiz.smcc.acos.A04ApplDEC"> +		<property name="aid" value="a0:00:00:01:18:45:4e" /> +		<property name="fid" value="df:71" /> +		<property name="fcx" +			value="6f:1a:84:07:a0:00:00:01:18:4e:43:85:0f:50:0d:44:49:47:53:49:47:20:43:43:20:45:4e:43" /> +          <property name="privateKey" ref="privateKeyDEC" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_CH_EKEY" /> +				<ref bean="EF_Infobox" /> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81" value-ref="geheimhaltungsPIN" /> +			</map> +		</property> +	</bean> + +	<bean name="geheimhaltungsPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="31:32:33:34:00:00:00:00" /> +		<property name="kfpc" value="10" /> +	</bean> + +	<bean name="EF_C_CH_EKEY" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:01" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" value="6f:07:80:02:07:d0:82:01 01" /> +		<property name="certificate" ref="certificateGS" /> +	</bean> + +	<bean name="EF_Infobox" +		class="at.gv.egiz.smcc.test.spring.InfoboxContainerFileFactoryBean"> +		<property name="fid" value="c0:02" /> +		<property name="fileSize" value="1500" /> +		<property name="fcx" value="6f:07:80:02:05:dc:82:01:01" /> +		<property name="container" value="true" /> +		<property name="identityLink" ref="identityLink" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplSIG.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplSIG.xml new file mode 100644 index 00000000..a2ade8fc --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04ApplSIG.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOS.xml" /> + +	<bean name="applSIG" class="at.gv.egiz.smcc.acos.A04ApplSIG"> +		<property name="aid" value="a0:00:00:01:18:45:43" /> +		<property name="fid" value="df:70" /> +		<property name="fcx" +			value="6f:1a:84:07:a0:00:00:01:18:45:43:85:0f:50:0d:44:49:47:53:49:47:20:43:43:20:45:43:43" /> +		<property name="files"> +			<list> +        <ref bean="EF_INFO" /> +				<ref bean="EF_C_CH_DS" /> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81" value-ref="signaturPIN" /> +			</map> +		</property> +	</bean> + +	<bean name="signaturPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="31:32:33:34:35:36:00:00" /> +		<property name="kfpc" value="3" /> +	</bean> + +  <bean name="EF_INFO" class="at.gv.egiz.smcc.File"> +    <property name="fid" value="d0:02" /> +    <property name="fcx" +      value="6f:07:80:02:00:08:82:01:01:" /> +    <property name="file"> +      <value> +        02:00:00:00:00:00:00:00 +      </value> +    </property> +  </bean> + +	<bean name="EF_C_CH_DS" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:02" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="6f:07:80:02:07:d0:82:01:01" /> +		<property name="certificate" ref="certificateSS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.xml new file mode 100644 index 00000000..21a92a99 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InfoboxContainerEncryptedTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOSA04.xml" /> + +	<bean name="card" parent="acosA04"> +		<property name="applications"> +			<list> +				<ref bean="applDECInfoboxContainerEncrypted" /> +				<ref bean="applSIG" /> +			</list> +		</property> +	</bean> + +	<bean name="applDECInfoboxContainerEncrypted" parent="applDEC"> +		<property name="files"> +			<list> +        <ref bean="EF_C_CH_EKEY" /> +				<bean parent="EF_Infobox"> +					<property name="kid" value="-1" /> +					<property name="container" value="true" /> +					<property name="publicKey" ref="publicKeyDEC" /> +				</bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InvalidTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InvalidTest.xml new file mode 100644 index 00000000..c661892c --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04InvalidTest.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOSA04.xml" /> + +	<bean name="card" parent="acosA04"> +		<property name="applications"> +			<list> +				<ref bean="applDEC_invalid" /> +				<ref bean="applSIG_invalid" /> +			</list> +		</property> +	</bean> + +	<bean name="applDEC_invalid" parent="applDEC"> +		<property name="files"> +			<list> +				<bean class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +					<property name="fid" value="c0:01" /> +					<property name="fileSize" value="2000" /> +					<property name="fcx" value="6f:07:80:02:07:d0:82:01 01" /> +					<property name="certificate"> +						<value> +							75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +							65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +							6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +							65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +							03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +							6d:69:75:6d:2d:54:65:73 74:2d:45:6e:63:2d:30:32 +							31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +							6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:45 +							6e:63:2d:30:32:30:1e:17 0d:30:39:30:31:31:33:30 +							39:34:35:31:32:5a:17:0d 31:32:31:32:33:31:30:39 +							34:35:31:32:5a:30:70:31 0b:30:09:06:03:55:04:06 +							13:02:41:54:31:1f:30:1d 06:03:55:04:03:0c:16:58 +							58:58:4f:74:74:6f:20:58 58:58:4f:74:74:61:6b:72 +							69:6e:67:65:72:31:17:30 15:06:03:55:04:04:0c:0e +							58:58:58:4f:74:74:61:6b 72:69:6e:67:65:72:31:10 +							30:0e:06:03:55:04:2a:0c 07:58:58:58:4f:74:74:6f +							31:15:30:13:06:03:55:04 05:13:0c:39:37:30:30:31 +							36:38:36:36:31:37:34:30 81:df:30:0d:06:09:2a:86 +							48:86:f7:0d:01:01:01:05 00:03:81:cd:00:30:81:c9 +							02:81:c1:00:ae:e6:07:1d b9:56:0a:98:1a:de:52:f2 +							77:dc:5e:76:7f:e5:c1:79 b9:51:97:08:20:4e:a6:a3 +							ab:df:49:21:2b:65:4f:7c 26:e8:b9:47:df:03:0f:f7 +							4e:f4:47:3d:32:61:05:33 0f:dc:97:3e:bf:9b:f2:f8 +							b3:e2:c4:4d:e0:48:6a:1b d2:fe:fa:ee:24:08:dc:60 +							2a:78:6c:1d:d3:74:43:1f 1f:4e:d2:0f:89:3c:e3:1e +							fa:31:5a:c2:04:24:d1:e5 51:c4:94:26:d1:32:1e:df +							64:aa:af:2c:85:25:88:8f 80:e4:05:74:d5:da:69:88 +							4a:0c:6a:85:5f:67:51:6c 5c:1c:41:88:4c:ad:83:c9 +							10:97:45:00:3f:bd:1d:2f 28:2e:78:97:05:a5:41:42 +							37:08:60:0b:66:b1:b8:dd 98:03:03:33:c9:15:f7:5b +							35:a5:aa:7a:5e:e9:a7:60 ba:d8:0d:6d:b3:85:70:0e +							38:6f:f0:fd:02:03:01:00 01:a3:82:02:32:30:82:02 +							2e:30:13:06:03:55:1d:23 04:0c:30:0a:80:08:4b:5d +							02:5c:6d:58:24:67:30:81 84:06:08:2b:06:01:05:05 +							07:01:01:04:78:30:76:30 2c:06:08:2b:06:01:05:05 +							07:30:01:86:20:68:74:74 70:3a:2f:2f:6f:63:73:70 +							2d:74:65:73:74:2e:61:2d 74:72:75:73:74:2e:61:74 +							2f:6f:63:73:70:30:46:06 08:2b:06:01:05:05:07:30 +							02:86:3a:68:74:74:70:3a 2f:2f:77:77:77:2e:61:2d +							74:72:75:73:74:2e:61:74 2f:63:65:72:74:73:2f:61 +							2d:73:69:67:6e:2d:50:72 65:6d:69:75:6d:2d:54:65 +							73:74:2d:45:6e:63:2d:30 32:2e:63:72:74:30:81:93 +							06:03:55:1d:20:04:81:8b 30:81:88:30:81:85:06:06 +							2a:28:00:11:01:03:30:7b 30:3d:06:08:2b:06:01:05 +							05:07:02:01:16:31:68:74 74:70:3a:2f:2f:77:77:77 +							2e:61:2d:74:72:75:73:74 2e:61:74:2f:64:6f:63:73 +							2f:63:70:2f:61:2d:73:69 67:6e:2d:70:72:65:6d:69 +							75:6d:2d:74:65:73:74:30 3a:06:08:2b:06:01:05:05 +							07:02:02:30:2e:1a:2c:44 69:65:73:65:73:20:5a:65 +							72:74:69:66:69:6b:61:74 20:64:69:65:6e:74:20:6e +							75:72:20:7a:75:20:54:65 73:74:7a:77:65:63:6b:65 +							6e:20:21:30:81:a4:06:03 55:1d:1f:04:81:9c:30:81 +							99:30:81:96:a0:81:93:a0 81:90:86:81:8d:6c:64:61 +							70:3a:2f:2f:6c:64:61:70 2d:74:65:73:74:2e:61:2d +							74:72:75:73:74:2e:61:74 2f:6f:75:3d:61:2d:73:69 +							67:6e:2d:50:72:65:6d:69 75:6d:2d:54:65:73:74:2d +							45:6e:63:2d:30:32:2c:6f 3d:41:2d:54:72:75:73:74 +							2c:63:3d:41:54:3f:63:65 72:74:69:66:69:63:61:74 +							65:72:65:76:6f:63:61:74 69:6f:6e:6c:69:73:74:3f +							62:61:73:65:3f:6f:62:6a 65:63:74:63:6c:61:73:73 +							3d:65:69:64:43:65:72:74 69:66:69:63:61:74:69:6f +							6e:41:75:74:68:6f:72:69 74:79:30:11:06:03:55:1d +							0e:04:0a:04:08:4a:24:43 c0:85:2a:b4:51:30:0e:06 +							03:55:1d:0f:01:01:ff:04 04:03:02:04:b0:30:25:06 +							03:55:1d:11:04:1e:30:1c 81:1a:74:68:6f:6d:61:73 +							2e:72:6f:65:73:73:6c:65 72:40:65:67:69:7a:2e:67 +							76:2e:61:74:30:09:06:03 55:1d:13:04:02:30:00:30 +							0d:06:09:2a:86:48:86:f7 0d:01:01:05:05:00:03:82 +							01:01:00:4a:36:02:b3:ab 02:e9:e1:af:3f:d5:cd:3d +							51:08:b8:73:23:68:0c:22 32:cd:be:c8:77:bc:47:37 +							dd:89:7c:22:24:2f:23:ea 3e:c2:f4:59:78:a6:be:cd +							71:aa:b5:bc:e3:bc:3f:f1 fa:1a:43:2b:91:35:67:a5 +							62:9d:55:85:e0:3f:ed:00 67:80:6a:fb:46:8a:ed:48 +							03:e7:9d:5c:ac:df:ec:2d 53:8b:01:db:14:91:21:af +							a7:91:69:7e:97:68:cc:2a 06:1a:bc:53:35:de:d7:62 +							12:bd:54:b5:4c:3c:af:55 a4:5b:28:61:68:03:c6:72 +							c0:a2:3f:84:02:f8:3d:70 3f:de:9d:6a:71:16:87:9d +							93:3d:46:41:a9:6a:ca:87 d4:d1:3f:1d:6e:6a:bf:02 +							9b:fb:4a:47:e0:20:4a:2d 5a:0c:6b:25:d6:2d:d4:53 +							08:41:a9:16:a2:a0:ef:13 a8:ec:7e:99:15:f9:1a:18 +							5e:75:c7:5d:40:d4:84:4a d2:f7:7c:65:12:c7:ae:bc +							9d:3e:ce:42:fe:e4:98:10 63:0d:aa:2d:73:7d:46:19 +							ca:78:94:e5:11:83:87:b2 f7:59:90:47:86:57:cf:c7 +							7b:8f:ac:20:bd:46:ea:a2 10:e1:72:3e:e3:72:20:24 +							a5:2f:c5 +					  </value> +					</property> +				</bean> +				<bean +					class="at.gv.egiz.smcc.test.spring.InfoboxContainerFileFactoryBean"> +					<property name="fid" value="c0:02" /> +					<property name="fileSize" value="1500" /> +					<property name="fcx" value="6f:07:80:02:05:dc:82:01:01" /> +					<property name="identityLink"> +						<value> +							73:73:65:72:74:69:6f:6e 49:44:31:32:33:36:33:35 +							36:33:36:36:37:39:39:39 31:39:0c:19:32:30:30:39 +							2d:30:33:2d:30:36:54:31 36:3a:31:39:3a:32:36:2b +							30:31:3a:30:30:a0:42:30 40:0c:18:45:68:42:53:36 +							54:6f:31:49:6c:54:4b:4f 4a:45:39:75:62:74:48:69 +							51:3d:3d:0c:0a:58:58:58 c5:90:7a:67:c3:bc:72:0c +							0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:0c:0a:31 +							39:37:33:2d:30:36:2d:30 34:30:0a:a0:03:02:01:00 +							a0:03:02:01:01:03:82:01 01:00:9f:a5:68:a9:14:4c +							a4:5d:9d:09:99:2e:e7:45 2e:42:49:02:16:d9:cb:90 +							43:27:03:43:6d:b4:8c:dc 1c:77:d4:2e:a1:40:e7:e0 +							03:60:15:f7:db:03:5e:ca e4:35:ba:2b:fd:e6:b8:d8 +							b7:2a:80:dd:38:e0:8a:69 ad:67:60:65:42:c9:41:60 +							94:de:84:54:ad:b3:f4:f7 44:d5:f3:d3:b6:87:8a:22 +							38:00:cb:a4:4f:96:c2:28 c2:8d:91:95:b4:ea:00:59 +							2e:ec:78:d8:0f:26:04:ee ed:13:bf:81:68:81:43:be +							15:0e:ba:f9:6a:18:eb:95 ad:b4:0f:3c:94:63:32:81 +							90:cf:3f:95:ff:8d:86:ed e4:75:d5:09:32:17:38:b2 +							68:35:49:8c:a6:d0:3e:de 6e:47:68:bf:98:33:ae:59 +							9f:e0:19:9b:5b:1b:8f:74 d2:9c:01:1a:df:af:f8:96 +							91:cb:f8:bf:06:c7:d5:17 95:ef:c5:97:37:1b:b0:a1 +							4f:9f:01:82:90:4a:6a:04 db:31:1a:58:eb:cd:68:e3 +							68:0b:a0:11:44:08:a0:5c fc:61:15:1f:bb:22:87:18 +							a3:07:9b:0d:13:7c:ff:30 cf:f3:af:e4:45:05:a0:8e +							6b:ef:70:f5:4b:68:8f:61 d6:f5:a0:17:03:15:00:8e +							a8:df:a9:77:fd:9b:4b:91 89:34:84:f3:24:b2:5a:39 +							a9:f2:17:a1:17:03:15:00 db:a2:fd:a4:e7:65:2e:7e +							b0:c8:fa:4d:13:28:df:b1 58:3b:9e:29:a2:17:03:15 +							00:68:a0:17:18:b7:b3:c3 60:77:82:8d:f1:5e:10:c3 +							2d:78:2c:11:0b  +						</value> +					</property> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applSIG_invalid" parent="applSIG"> +		<property name="files"> +			<list> +				<ref bean="EF_INFO" /> +				<bean parent="EF_C_CH_DS"> +					<property name="certificate"> +						<value> +							75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +							65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +							6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +							65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +							03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +							6d:69:75:6d:2d:54:65:73 74:2d:53:69:67:2d:30:32 +							31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +							6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:53 +							69:67:2d:30:32:30:1e:17 0d:30:39:30:31:31:33:30 +							39:34:35:31:32:5a:17:0d 31:32:31:32:33:31:30:39 +							34:35:31:32:5a:30:70:31 0b:30:09:06:03:55:04:06 +							13:02:41:54:31:1f:30:1d 06:03:55:04:03:0c:16:58 +							58:58:4f:74:74:6f:20:58 58:58:4f:74:74:61:6b:72 +							69:6e:67:65:72:31:17:30 15:06:03:55:04:04:0c:0e +							58:58:58:4f:74:74:61:6b 72:69:6e:67:65:72:31:10 +							30:0e:06:03:55:04:2a:0c 07:58:58:58:4f:74:74:6f +							31:15:30:13:06:03:55:04 05:13:0c:39:37:30:30:31 +							36:38:36:36:31:37:34:30 59:30:13:06:07:2a:86:48 +							ce:3d:02:01:06:08:2a:86 48:ce:3d:03:01:01:03:42 +							00:04:6b:de:5f:5e:d5:2b be:1e:b9:82:19:75:f4:3b +							c1:34:e9:db:0b:25:31:33 fa:8b:72:d4:9f:21:f5:62 +							b9:f6:50:db:cc:bf:43:b9 5e:75:2a:37:be:32:a6:83 +							b1:5c:c3:9d:f0:ab:e6:8f e4:97:83:57:89:e0:13:e3 +							13:a8:a3:82:02:65:30:82 02:61:30:13:06:03:55:1d +							23:04:0c:30:0a:80:08:46 06:9f:8e:41:8e:15:bd:30 +							27:06:08:2b:06:01:05:05 07:01:03:01:01:ff:04:18 +							30:16:30:08:06:06:04:00 8e:46:01:01:30:0a:06:08 +							2b:06:01:05:05:07:0b:01 30:81:84:06:08:2b:06:01 +							05:05:07:01:01:04:78:30 76:30:2c:06:08:2b:06:01 +							05:05:07:30:01:86:20:68 74:74:70:3a:2f:2f:6f:63 +							73:70:2d:74:65:73:74:2e 61:2d:74:72:75:73:74:2e +							61:74:2f:6f:63:73:70:30 46:06:08:2b:06:01:05:05 +							07:30:02:86:3a:68:74:74 70:3a:2f:2f:77:77:77:2e +							61:2d:74:72:75:73:74:2e 61:74:2f:63:65:72:74:73 +							2f:61:2d:73:69:67:6e:2d 50:72:65:6d:69:75:6d:2d +							54:65:73:74:2d:53:69:67 2d:30:32:2e:63:72:74:30 +							81:9d:06:03:55:1d:20:04 81:95:30:81:92:30:81:85 +							06:06:2a:28:00:11:01:03 30:7b:30:3d:06:08:2b:06 +							01:05:05:07:02:01:16:31 68:74:74:70:3a:2f:2f:77 +							77:77:2e:61:2d:74:72:75 73:74:2e:61:74:2f:64:6f +							63:73:2f:63:70:2f:61:2d 73:69:67:6e:2d:70:72:65 +							6d:69:75:6d:2d:74:65:73 74:30:3a:06:08:2b:06:01 +							05:05:07:02:02:30:2e:1a 2c:44:69:65:73:65:73:20 +							5a:65:72:74:69:66:69:6b 61:74:20:64:69:65:6e:74 +							20:6e:75:72:20:7a:75:20 54:65:73:74:7a:77:65:63 +							6b:65:6e:20:21:30:08:06 06:04:00:8b:30:01:01:30 +							81:a4:06:03:55:1d:1f:04 81:9c:30:81:99:30:81:96 +							a0:81:93:a0:81:90:86:81 8d:6c:64:61:70:3a:2f:2f +							6c:64:61:70:2d:74:65:73 74:2e:61:2d:74:72:75:73 +							74:2e:61:74:2f:6f:75:3d 61:2d:73:69:67:6e:2d:50 +							72:65:6d:69:75:6d:2d:54 65:73:74:2d:53:69:67:2d +							30:32:2c:6f:3d:41:2d:54 72:75:73:74:2c:63:3d:41 +							54:3f:63:65:72:74:69:66 69:63:61:74:65:72:65:76 +							6f:63:61:74:69:6f:6e:6c 69:73:74:3f:62:61:73:65 +							3f:6f:62:6a:65:63:74:63 6c:61:73:73:3d:65:69:64 +							43:65:72:74:69:66:69:63 61:74:69:6f:6e:41:75:74 +							68:6f:72:69:74:79:30:11 06:03:55:1d:0e:04:0a:04 +							08:46:08:da:9e:68:f8:e5 81:30:0e:06:03:55:1d:0f +							01:01:ff:04:04:03:02:06 c0:30:25:06:03:55:1d:11 +							04:1e:30:1c:81:1a:74:68 6f:6d:61:73:2e:72:6f:65 +							73:73:6c:65:72:40:65:67 69:7a:2e:67:76:2e:61:74 +							30:09:06:03:55:1d:13:04 02:30:00:30:0d:06:09:2a +							86:48:86:f7:0d:01:01:05 05:00:03:82:01:01:00:d8 +							ec:e5:5c:17:42:e8:2f:04 1f:e2:04:57:07:30:dc:4f +							61:7d:d8:89:36:31:26:45 55:64:d3:55:1b:83:51:a0 +							39:1b:6a:7e:fa:7e:2c:d0 d3:86:7b:8d:29:8f:a3:83 +							d2:72:ce:43:cf:c1:27:f1 4d:11:e2:67:be:6e:34:7d +							04:1f:ba:55:34:ea:c2:cf 0f:64:7b:84:e0:55:05:82 +							dd:9d:d7:eb:91:78:69:49 58:70:ff:83:70:a0:b3:b7 +							3d:0f:8e:e9:1b:21:ef:31 0b:e3:ac:c6:0f:57:4f:d8 +							d6:b2:d0:ca:d9:6f:3f:6e 83:8c:ff:47:ca:bc:81:60 +							5f:e2:dd:bd:89:b2:52:ac c3:8b:44:99:70:e7:2c:52 +							21:aa:a2:0f:38:c6:98:4d 48:da:65:41:a4:ad:41:7c +							99:14:e5:cb:51:d7:ab:76 b1:20:ce:32:1b:11:5c:ef +							8b:4f:f3:46:5b:11:d7:91 b6:41:d3:23:b6:03:a8:98 +							40:76:13:5d:4c:b2:e9:fe 90:27:04:fc:10:45:8b:10 +							c3:b2:4b:3c:d2:5b:0f:e8 fb:b9:45:af:05:c4:ba:c7 +							fc:a5:7d:db:4f:a9:76:e2 fa:c7:e0:ad:70:aa:40:15 +							64:01:ba:c6:c3:83:65:95 3c:05:53:88:e7:19:98      +            </value> +					</property> +				</bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.xml new file mode 100644 index 00000000..f7ac0421 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04NotActivatedTest.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ACOSA04.xml" /> + +	<bean name="card" parent="acosA04"> +		<property name="applications"> +			<list> +				<ref bean="applDEC_notActivated" /> +				<ref bean="applSIG_notActivated" /> +			</list> +		</property> +	</bean> + +	<bean name="applDEC_notActivated" parent="applDEC"> +		<property name="files"> +			<list> +				<bean class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +					<property name="fid" value="c0:01" /> +					<property name="fileSize" value="2000" /> +					<property name="fcx" value="6f:07:80:02:07:d0:82:01 01" /> +					<property name="certificate" value="" /> +				</bean> +				<bean +					class="at.gv.egiz.smcc.test.spring.InfoboxContainerFileFactoryBean"> +					<property name="fid" value="c0:02" /> +					<property name="fileSize" value="1500" /> +					<property name="fcx" value="6f:07:80:02:05:dc:82:01:01" /> +					<property name="identityLink" value="" /> +				</bean> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81"> +					<bean class="at.gv.egiz.smcc.PIN"> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +	<bean name="applSIG_notActivated" parent="applSIG"> +		<property name="files"> +			<list> +				<ref bean="EF_INFO" /> +				<bean parent="EF_C_CH_DS"> +					<property name="certificate" value="" /> +				</bean> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81"> +					<bean class="at.gv.egiz.smcc.PIN"> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04Test.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04Test.xml new file mode 100644 index 00000000..97d0b560 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/acos/ACOSA04Test.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <import resource="ACOSA04.xml"/> + +  <bean name="card" parent="acosA04"/> +   +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECard.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECard.xml new file mode 100644 index 00000000..5b00b1a8 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECard.xml @@ -0,0 +1,323 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <bean name="privateKeyAUT" class="at.gv.egiz.smcc.test.spring.PrivateKeyFactoryBean"> +    <property name="algorithm" value="RSA" /> +    <property name="encodedKey"> +      <value> +				30:82:03:97:02:01:00:30 0d:06:09:2a:86:48:86:f7 +				0d:01:01:01:05:00:04:82 03:81:30:82:03:7d:02:01 +				00:02:81:c1:00:8e:e9:1a 66:1e:0d:12:65:f1:63:5f +				b7:e4:57:57:5b:c4:5d:98 5e:32:36:ca:82:45:1d:41 +				36:66:2c:bb:35:95:96:22 01:0c:01:07:fd:d1:7c:34 +				70:7c:47:91:e2:72:14:97 54:2e:c3:de:c4:79:0d:e6 +				cc:61:2f:0b:48:36:3e:8b 36:ec:46:a9:55:c2:28:c9 +				c4:13:ba:ca:34:d0:a0:ae 4e:06:c9:30:f4:68:4d:d1 +				d2:ff:a5:6a:81:03:6d:e0 7b:35:c4:1a:d3:89:5f:09 +				51:6a:61:7c:75:21:6e:4e 3a:70:38:2c:11:07:37:b6 +				16:15:ea:82:9e:42:71:9c f1:fe:dd:49:6a:fd:ce:69 +				91:7c:65:5d:d5:ca:a0:90 b5:06:5a:4b:a4:b2:d6:6d +				95:65:eb:e8:ba:33:88:c1 18:f6:2d:ea:0d:d3:26:a4 +				f5:10:31:7e:5a:e2:f6:5e 55:82:29:ba:8d:2c:47:5d +				99:5c:cc:41:27:02:03:01 00:01:02:81:c0:3b:6d:9a +				09:bf:13:66:84:38:06:40 06:a3:90:e2:86:09:b9:76 +				24:2d:b3:75:31:08:f6:aa 68:a9:c2:8e:33:31:3a:56 +				77:a2:fb:46:cc:78:f1:b2 88:d8:55:96:c7:d8:f2:d1 +				1f:33:b7:46:0a:e3:e0:31 0a:ea:9a:fa:91:13:e5:9c +				54:c1:9a:7c:ce:69:c8:36 67:30:61:2b:b7:1c:ce:c4 +				cd:33:ab:34:8d:5e:56:86 1b:bd:2d:97:84:dc:a6:aa +				38:da:cc:c3:58:37:fa:3e d6:75:b2:19:0c:ea:70:fa +				fe:48:fe:5c:f4:3c:c2:a5 5c:a3:dc:52:1c:62:ec:a2 +				be:4d:34:78:b1:fd:75:ce 87:49:18:9c:2d:f1:a4:d6 +				dc:46:75:5c:56:33:82:65 54:05:1c:45:a1:b1:1c:d8 +				6e:58:82:40:66:e4:29:de cc:63:dc:b1:19:d1:b6:b3 +				ad:90:58:09:c8:8a:a6:0e 17:99:1d:0a:e1:02:61:00 +				f6:6c:1b:3c:78:41:f9:13 3f:0d:be:de:21:84:a2:d2 +				96:a7:70:30:f1:4c:01:94 86:aa:7c:70:0b:14:11:80 +				d5:21:e6:c7:82:3d:23:ce 92:c7:20:98:3a:13:ed:e7 +				7f:47:1b:2c:85:92:f5:ee 8f:b2:73:4b:c5:77:88:df +				23:54:35:bc:08:1b:07:4d 48:ee:2e:8a:ef:c9:f1:9d +				8e:74:32:e1:23:ef:3f:f7 ff:32:a2:61:db:a6:c1:b7 +				02:61:00:94:77:0e:f5:c7 f2:b3:a4:22:94:2e:f2:f4 +				9d:ec:fc:3e:ba:74:59:48 b2:87:36:83:9f:d9:ed:32 +				1a:4a:85:1c:97:d8:db:4a 81:13:04:5a:f2:e1:ef:98 +				c1:fa:4a:93:cd:a1:f8:fc 9b:4f:40:bd:3e:7a:69:17 +				3b:6f:06:c8:6a:55:eb:fb ca:c1:13:40:e0:ef:44:b4 +				ca:cf:91:ba:37:4a:70:eb a4:2e:a8:c9:1c:33:98:e7 +				41:bc:11:02:61:00:a9:e1 05:35:be:c1:dc:70:04:3b +				f9:a5:30:fe:3b:31:6a:62 ab:d9:51:bf:d0:27:10:5f +				5f:c1:ee:21:3b:9f:d1:4e b9:c6:38:66:e5:d4:77:23 +				87:b8:e9:f0:eb:45:78:5d 10:c2:b4:a3:07:a0:1a:b8 +				2e:fb:c1:7a:12:85:a1:d9 5f:e1:ec:c4:95:58:16:3a +				fd:23:13:03:e8:e9:71:57 71:eb:fb:d5:e8:07:93:8a +				d8:9f:15:c9:f4:29:02:60 53:19:ad:22:ff:8f:26:e4 +				29:82:be:20:b9:b1:27:f4 2c:fc:5a:a1:9b:22:6a:b2 +				a5:cc:34:c4:22:b6:3a:9d f5:5a:3d:44:c9:98:23:d7 +				dd:3c:74:20:93:65:88:3e 74:2a:b6:8d:d2:7e:f0:46 +				71:66:e6:47:aa:7c:56:f1 f9:fe:23:27:da:a1:2b:9f +				26:42:81:4a:f8:d3:48:89 ee:2c:82:9b:60:1a:5f:0f +				94:ba:17:5b:6f:9e:08:b1 02:61:00:d1:0a:b8:9e:b6 +				03:a2:56:10:18:4a:3f:b7 c6:ca:46:7a:89:8e:e8:e5 +				6f:a9:3f:a8:27:75:f0:85 8d:92:8e:f1:54:e3:0e:82 +				0f:d4:a9:e3:90:c9:da:f0 5d:2e:2a:ed:c4:a4:6f:79 +				e9:4b:dd:19:c2:a3:85:96 48:9b:ec:ad:51:a6:7b:cd +				01:bb:a5:a0:03:14:0a:30 69:43:c4:ba:d1:32:30:5d +				84:be:ad:61:32:cc:3c:cb e5:20:fd        +      </value> +    </property> +  </bean> +   +  <bean name="publicKeyAUT" class="at.gv.egiz.smcc.test.spring.PublicKeyFactoryBean"> +    <property name="algorithm" value="RSA" /> +    <property name="encodedKey"> +      <value> +				30:81:df:30:0d:06:09:2a 86:48:86:f7:0d:01:01:01 +				05:00:03:81:cd:00:30:81 c9:02:81:c1:00:8e:e9:1a +				66:1e:0d:12:65:f1:63:5f b7:e4:57:57:5b:c4:5d:98 +				5e:32:36:ca:82:45:1d:41 36:66:2c:bb:35:95:96:22 +				01:0c:01:07:fd:d1:7c:34 70:7c:47:91:e2:72:14:97 +				54:2e:c3:de:c4:79:0d:e6 cc:61:2f:0b:48:36:3e:8b +				36:ec:46:a9:55:c2:28:c9 c4:13:ba:ca:34:d0:a0:ae +				4e:06:c9:30:f4:68:4d:d1 d2:ff:a5:6a:81:03:6d:e0 +				7b:35:c4:1a:d3:89:5f:09 51:6a:61:7c:75:21:6e:4e +				3a:70:38:2c:11:07:37:b6 16:15:ea:82:9e:42:71:9c +				f1:fe:dd:49:6a:fd:ce:69 91:7c:65:5d:d5:ca:a0:90 +				b5:06:5a:4b:a4:b2:d6:6d 95:65:eb:e8:ba:33:88:c1 +				18:f6:2d:ea:0d:d3:26:a4 f5:10:31:7e:5a:e2:f6:5e +				55:82:29:ba:8d:2c:47:5d 99:5c:cc:41:27:02:03:01 +				00:01                                           +      </value> +    </property> +  </bean> + +  <bean name="certificateSS" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +      <property name="bytes"> +        <value> +		    30:82:04:eb:30:82:03:d3 a0:03:02:01:02:02:03:02 +		    06:5e:30:0d:06:09:2a:86 48:86:f7:0d:01:01:05:05 +		    00:30:81:a1:31:0b:30:09 06:03:55:04:06:13:02:41 +		    54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +		    75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +		    65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +		    6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +		    65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +		    03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +		    6d:69:75:6d:2d:54:65:73 74:2d:53:69:67:2d:30:32 +		    31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +		    6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:53 +		    69:67:2d:30:32:30:1e:17 0d:30:39:30:33:30:36:31 +		    35:32:32:33:37:5a:17:0d 31:32:30:33:30:36:31:35 +		    32:32:33:37:5a:30:72:31 0b:30:09:06:03:55:04:06 +		    13:02:41:54:31:20:30:1e 06:03:55:04:03:0c:17:58 +		    58:58:c5:90:7a:67:c3:bc 72:20:58:58:58:54:c3:bc +		    7a:65:6b:c3:a7:69:31:15 30:13:06:03:55:04:04:0c +		    0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:31:13:30 +		    11:06:03:55:04:2a:0c:0a 58:58:58:c5:90:7a:67:c3 +		    bc:72:31:15:30:13:06:03 55:04:05:13:0c:37:30:34 +		    38:37:31:30:35:30:30:30 38:30:49:30:13:06:07:2a +		    86:48:ce:3d:02:01:06:08 2a:86:48:ce:3d:03:01:01 +		    03:32:00:04:de:75:22:4c c4:d4:14:16:48:4a:65:9d +		    5a:39:71:11:1c:33:7e:7f b4:06:33:74:e6:f3:c2:56 +		    46:18:39:b9:c4:47:84:f5 46:41:60:78:81:45:4a:0f +		    67:77:77:b2:a3:82:02:33 30:82:02:2f:30:13:06:03 +		    55:1d:23:04:0c:30:0a:80 08:46:06:9f:8e:41:8e:15 +		    bd:30:27:06:08:2b:06:01 05:05:07:01:03:01:01:ff +		    04:18:30:16:30:08:06:06 04:00:8e:46:01:01:30:0a +		    06:08:2b:06:01:05:05:07 0b:01:30:81:84:06:08:2b +		    06:01:05:05:07:01:01:04 78:30:76:30:2c:06:08:2b +		    06:01:05:05:07:30:01:86 20:68:74:74:70:3a:2f:2f +		    6f:63:73:70:2d:74:65:73 74:2e:61:2d:74:72:75:73 +		    74:2e:61:74:2f:6f:63:73 70:30:46:06:08:2b:06:01 +		    05:05:07:30:02:86:3a:68 74:74:70:3a:2f:2f:77:77 +		    77:2e:61:2d:74:72:75:73 74:2e:61:74:2f:63:65:72 +		    74:73:2f:61:2d:73:69:67 6e:2d:50:72:65:6d:69:75 +		    6d:2d:54:65:73:74:2d:53 69:67:2d:30:32:2e:63:72 +		    74:30:81:92:06:03:55:1d 20:04:81:8a:30:81:87:30 +		    7b:06:06:2a:28:00:11:01 03:30:71:30:35:06:08:2b +		    06:01:05:05:07:02:01:16 29:68:74:74:70:3a:2f:2f +		    77:77:77:2e:61:2d:74:72 75:73:74:2e:61:74:2f:64 +		    6f:63:73:2f:63:70:2f:61 2d:73:69:67:6e:2d:74:65 +		    73:74:30:38:06:08:2b:06 01:05:05:07:02:02:30:2c +		    1a:2a:44:69:65:73:65:73 20:5a:65:72:74:69:66:69 +		    6b:61:74:20:64:69:65:6e 74:20:6e:75:72:20:7a:75 +		    20:54:65:73:74:7a:77:65 63:6b:65:6e:30:08:06:06 +		    04:00:8b:30:01:01:30:81 a4:06:03:55:1d:1f:04:81 +		    9c:30:81:99:30:81:96:a0 81:93:a0:81:90:86:81:8d +		    6c:64:61:70:3a:2f:2f:6c 64:61:70:2d:74:65:73:74 +		    2e:61:2d:74:72:75:73:74 2e:61:74:2f:6f:75:3d:61 +		    2d:73:69:67:6e:2d:50:72 65:6d:69:75:6d:2d:54:65 +		    73:74:2d:53:69:67:2d:30 32:2c:6f:3d:41:2d:54:72 +		    75:73:74:2c:63:3d:41:54 3f:63:65:72:74:69:66:69 +		    63:61:74:65:72:65:76:6f 63:61:74:69:6f:6e:6c:69 +		    73:74:3f:62:61:73:65:3f 6f:62:6a:65:63:74:63:6c +		    61:73:73:3d:65:69:64:43 65:72:74:69:66:69:63:61 +		    74:69:6f:6e:41:75:74:68 6f:72:69:74:79:30:11:06 +		    03:55:1d:0e:04:0a:04:08 47:64:6e:bb:92:a0:f6:f4 +		    30:0e:06:03:55:1d:0f:01 01:ff:04:04:03:02:06:c0 +		    30:09:06:03:55:1d:13:04 02:30:00:30:0d:06:09:2a +		    86:48:86:f7:0d:01:01:05 05:00:03:82:01:01:00:06 +		    63:76:0a:d5:54:fa:51:2a b0:41:dc:a4:9b:52:1c:0e +		    1d:65:46:2b:a3:cd:d4:46 36:40:c3:49:e8:a4:dc:01 +		    de:70:97:31:b0:cd:df:69 f8:c3:83:ee:c6:ed:e3:18 +		    1a:80:c1:30:a9:d6:b1:b8 a8:e0:3d:b1:8e:2c:c9:a6 +		    05:6e:4a:d2:b2:03:a4:2b a2:ad:ad:e5:ba:0d:54:8d +		    92:51:da:58:ed:d3:8d:61 a1:fc:49:f6:80:db:65:92 +		    e0:d5:23:69:0f:38:11:61 1e:cd:a2:8e:68:ec:70:fb +		    55:95:cb:b4:18:6b:3a:25 4a:3e:07:b0:18:26:51:39 +		    46:fa:e2:ae:e6:1c:d2:cb 28:a1:8b:56:bb:e9:6c:f7 +		    0b:84:dd:7f:64:8b:43:93 62:39:fb:91:fa:3a:57:56 +		    4a:aa:99:1e:9b:cc:a4:c0 18:46:ae:15:24:f5:f3:e6 +		    36:55:29:a8:a9:af:7b:44 19:da:66:4d:11:89:28:34 +		    01:15:24:93:43:6a:8f:e4 54:3a:3d:9b:2f:c3:db:7e +		    5e:12:00:aa:e7:c1:82:1c 1d:1d:23:1d:a3:cc:59:e4 +		    7a:f0:14:17:fb:96:90:c1 c0:de:db:91:fb:49:39:70 +		    76:2f:7b:22:cd:35:cb:ed 8f:b3:66:ae:95:49:75 +      </value> +    </property> +  </bean> +   +  <bean name="certificateGS" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +    <property name="bytes"> +      <value> +				30:82:04:98:30:82:03:80 a0:03:02:01:02:02:03:02 +				06:5f:30:0d:06:09:2a:86 48:86:f7:0d:01:01:05:05 +				00:30:81:95:31:0b:30:09 06:03:55:04:06:13:02:41 +				54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +				75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +				65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +				6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +				65:72:6b:65:68:72:20:47 6d:62:48:31:1d:30:1b:06 +				03:55:04:0b:0c:14:61:2d 73:69:67:6e:2d:74:6f:6b +				65:6e:2d:54:65:73:74:2d 30:33:31:1d:30:1b:06:03 +				55:04:03:0c:14:61:2d:73 69:67:6e:2d:74:6f:6b:65 +				6e:2d:54:65:73:74:2d:30 33:30:1e:17:0d:30:39:30 +				33:30:36:31:35:32:32:33 38:5a:17:0d:31:32:30:33 +				30:36:31:35:32:32:33:38 5a:30:72:31:0b:30:09:06 +				03:55:04:06:13:02:41:54 31:20:30:1e:06:03:55:04 +				03:0c:17:58:58:58:c5:90 7a:67:c3:bc:72:20:58:58 +				58:54:c3:bc:7a:65:6b:c3 a7:69:31:15:30:13:06:03 +				55:04:04:0c:0c:58:58:58 54:c3:bc:7a:65:6b:c3:a7 +				69:31:13:30:11:06:03:55 04:2a:0c:0a:58:58:58:c5 +				90:7a:67:c3:bc:72:31:15 30:13:06:03:55:04:05:13 +				0c:37:30:34:38:37:31:30 35:30:30:30:38:30:49:30 +				13:06:07:2a:86:48:ce:3d 02:01:06:08:2a:86:48:ce +				3d:03:01:01:03:32:00:04 02:55:51:f9:2a:ea:6f:d3 +				f5:da:a9:7a:22:fc:b4:38 e9:5c:dc:6b:86:a6:77:a7 +				90:f3:36:e0:c4:de:72:f2 1a:07:fa:d0:c8:1c:a0:c8 +				8b:5d:de:9e:f8:3b:7c:8c a3:82:01:ec:30:82:01:e8 +				30:13:06:03:55:1d:23:04 0c:30:0a:80:08:47:7e:5b +				db:37:33:b1:fa:30:7e:06 08:2b:06:01:05:05:07:01 +				01:04:72:30:70:30:2c:06 08:2b:06:01:05:05:07:30 +				01:86:20:68:74:74:70:3a 2f:2f:6f:63:73:70:2d:74 +				65:73:74:2e:61:2d:74:72 75:73:74:2e:61:74:2f:6f +				63:73:70:30:40:06:08:2b 06:01:05:05:07:30:02:86 +				34:68:74:74:70:3a:2f:2f 77:77:77:2e:61:2d:74:72 +				75:73:74:2e:61:74:2f:63 65:72:74:73:2f:61:2d:73 +				69:67:6e:2d:74:6f:6b:65 6e:2d:74:65:73:74:2d:30 +				33:2e:63:72:74:30:81:86 06:03:55:1d:20:04:7f:30 +				7d:30:7b:06:06:2a:28:00 11:01:03:30:71:30:35:06 +				08:2b:06:01:05:05:07:02 01:16:29:68:74:74:70:3a +				2f:2f:77:77:77:2e:61:2d 74:72:75:73:74:2e:61:74 +				2f:64:6f:63:73:2f:63:70 2f:61:2d:73:69:67:6e:2d +				74:65:73:74:30:38:06:08 2b:06:01:05:05:07:02:02 +				30:2c:1a:2a:44:69:65:73 65:73:20:5a:65:72:74:69 +				66:69:6b:61:74:20:64:69 65:6e:74:20:6e:75:72:20 +				7a:75:20:54:65:73:74:7a 77:65:63:6b:65:6e:30:81 +				99:06:03:55:1d:1f:04:81 91:30:81:8e:30:81:8b:a0 +				81:88:a0:81:85:86:81:82 6c:64:61:70:3a:2f:2f:6c +				64:61:70:2d:74:65:73:74 2e:61:2d:74:72:75:73:74 +				2e:61:74:2f:6f:75:3d:61 2d:73:69:67:6e:2d:74:6f +				6b:65:6e:2d:30:33:2c:6f 3d:41:2d:54:72:75:73:74 +				2c:63:3d:41:54:3f:63:65 72:74:69:66:69:63:61:74 +				65:72:65:76:6f:63:61:74 69:6f:6e:6c:69:73:74:3f +				62:61:73:65:3f:6f:62:6a 65:63:74:63:6c:61:73:73 +				3d:65:69:64:43:65:72:74 69:66:69:63:61:74:69:6f +				6e:41:75:74:68:6f:72:69 74:79:30:11:06:03:55:1d +				0e:04:0a:04:08:4a:43:51 30:45:fc:2a:00:30:0e:06 +				03:55:1d:0f:01:01:ff:04 04:03:02:04:b0:30:09:06 +				03:55:1d:13:04:02:30:00 30:0d:06:09:2a:86:48:86 +				f7:0d:01:01:05:05:00:03 82:01:01:00:31:dc:f3:43 +				79:dd:a9:2a:dc:21:f9:d9 8f:9a:4e:01:40:9a:f1:14 +				8d:3a:5e:88:36:45:1f:16 3e:eb:a2:ef:bf:55:bd:5e +				0e:19:c7:0c:bd:ed:df:b8 75:4e:6a:3a:9a:10:fa:49 +				c1:d2:35:c5:9a:d7:f4:f0 cd:13:d1:24:06:f8:1f:ea +				d6:7a:cb:4f:b5:3e:6c:b2 fc:e3:aa:2b:20:91:f5:5b +				f1:94:0e:06:0a:fd:25:71 11:fc:84:46:ef:5b:0b:a4 +				4a:5d:42:99:c8:4e:51:d8 63:d1:bd:00:a3:dd:8f:12 +				42:be:ca:15:37:4c:d2:c9 a7:37:b2:76:b7:34:92:98 +				60:e7:3d:55:a2:6c:b6:66 67:e1:e4:8f:e3:a5:b8:b5 +				c8:8f:9e:e3:f1:aa:8e:e6 e2:47:49:3d:be:8c:dd:ce +				8d:52:ac:b9:83:e9:9d:98 7b:da:2b:bc:83:cb:74:64 +				17:4c:33:bb:88:c2:dd:08 69:d8:a2:ac:95:71:d3:f8 +				c9:d1:d6:0e:c3:67:a1:db ca:58:aa:4b:ec:37:46:73 +				c3:a3:7b:1e:dd:f9:b3:bb e0:16:39:af:a0:19:9e:89 +				37:1e:6e:41:59:e1:86:ea 0b:39:03:89:d2:ba:d5:0c +				84:09:dd:c7:00:2c:2e:1a 69:eb:df:b1       +     </value> +    </property> +  </bean> + +	<bean name="identityLink" class="at.gv.egiz.smcc.test.spring.ByteArrayFactoryBean"> +    <property name="bytes"> +      <value> +		    30:82:02:11:02:01:01:0c 26:68:74:74:70:3a:2f:2f  +		    77:77:77:2e:61:2d:74:72 75:73:74:2e:61:74:2f:7a  +		    6d:72:2f:70:65:72:73:62 32:30:34:2e:78:73:6c:0c  +		    29:73:7a:72:2e:62:6d:69 2e:67:76:2e:61:74:2d:41  +		    73:73:65:72:74:69:6f:6e 49:44:31:32:33:36:33:35  +		    36:33:36:36:37:39:39:39 31:39:0c:19:32:30:30:39  +		    2d:30:33:2d:30:36:54:31 36:3a:31:39:3a:32:36:2b  +		    30:31:3a:30:30:a0:42:30 40:0c:18:45:68:42:53:36  +		    54:6f:31:49:6c:54:4b:4f 4a:45:39:75:62:74:48:69  +		    51:3d:3d:0c:0a:58:58:58 c5:90:7a:67:c3:bc:72:0c  +		    0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:0c:0a:31  +		    39:37:33:2d:30:36:2d:30 34:30:0a:a0:03:02:01:00  +		    a0:03:02:01:01:03:82:01 01:00:9f:a5:68:a9:14:4c  +		    a4:5d:9d:09:99:2e:e7:45 2e:42:49:02:16:d9:cb:90  +		    43:27:03:43:6d:b4:8c:dc 1c:77:d4:2e:a1:40:e7:e0  +		    03:60:15:f7:db:03:5e:ca e4:35:ba:2b:fd:e6:b8:d8  +		    b7:2a:80:dd:38:e0:8a:69 ad:67:60:65:42:c9:41:60  +		    94:de:84:54:ad:b3:f4:f7 44:d5:f3:d3:b6:87:8a:22  +		    38:00:cb:a4:4f:96:c2:28 c2:8d:91:95:b4:ea:00:59  +		    2e:ec:78:d8:0f:26:04:ee ed:13:bf:81:68:81:43:be  +		    15:0e:ba:f9:6a:18:eb:95 ad:b4:0f:3c:94:63:32:81  +		    90:cf:3f:95:ff:8d:86:ed e4:75:d5:09:32:17:38:b2  +		    68:35:49:8c:a6:d0:3e:de 6e:47:68:bf:98:33:ae:59  +		    9f:e0:19:9b:5b:1b:8f:74 d2:9c:01:1a:df:af:f8:96  +		    91:cb:f8:bf:06:c7:d5:17 95:ef:c5:97:37:1b:b0:a1  +		    4f:9f:01:82:90:4a:6a:04 db:31:1a:58:eb:cd:68:e3  +		    68:0b:a0:11:44:08:a0:5c fc:61:15:1f:bb:22:87:18  +		    a3:07:9b:0d:13:7c:ff:30 cf:f3:af:e4:45:05:a0:8e  +		    6b:ef:70:f5:4b:68:8f:61 d6:f5:a0:17:03:15:00:8e  +		    a8:df:a9:77:fd:9b:4b:91 89:34:84:f3:24:b2:5a:39  +		    a9:f2:17:a1:17:03:15:00 db:a2:fd:a4:e7:65:2e:7e  +		    b0:c8:fa:4d:13:28:df:b1 58:3b:9e:29:a2:17:03:15  +		    00:68:a0:17:18:b7:b3:c3 60:77:82:8d:f1:5e:10:c3  +		    2d:78:2c:11:0b +      </value> +    </property> +	</bean> + +	<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> +		<property name="propertyEditorRegistrars"> +			<list> +				<bean class="at.gv.egiz.smcc.test.spring.ByteArrayPropertyEditorRegistrar"></bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardApplInfobox.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardApplInfobox.xml new file mode 100644 index 00000000..2baa15da --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardApplInfobox.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <import resource="ECard.xml"/> + +  <bean name="applInfobox" class="at.gv.egiz.smcc.starcos.STARCOSApplInfobox"> +    <property name="aid" value="d0:40:00:00:17:00:18:01" /> +    <property name="fid" value="3f:06" /> +    <property name="fcx" +      value="6f:14:84:08:d0:40:00:00:17:00:18:01:a5:08:53:02:01:11:54:02:01:00" /> +    <property name="files"> +      <list> +        <ref bean="EF_Infobox"/> +      </list> +    </property> +  </bean> + +	<bean name="EF_Infobox" +		class="at.gv.egiz.smcc.test.spring.InfoboxContainerFileFactoryBean"> +		<property name="fid" value="ef:01" /> +		<property name="kid" value="1" /> +		<property name="fileSize" value="1500" /> +		<property name="fcx" +			value="6f:14:84:08:d0:40:00:00:17:00:18:01:a5:08:53:02:01:11:54:02:01:00" /> +	  <property name="identityLink" ref="identityLink"/> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2.xml new file mode 100644 index 00000000..986f26b3 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> +	<import resource="ECardApplInfobox.xml" /> +	<import resource="ECardG2ApplSichereSignatur.xml" /> +	<import resource="ECardG2ApplGewoehnlicheSignatur.xml" /> + +	<bean name="eCardG2" class="at.gv.egiz.smcc.CardEmul" +		abstract="true"> +		<property name="atr" +			value="3b:bd:18:00:81:31:fe:45:80:51:02:67:05:18:b1:02:02:02:01:81:05:31" /> +		<property name="basicChannel" ref="cardChannel" /> +		<property name="applications"> +			<list> +				<ref bean="applInfobox" /> +				<ref bean="applSichereSignatur" /> +				<ref bean="applGewoehnlicheSignatur" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel" class="at.gv.egiz.smcc.starcos.STARCOSCardChannelEmul"> +		<property name="cardEmul" ref="card" /> +		<property name="globalPins"> +			<map> +				<entry key="0x01" value-ref="kartenPIN" /> +			</map> +		</property> +		<property name="globalFiles"> +			<list> +				<ref bean="EF_VERSION" /> +			</list> +		</property> +	</bean> + +	<bean name="kartenPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="24:12:34:ff:ff:ff:ff:ff" /> +		<property name="kfpc" value="10" /> +	</bean> + + +	<bean name="EF_VERSION" class="at.gv.egiz.smcc.File"> +		<property name="fid" value="00:32" /> +		<property name="fcx" +			value="62:1a:80:02:00:14:82:05:44:41:00:14:01:83:02:00:32:88:01:d8:8a:01:05:a1 03:8b:01:03" /> +		<property name="file"> +			<value> +				a5:0e:53:02:01:10:54:08 01:01:03:01:04:01:70:01 +      </value> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplGewoehnlicheSignatur.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplGewoehnlicheSignatur.xml new file mode 100644 index 00000000..3b86fa72 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplGewoehnlicheSignatur.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> + +	<bean name="applGewoehnlicheSignatur" +		class="at.gv.egiz.smcc.starcos.STARCOSApplGewoehnlicheSignatur"> +		<property name="cardChannel" ref="cardChannel" /> +		<property name="aid" value="d0:40:00:00:17:00:13:01" /> +		<property name="fid" value="3f:05" /> +		<property name="fcx" +			value="6f:14:84:08:d0:40:00:00:17:00:13:01:a5:08:53:02:01:10:54:02:01:00" /> +	  <property name="privateKey" ref="privateKeyAUT" /> +		<property name="dst" value="84:03:80:02:00:89:03:13:35:10" /> +		<property name="ct" value="84:03:80:02:00:89:02:32:31" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_X509_CH_AUT" /> +			</list> +		</property> +	</bean> + +	<bean name="EF_C_X509_CH_AUT" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="2f:01" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="62:16:80:02:04:9c:82:01:01:83:02:2f:01:88:01:08:8a:01:05:a1:03:8b:01:08" /> +		<property name="certificate" ref="certificateGS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplSichereSignatur.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplSichereSignatur.xml new file mode 100644 index 00000000..39d357a7 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2ApplSichereSignatur.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> + +	<bean name="applSichereSignatur" class="at.gv.egiz.smcc.starcos.STARCOSG2ApplSichereSignatur"> +		<property name="cardChannel" ref="cardChannel" /> +		<property name="aid" value="d0:40:00:00:17:00:12:01" /> +		<property name="fid" value="3f:04" /> +		<property name="fcx" +			value="6f:16:84:08:d0:40:00:00:17:00:12:01:a5:0a:53:02:01:10:54:04:01:00:03:00" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_X509_CH_DS" /> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81" value-ref="signaturPIN" /> +			</map> +		</property> +	</bean> + +	<bean name="signaturPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="26:12:34:56:ff:ff:ff:ff" /> +		<property name="kfpc" value="3" /> +	</bean> + +	<bean name="EF_C_X509_CH_DS" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:00" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="62:16:80:02:04:ef:82:01:01:83:02:c0:00:88:01:08:8a:01:05:a1:03:8b:01:0e" /> +		<property name="certificate" ref="certificateSS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2Test.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2Test.xml new file mode 100644 index 00000000..0cc89920 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG2Test.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <import resource="ECardG2.xml"/> + +  <bean name="card" parent="eCardG2"/> +   +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3.xml new file mode 100644 index 00000000..81cdb3cd --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> +	<import resource="ECardApplInfobox.xml" /> +	<import resource="ECardG3ApplSichereSignatur.xml" /> +	<import resource="ECardG3ApplGewoehnlicheSignatur.xml" /> + +	<bean name="eCardG3" class="at.gv.egiz.smcc.CardEmul" +		abstract="true"> +    <property name="atr" +      value="3b:bd:18:00:81:31:fe:45:80:51:02:67:05:18:b1:02:02:02:01:81:05:31" /> +		<property name="basicChannel" ref="cardChannel" /> +		<property name="applications"> +			<list> +				<ref bean="applInfobox" /> +				<ref bean="applSichereSignatur" /> +				<ref bean="applGewoehnlicheSignatur" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel" class="at.gv.egiz.smcc.starcos.STARCOSCardChannelEmul"> +		<property name="cardEmul" ref="card" /> +		<property name="globalPins"> +			<map> +				<entry key="0x01" value-ref="kartenPIN" /> +			</map> +		</property> +		<property name="globalFiles"> +			<list> +				<ref bean="EF_VERSION" /> +			</list> +		</property> +	</bean> + +	<bean name="kartenPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="24:12:34:ff:ff:ff:ff:ff" /> +		<property name="kfpc" value="10" /> +	</bean> + + +	<bean name="EF_VERSION" class="at.gv.egiz.smcc.File"> +		<property name="fid" value="00:32" /> +		<property name="fcx" +			value="62:1a:80:02:00:14:82:05:44:41:00:14:01:83:02:00:32:88:01:d8:8a:01:05:a1 03:8b:01:03" /> +		<property name="file"> +			<value> +				a5:0e:53:02:01:20:54:08 01:01:03:01:04:01:70:01 +      </value> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.xml new file mode 100644 index 00000000..728255d1 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ActivateTest.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECardG3.xml" /> + +	<!-- +		NOTE: This defines a partly activated eCard G3. The certificate files +		have already been filled, but the PINs are not yet set. +	--> + +	<bean name="card" parent="eCardG3"> +		<property name="basicChannel" ref="cardChannel_notActivated" /> +		<property name="applications"> +			<list> +				<ref bean="applInfobox_notActivated" /> +				<ref bean="applSichereSignatur_notActivated" /> +				<ref bean="applGewoehnlicheSignatur" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel_notActivated" parent="cardChannel"> +		<property name="globalPins"> +			<map> +				<entry key="0x01"> +					<bean parent="kartenPIN"> +						<property name="pin" value="26:12:34:56:ff:ff:ff:ff" /> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +	<bean name="applInfobox_notActivated" parent="applInfobox"> +		<property name="files"> +			<list> +				<bean parent="EF_Infobox"> +					<property name="identityLink" value="" /> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applSichereSignatur_notActivated" parent="applSichereSignatur"> +		<property name="pins"> +			<map> +				<entry key="0x81"> +					<bean parent="signaturPIN"> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplGewoehnlicheSignatur.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplGewoehnlicheSignatur.xml new file mode 100644 index 00000000..e2c49c5d --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplGewoehnlicheSignatur.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> + +	<bean name="applGewoehnlicheSignatur" +		class="at.gv.egiz.smcc.starcos.STARCOSApplGewoehnlicheSignatur"> +		<property name="cardChannel" ref="cardChannel" /> +		<property name="aid" value="d0:40:00:00:17:00:13:01" /> +		<property name="fid" value="3f:05" /> +		<property name="fcx" +			value="6f:14:84:08:d0:40:00:00:17:00:13:01:a5:08:53:02:01:10:54:02:01:00" /> +	  <property name="privateKey" ref="privateKeyAUT" /> +		<property name="dst" value="84:03:80:02:00:80:01:04" /> +		<property name="ct" value="84:03:80:03:00:80:01:81" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_X509_CH_AUT" /> +			</list> +		</property> +	</bean> + +	<bean name="EF_C_X509_CH_AUT" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="2f:01" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="62:16:80:02:04:9c:82:01:01:83:02:2f:01:88:01:08:8a:01:05:a1:03:8b:01:08" /> +		<property name="certificate" ref="certificateGS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplSichereSignatur.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplSichereSignatur.xml new file mode 100644 index 00000000..aeacf649 --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3ApplSichereSignatur.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECard.xml" /> + +	<bean name="applSichereSignatur" class="at.gv.egiz.smcc.starcos.STARCOSG3ApplSichereSignatur"> +		<property name="cardChannel" ref="cardChannel" /> +		<property name="aid" value="d0:40:00:00:17:00:12:01" /> +		<property name="fid" value="3f:04" /> +		<property name="fcx" +			value="6f:16:84:08:d0:40:00:00:17:00:12:01:a5:0a:53:02:01:10:54:04:01:00:03:00" /> +		<property name="files"> +			<list> +				<ref bean="EF_C_X509_CH_DS" /> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81" value-ref="signaturPIN" /> +			</map> +		</property> +	</bean> + +	<bean name="signaturPIN" class="at.gv.egiz.smcc.PIN"> +		<property name="pin" value="26:12:34:56:ff:ff:ff:ff" /> +		<property name="kfpc" value="3" /> +	</bean> + +	<bean name="EF_C_X509_CH_DS" +		class="at.gv.egiz.smcc.test.spring.CertificateFileFactoryBean"> +		<property name="fid" value="c0:00" /> +		<property name="fileSize" value="2000" /> +		<property name="fcx" +			value="62:16:80:02:04:ef:82:01:01:83:02:c0:00:88:01:08:8a:01:05:a1:03:8b:01:0e" /> +		<property name="certificate" ref="certificateSS" /> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml new file mode 100644 index 00000000..951d903a --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerEncryptedTest.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECardG3.xml" /> + +	<bean name="card" parent="eCardG3"> +		<property name="applications"> +			<list> +				<ref bean="applInfoboxContainerEncrypted" /> +				<ref bean="applSichereSignatur" /> +				<ref bean="applGewoehnlicheSignatur" /> +			</list> +		</property> +	</bean> + +	<bean name="applInfoboxContainerEncrypted" parent="applInfobox"> +		<property name="files"> +			<list> +				<bean parent="EF_Infobox"> +					<property name="kid" value="-1" /> +					<property name="container" value="true" /> +					<property name="publicKey" ref="publicKeyAUT" /> +				</bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml new file mode 100644 index 00000000..0d872ffb --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InfoboxContainerTest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECardG3.xml" /> + +	<bean name="card" parent="eCardG3"> +		<property name="applications"> +			<list> +				<ref bean="applInfoboxContainer" /> +				<ref bean="applSichereSignatur" /> +				<ref bean="applGewoehnlicheSignatur" /> +			</list> +		</property> +	</bean> + +	<bean name="applInfoboxContainer" parent="applInfobox"> +		<property name="files"> +			<list> +				<bean parent="EF_Infobox"> +					<property name="kid" value="-1" /> +					<property name="container" value="true" /> +				</bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InvalidTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InvalidTest.xml new file mode 100644 index 00000000..a1dc7e5e --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3InvalidTest.xml @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECardG3.xml" /> + +	<bean name="card" parent="eCardG3"> +		<property name="applications"> +			<list> +				<ref bean="applInfobox_invalid" /> +				<ref bean="applSichereSignatur_invalid" /> +				<ref bean="applGewoehnlicheSignatur_invalid" /> +			</list> +		</property> +	</bean> + +	<bean name="applInfobox_invalid" parent="applInfobox"> +		<property name="files"> +			<list> +				<bean parent="EF_Infobox"> +					<property name="identityLink"> +						<value> +							73:73:65:72:74:69:6f:6e 49:44:31:32:33:36:33:35 +							36:33:36:36:37:39:39:39 31:39:0c:19:32:30:30:39 +							2d:30:33:2d:30:36:54:31 36:3a:31:39:3a:32:36:2b +							30:31:3a:30:30:a0:42:30 40:0c:18:45:68:42:53:36 +							54:6f:31:49:6c:54:4b:4f 4a:45:39:75:62:74:48:69 +							51:3d:3d:0c:0a:58:58:58 c5:90:7a:67:c3:bc:72:0c +							0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:0c:0a:31 +							39:37:33:2d:30:36:2d:30 34:30:0a:a0:03:02:01:00 +							a0:03:02:01:01:03:82:01 01:00:9f:a5:68:a9:14:4c +							a4:5d:9d:09:99:2e:e7:45 2e:42:49:02:16:d9:cb:90 +							43:27:03:43:6d:b4:8c:dc 1c:77:d4:2e:a1:40:e7:e0 +							03:60:15:f7:db:03:5e:ca e4:35:ba:2b:fd:e6:b8:d8 +							b7:2a:80:dd:38:e0:8a:69 ad:67:60:65:42:c9:41:60 +							94:de:84:54:ad:b3:f4:f7 44:d5:f3:d3:b6:87:8a:22 +							38:00:cb:a4:4f:96:c2:28 c2:8d:91:95:b4:ea:00:59 +							2e:ec:78:d8:0f:26:04:ee ed:13:bf:81:68:81:43:be +							15:0e:ba:f9:6a:18:eb:95 ad:b4:0f:3c:94:63:32:81 +							90:cf:3f:95:ff:8d:86:ed e4:75:d5:09:32:17:38:b2 +							68:35:49:8c:a6:d0:3e:de 6e:47:68:bf:98:33:ae:59 +							9f:e0:19:9b:5b:1b:8f:74 d2:9c:01:1a:df:af:f8:96 +							91:cb:f8:bf:06:c7:d5:17 95:ef:c5:97:37:1b:b0:a1 +							4f:9f:01:82:90:4a:6a:04 db:31:1a:58:eb:cd:68:e3 +							68:0b:a0:11:44:08:a0:5c fc:61:15:1f:bb:22:87:18 +							a3:07:9b:0d:13:7c:ff:30 cf:f3:af:e4:45:05:a0:8e +							6b:ef:70:f5:4b:68:8f:61 d6:f5:a0:17:03:15:00:8e +							a8:df:a9:77:fd:9b:4b:91 89:34:84:f3:24:b2:5a:39 +							a9:f2:17:a1:17:03:15:00 db:a2:fd:a4:e7:65:2e:7e +							b0:c8:fa:4d:13:28:df:b1 58:3b:9e:29:a2:17:03:15 +							00:68:a0:17:18:b7:b3:c3 60:77:82:8d:f1:5e:10:c3 +							2d:78:2c:11:0b +						</value> +					</property> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applSichereSignatur_invalid" parent="applSichereSignatur"> +		<property name="files"> +			<list> +				<bean parent="EF_C_X509_CH_DS"> +					<property name="certificate"> +						<value> +							54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +							75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +							65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +							6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +							65:72:6b:65:68:72:20:47 6d:62:48:31:23:30:21:06 +							03:55:04:0b:0c:1a:61:2d 73:69:67:6e:2d:50:72:65 +							6d:69:75:6d:2d:54:65:73 74:2d:53:69:67:2d:30:32 +							31:23:30:21:06:03:55:04 03:0c:1a:61:2d:73:69:67 +							6e:2d:50:72:65:6d:69:75 6d:2d:54:65:73:74:2d:53 +							69:67:2d:30:32:30:1e:17 0d:30:39:30:33:30:36:31 +							35:32:32:33:37:5a:17:0d 31:32:30:33:30:36:31:35 +							32:32:33:37:5a:30:72:31 0b:30:09:06:03:55:04:06 +							13:02:41:54:31:20:30:1e 06:03:55:04:03:0c:17:58 +							58:58:c5:90:7a:67:c3:bc 72:20:58:58:58:54:c3:bc +							7a:65:6b:c3:a7:69:31:15 30:13:06:03:55:04:04:0c +							0c:58:58:58:54:c3:bc:7a 65:6b:c3:a7:69:31:13:30 +							11:06:03:55:04:2a:0c:0a 58:58:58:c5:90:7a:67:c3 +							bc:72:31:15:30:13:06:03 55:04:05:13:0c:37:30:34 +							38:37:31:30:35:30:30:30 38:30:49:30:13:06:07:2a +							86:48:ce:3d:02:01:06:08 2a:86:48:ce:3d:03:01:01 +							03:32:00:04:de:75:22:4c c4:d4:14:16:48:4a:65:9d +							5a:39:71:11:1c:33:7e:7f b4:06:33:74:e6:f3:c2:56 +							46:18:39:b9:c4:47:84:f5 46:41:60:78:81:45:4a:0f +							67:77:77:b2:a3:82:02:33 30:82:02:2f:30:13:06:03 +							55:1d:23:04:0c:30:0a:80 08:46:06:9f:8e:41:8e:15 +							bd:30:27:06:08:2b:06:01 05:05:07:01:03:01:01:ff +							04:18:30:16:30:08:06:06 04:00:8e:46:01:01:30:0a +							06:08:2b:06:01:05:05:07 0b:01:30:81:84:06:08:2b +							06:01:05:05:07:01:01:04 78:30:76:30:2c:06:08:2b +							06:01:05:05:07:30:01:86 20:68:74:74:70:3a:2f:2f +							6f:63:73:70:2d:74:65:73 74:2e:61:2d:74:72:75:73 +							74:2e:61:74:2f:6f:63:73 70:30:46:06:08:2b:06:01 +							05:05:07:30:02:86:3a:68 74:74:70:3a:2f:2f:77:77 +							77:2e:61:2d:74:72:75:73 74:2e:61:74:2f:63:65:72 +							74:73:2f:61:2d:73:69:67 6e:2d:50:72:65:6d:69:75 +							6d:2d:54:65:73:74:2d:53 69:67:2d:30:32:2e:63:72 +							74:30:81:92:06:03:55:1d 20:04:81:8a:30:81:87:30 +							7b:06:06:2a:28:00:11:01 03:30:71:30:35:06:08:2b +							06:01:05:05:07:02:01:16 29:68:74:74:70:3a:2f:2f +							77:77:77:2e:61:2d:74:72 75:73:74:2e:61:74:2f:64 +							6f:63:73:2f:63:70:2f:61 2d:73:69:67:6e:2d:74:65 +							73:74:30:38:06:08:2b:06 01:05:05:07:02:02:30:2c +							1a:2a:44:69:65:73:65:73 20:5a:65:72:74:69:66:69 +							6b:61:74:20:64:69:65:6e 74:20:6e:75:72:20:7a:75 +							20:54:65:73:74:7a:77:65 63:6b:65:6e:30:08:06:06 +							04:00:8b:30:01:01:30:81 a4:06:03:55:1d:1f:04:81 +							9c:30:81:99:30:81:96:a0 81:93:a0:81:90:86:81:8d +							6c:64:61:70:3a:2f:2f:6c 64:61:70:2d:74:65:73:74 +							2e:61:2d:74:72:75:73:74 2e:61:74:2f:6f:75:3d:61 +							2d:73:69:67:6e:2d:50:72 65:6d:69:75:6d:2d:54:65 +							73:74:2d:53:69:67:2d:30 32:2c:6f:3d:41:2d:54:72 +							75:73:74:2c:63:3d:41:54 3f:63:65:72:74:69:66:69 +							63:61:74:65:72:65:76:6f 63:61:74:69:6f:6e:6c:69 +							73:74:3f:62:61:73:65:3f 6f:62:6a:65:63:74:63:6c +							61:73:73:3d:65:69:64:43 65:72:74:69:66:69:63:61 +							74:69:6f:6e:41:75:74:68 6f:72:69:74:79:30:11:06 +							03:55:1d:0e:04:0a:04:08 47:64:6e:bb:92:a0:f6:f4 +							30:0e:06:03:55:1d:0f:01 01:ff:04:04:03:02:06:c0 +							30:09:06:03:55:1d:13:04 02:30:00:30:0d:06:09:2a +							86:48:86:f7:0d:01:01:05 05:00:03:82:01:01:00:06 +							63:76:0a:d5:54:fa:51:2a b0:41:dc:a4:9b:52:1c:0e +							1d:65:46:2b:a3:cd:d4:46 36:40:c3:49:e8:a4:dc:01 +							de:70:97:31:b0:cd:df:69 f8:c3:83:ee:c6:ed:e3:18 +							1a:80:c1:30:a9:d6:b1:b8 a8:e0:3d:b1:8e:2c:c9:a6 +							05:6e:4a:d2:b2:03:a4:2b a2:ad:ad:e5:ba:0d:54:8d +							92:51:da:58:ed:d3:8d:61 a1:fc:49:f6:80:db:65:92 +							e0:d5:23:69:0f:38:11:61 1e:cd:a2:8e:68:ec:70:fb +							55:95:cb:b4:18:6b:3a:25 4a:3e:07:b0:18:26:51:39 +							46:fa:e2:ae:e6:1c:d2:cb 28:a1:8b:56:bb:e9:6c:f7 +							0b:84:dd:7f:64:8b:43:93 62:39:fb:91:fa:3a:57:56 +							4a:aa:99:1e:9b:cc:a4:c0 18:46:ae:15:24:f5:f3:e6 +							36:55:29:a8:a9:af:7b:44 19:da:66:4d:11:89:28:34 +							01:15:24:93:43:6a:8f:e4 54:3a:3d:9b:2f:c3:db:7e +							5e:12:00:aa:e7:c1:82:1c 1d:1d:23:1d:a3:cc:59:e4 +							7a:f0:14:17:fb:96:90:c1 c0:de:db:91:fb:49:39:70 +							76:2f:7b:22:cd:35:cb:ed 8f:b3:66:ae:95:49:75 +            </value> +					</property> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applGewoehnlicheSignatur_invalid" parent="applGewoehnlicheSignatur"> +		<property name="files"> +			<list> +				<bean parent="EF_C_X509_CH_AUT"> +					<property name="certificate"> +						<value> +							54:31:48:30:46:06:03:55 04:0a:0c:3f:41:2d:54:72 +							75:73:74:20:47:65:73:2e 20:66:2e:20:53:69:63:68 +							65:72:68:65:69:74:73:73 79:73:74:65:6d:65:20:69 +							6d:20:65:6c:65:6b:74:72 2e:20:44:61:74:65:6e:76 +							65:72:6b:65:68:72:20:47 6d:62:48:31:1d:30:1b:06 +							03:55:04:0b:0c:14:61:2d 73:69:67:6e:2d:74:6f:6b +							65:6e:2d:54:65:73:74:2d 30:33:31:1d:30:1b:06:03 +							55:04:03:0c:14:61:2d:73 69:67:6e:2d:74:6f:6b:65 +							6e:2d:54:65:73:74:2d:30 33:30:1e:17:0d:30:39:30 +							33:30:36:31:35:32:32:33 38:5a:17:0d:31:32:30:33 +							30:36:31:35:32:32:33:38 5a:30:72:31:0b:30:09:06 +							03:55:04:06:13:02:41:54 31:20:30:1e:06:03:55:04 +							03:0c:17:58:58:58:c5:90 7a:67:c3:bc:72:20:58:58 +							58:54:c3:bc:7a:65:6b:c3 a7:69:31:15:30:13:06:03 +							55:04:04:0c:0c:58:58:58 54:c3:bc:7a:65:6b:c3:a7 +							69:31:13:30:11:06:03:55 04:2a:0c:0a:58:58:58:c5 +							90:7a:67:c3:bc:72:31:15 30:13:06:03:55:04:05:13 +							0c:37:30:34:38:37:31:30 35:30:30:30:38:30:49:30 +							13:06:07:2a:86:48:ce:3d 02:01:06:08:2a:86:48:ce +							3d:03:01:01:03:32:00:04 02:55:51:f9:2a:ea:6f:d3 +							f5:da:a9:7a:22:fc:b4:38 e9:5c:dc:6b:86:a6:77:a7 +							90:f3:36:e0:c4:de:72:f2 1a:07:fa:d0:c8:1c:a0:c8 +							8b:5d:de:9e:f8:3b:7c:8c a3:82:01:ec:30:82:01:e8 +							30:13:06:03:55:1d:23:04 0c:30:0a:80:08:47:7e:5b +							db:37:33:b1:fa:30:7e:06 08:2b:06:01:05:05:07:01 +							01:04:72:30:70:30:2c:06 08:2b:06:01:05:05:07:30 +							01:86:20:68:74:74:70:3a 2f:2f:6f:63:73:70:2d:74 +							65:73:74:2e:61:2d:74:72 75:73:74:2e:61:74:2f:6f +							63:73:70:30:40:06:08:2b 06:01:05:05:07:30:02:86 +							34:68:74:74:70:3a:2f:2f 77:77:77:2e:61:2d:74:72 +							75:73:74:2e:61:74:2f:63 65:72:74:73:2f:61:2d:73 +							69:67:6e:2d:74:6f:6b:65 6e:2d:74:65:73:74:2d:30 +							33:2e:63:72:74:30:81:86 06:03:55:1d:20:04:7f:30 +							7d:30:7b:06:06:2a:28:00 11:01:03:30:71:30:35:06 +							08:2b:06:01:05:05:07:02 01:16:29:68:74:74:70:3a +							2f:2f:77:77:77:2e:61:2d 74:72:75:73:74:2e:61:74 +							2f:64:6f:63:73:2f:63:70 2f:61:2d:73:69:67:6e:2d +							74:65:73:74:30:38:06:08 2b:06:01:05:05:07:02:02 +							30:2c:1a:2a:44:69:65:73 65:73:20:5a:65:72:74:69 +							66:69:6b:61:74:20:64:69 65:6e:74:20:6e:75:72:20 +							7a:75:20:54:65:73:74:7a 77:65:63:6b:65:6e:30:81 +							99:06:03:55:1d:1f:04:81 91:30:81:8e:30:81:8b:a0 +							81:88:a0:81:85:86:81:82 6c:64:61:70:3a:2f:2f:6c +							64:61:70:2d:74:65:73:74 2e:61:2d:74:72:75:73:74 +							2e:61:74:2f:6f:75:3d:61 2d:73:69:67:6e:2d:74:6f +							6b:65:6e:2d:30:33:2c:6f 3d:41:2d:54:72:75:73:74 +							2c:63:3d:41:54:3f:63:65 72:74:69:66:69:63:61:74 +							65:72:65:76:6f:63:61:74 69:6f:6e:6c:69:73:74:3f +							62:61:73:65:3f:6f:62:6a 65:63:74:63:6c:61:73:73 +							3d:65:69:64:43:65:72:74 69:66:69:63:61:74:69:6f +							6e:41:75:74:68:6f:72:69 74:79:30:11:06:03:55:1d +							0e:04:0a:04:08:4a:43:51 30:45:fc:2a:00:30:0e:06 +							03:55:1d:0f:01:01:ff:04 04:03:02:04:b0:30:09:06 +							03:55:1d:13:04:02:30:00 30:0d:06:09:2a:86:48:86 +							f7:0d:01:01:05:05:00:03 82:01:01:00:31:dc:f3:43 +							79:dd:a9:2a:dc:21:f9:d9 8f:9a:4e:01:40:9a:f1:14 +							8d:3a:5e:88:36:45:1f:16 3e:eb:a2:ef:bf:55:bd:5e +							0e:19:c7:0c:bd:ed:df:b8 75:4e:6a:3a:9a:10:fa:49 +							c1:d2:35:c5:9a:d7:f4:f0 cd:13:d1:24:06:f8:1f:ea +							d6:7a:cb:4f:b5:3e:6c:b2 fc:e3:aa:2b:20:91:f5:5b +							f1:94:0e:06:0a:fd:25:71 11:fc:84:46:ef:5b:0b:a4 +							4a:5d:42:99:c8:4e:51:d8 63:d1:bd:00:a3:dd:8f:12 +							42:be:ca:15:37:4c:d2:c9 a7:37:b2:76:b7:34:92:98 +							60:e7:3d:55:a2:6c:b6:66 67:e1:e4:8f:e3:a5:b8:b5 +							c8:8f:9e:e3:f1:aa:8e:e6 e2:47:49:3d:be:8c:dd:ce +							8d:52:ac:b9:83:e9:9d:98 7b:da:2b:bc:83:cb:74:64 +							17:4c:33:bb:88:c2:dd:08 69:d8:a2:ac:95:71:d3:f8 +							c9:d1:d6:0e:c3:67:a1:db ca:58:aa:4b:ec:37:46:73 +							c3:a3:7b:1e:dd:f9:b3:bb e0:16:39:af:a0:19:9e:89 +							37:1e:6e:41:59:e1:86:ea 0b:39:03:89:d2:ba:d5:0c +							84:09:dd:c7:00:2c:2e:1a 69:eb:df:b1       +            </value> +					</property> +				</bean> +			</list> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.xml new file mode 100644 index 00000000..b60ae84c --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3NotActivatedTest.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" +	xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +	<import resource="ECardG3.xml" /> + +	<bean name="card" parent="eCardG3"> +		<property name="basicChannel" ref="cardChannel_notActivated" /> +		<property name="applications"> +			<list> +				<ref bean="applInfobox_notActivated" /> +				<ref bean="applSichereSignatur_notActivated" /> +				<ref bean="applGewoehnlicheSignatur_notActivated" /> +			</list> +		</property> +	</bean> + +	<bean name="cardChannel_notActivated" parent="cardChannel"> +		<property name="globalPins"> +			<map> +				<entry key="0x01"> +					<bean parent="kartenPIN"> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +	<bean name="applInfobox_notActivated" parent="applInfobox"> +		<property name="files"> +			<list> +				<bean parent="EF_Infobox"> +					<property name="identityLink" value="" /> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applGewoehnlicheSignatur_notActivated" parent="applGewoehnlicheSignatur"> +		<property name="files"> +			<list> +				<bean parent="EF_C_X509_CH_AUT"> +					<property name="certificate" value="" /> +				</bean> +			</list> +		</property> +	</bean> + +	<bean name="applSichereSignatur_notActivated" parent="applSichereSignatur"> +		<property name="files"> +			<list> +				<bean parent="EF_C_X509_CH_DS"> +					<property name="certificate" value="" /> +				</bean> +			</list> +		</property> +		<property name="pins"> +			<map> +				<entry key="0x81"> +					<bean parent="signaturPIN"> +						<property name="pin" value="26:12:34:56:ff:ff:ff:ff" /> +						<property name="state"> +							<util:constant static-field="at.gv.egiz.smcc.PIN.STATE_PIN_NOTACTIVE" /> +						</property> +					</bean> +				</entry> +			</map> +		</property> +	</bean> + +</beans>
\ No newline at end of file diff --git a/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3Test.xml b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3Test.xml new file mode 100644 index 00000000..7ce7cacf --- /dev/null +++ b/smcc/src/test/resources/at/gv/egiz/smcc/test/ecard/ECardG3Test.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +	<!-- +		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. +	--> +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" +	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"> + +  <import resource="ECardG3.xml"/> + +  <bean name="card" parent="eCardG3"/> +   +</beans>
\ No newline at end of file diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java b/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java index 88d49bad..a1b8a00d 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/HexDump.java @@ -32,14 +32,21 @@ public class HexDump {    public static void hexDump(InputStream is, Writer writer) throws IOException {
      hexDump(is, writer, 16);
    }
 +   +  public static void hexDump(InputStream is, Writer writer, int chunkSize) throws IOException { +    hexDump(is, writer, chunkSize, false); +  } -  public static void hexDump(InputStream is, Writer writer, int chunkSize) throws IOException {
 +  public static void hexDump(InputStream is, Writer writer, int chunkSize, boolean plain) throws IOException {
      byte[] chunk = new byte[chunkSize];
      long adr = 0;
      for (int l; (l = is.read(chunk)) != -1;) {
 +       +      if (!plain) {
 +        writer.append(String.format("[%06x]", adr)); +      } -      writer.append(String.format("[%06x]", adr));
        for (int i = 0; i < l; i++) {
          if (i % 8 == 0) {
            writer.append(" ");
 @@ -53,16 +60,18 @@ public class HexDump {        for (int i = 0; i < (chunkSize - l); i++) {
          writer.append("   ");
        }
 -      
 -      for (int i = 0; i < l; i++) {
 -        if (i % 8 == 0) {
 -          writer.append(" ");
 -        }
 -        if (chunk[i] > 31 && chunk[i] < 127) {
 -          writer.append((char) chunk[i]);
 -        } else {
 -          writer.append(".");
 -        }
 +       +      if (!plain) {
 +        for (int i = 0; i < l; i++) {
 +          if (i % 8 == 0) {
 +            writer.append(" ");
 +          }
 +          if (chunk[i] > 31 && chunk[i] < 127) {
 +            writer.append((char) chunk[i]);
 +          } else {
 +            writer.append(".");
 +          }
 +        }        }
        writer.append("\n");
 | 
