Skip to content

Commit

Permalink
Remove things
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Jan 27, 2016
1 parent 253b4b7 commit dd2d9ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/org/esteid/EstEID.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
// Instance of this class keeps state and throws EstEIDException if the response from card is not what it is supposed to be.
// Static methods can be used in a stateless manner.
// Methods throw CardException if card communication fails.
// This class requires some love.
public final class EstEID {

// Commands
Expand Down Expand Up @@ -192,7 +193,6 @@ public static enum CardType {
// Instance fields
private CardChannel channel = null;
private CardType type = null;
protected boolean strict = true;
private int currentFID = FID_3F00;

private EstEID(CardChannel c) {
Expand Down Expand Up @@ -524,9 +524,9 @@ public String toString() {
}

public void crypto_tests(String pin1, String pin2) throws WrongPINException, CardException {
Map<PIN, Byte> pins = getPINCounters();
if (strict && (pins.get(PIN1) < 3 || pins.get(PIN2) < 3)) {
throw new RuntimeException("Will not run crypto tests on a card with not-known or blocked PINs!");
Map<PIN, Byte> retries = getPINCounters();
if (retries.get(PIN1) < 3 || retries.get(PIN2) < 3) {
throw new IllegalStateException("Will not run crypto tests on a card with not-known or blocked PINs!");
}
System.out.println("Testing certificates and crypto ...");

Expand Down Expand Up @@ -583,15 +583,15 @@ static String make_random_pin(int len) {
try {
return hex2numbers(new BigInteger(len*8, SecureRandom.getInstanceStrong()).toString(16)).substring(0, len);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
throw new RuntimeException("Bad environment", e);
}
}

public void pin_tests(String pin1, String pin2, String puk) throws CardException, WrongPINException {

Map<PIN, Byte> pins = getPINCounters();
if (strict && (pins.get(PIN1) < 3 || pins.get(PIN2) < 3 || pins.get(PUK) < 3)) {
throw new RuntimeException("Will not run pin tests on a card with not-known or blocked PINs!");
Map<PIN, Byte> retries = getPINCounters();
if (retries.get(PIN1) < 3 || retries.get(PIN2) < 3 || retries.get(PUK) < 3) {
throw new IllegalStateException("Will not run pin tests on a card with not-known or blocked PINs!");
}
System.out.println("Testing PIN codes ...");
String newpin1 = make_random_pin(4);
Expand Down
4 changes: 0 additions & 4 deletions src/org/esteid/hacker/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import org.esteid.EstEID.CardType;
import org.esteid.EstEID.PIN;
import org.esteid.EstEID.PersonalData;
import org.esteid.applet.FakeEstEID;

import pro.javacard.gp.GlobalPlatform;
import pro.javacard.vre.VJCREProvider;
Expand All @@ -68,7 +67,6 @@ public class CLI {
private static final String OPT_DEBUG = "debug";
private static final String OPT_VERBOSE = "verbose";
private static final String OPT_INFO = "info";
private static final String OPT_RELAX = "relax";

private static final String OPT_CA = "ca";
private static final String OPT_RESIGN = "resign";
Expand Down Expand Up @@ -113,8 +111,6 @@ private static OptionSet parseArguments(String argv[]) throws IOException {
parser.acceptsAll(Arrays.asList("i", OPT_INFO), "Show information about the EstEID token");
parser.acceptsAll(Arrays.asList("l", OPT_LIST), "List connected tokens");

parser.accepts(OPT_RELAX, "Relax some checks");

// FakeEstEIDManagerCA interface
parser.accepts(OPT_CA, "Use or generate a CA").withRequiredArg().ofType(File.class);
parser.accepts(OPT_RESIGN, "Re-sign cert (PEM) with CA").withRequiredArg().ofType(File.class);
Expand Down

0 comments on commit dd2d9ec

Please sign in to comment.