diff --git a/src/esteidhacker/EstEID.java b/src/org/esteid/EstEID.java similarity index 99% rename from src/esteidhacker/EstEID.java rename to src/org/esteid/EstEID.java index bed5fd8..c51c344 100644 --- a/src/esteidhacker/EstEID.java +++ b/src/org/esteid/EstEID.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package esteidhacker; +package org.esteid; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; diff --git a/src/esteidhacker/CLI.java b/src/org/esteid/hacker/CLI.java similarity index 97% rename from src/esteidhacker/CLI.java rename to src/org/esteid/hacker/CLI.java index bcc2960..dd77b9d 100644 --- a/src/esteidhacker/CLI.java +++ b/src/org/esteid/hacker/CLI.java @@ -15,7 +15,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package esteidhacker; +package org.esteid.hacker; import java.io.File; import java.io.FileReader; @@ -29,6 +29,7 @@ import java.util.Map; import javax.smartcardio.Card; +import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; import javax.smartcardio.CardTerminals; import javax.smartcardio.CommandAPDU; @@ -44,14 +45,17 @@ import apdu4j.HexUtils; import apdu4j.LoggingCardTerminal; import apdu4j.TerminalManager; -import esteidhacker.EstEID.CardType; -import esteidhacker.EstEID.PIN; -import esteidhacker.EstEID.PersonalData; import javacard.framework.AID; import joptsimple.OptionException; import joptsimple.OptionParser; import joptsimple.OptionSet; + +import org.esteid.EstEID; +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; import pro.javacard.vre.VRE; @@ -323,12 +327,8 @@ else if (args.has(OPT_T1)) card = term.connect(protocol); EstEID esteid = EstEID.getInstance(card.getBasicChannel()); - if (args.has(OPT_RELAX)) { - esteid.strict = false; - } - if (args.has(OPT_VERBOSE) || args.has(OPT_INFO)) { - System.out.println("ATR: " + HexUtils.encodeHexString(card.getATR().getBytes())); + System.out.println("ATR: " + HexUtils.bin2hex(card.getATR().getBytes())); System.out.println("Type: " + esteid.getType()); } @@ -410,11 +410,11 @@ else if (args.has(OPT_T1)) if (args.has(OPT_TEST_CRYPTO) || args.has(OPT_TEST)) { esteid.crypto_tests(pin1, pin2); } - } catch (Exception e) { + } catch (CardException e) { if (TerminalManager.getExceptionMessage(e) != null) { System.out.println("PC/SC Error: " + TerminalManager.getExceptionMessage(e)); } else { - throw e; + System.out.println("Error: " + e.getMessage()); } } finally { if (card != null) { diff --git a/src/esteidhacker/FakeEstEIDCA.java b/src/org/esteid/hacker/FakeEstEIDCA.java similarity index 99% rename from src/esteidhacker/FakeEstEIDCA.java rename to src/org/esteid/hacker/FakeEstEIDCA.java index bd8e72b..b9955cd 100644 --- a/src/esteidhacker/FakeEstEIDCA.java +++ b/src/org/esteid/hacker/FakeEstEIDCA.java @@ -15,7 +15,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package esteidhacker; +package org.esteid.hacker; import java.io.File; import java.io.FileInputStream; diff --git a/src/esteidhacker/FakeEstEIDManager.java b/src/org/esteid/hacker/FakeEstEIDManager.java similarity index 99% rename from src/esteidhacker/FakeEstEIDManager.java rename to src/org/esteid/hacker/FakeEstEIDManager.java index 0026f0b..eb47ff1 100644 --- a/src/esteidhacker/FakeEstEIDManager.java +++ b/src/org/esteid/hacker/FakeEstEIDManager.java @@ -15,7 +15,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -package esteidhacker; +package org.esteid.hacker; import java.io.File; import java.io.FileInputStream; @@ -46,6 +46,7 @@ import org.bouncycastle.openssl.PEMKeyPair; import org.bouncycastle.openssl.PEMParser; import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; +import org.esteid.EstEID; // Given a connection to a FakeEstEID applet, provides a higher level interface for the possibilities. public class FakeEstEIDManager { diff --git a/src/esteidhacker/SecureChannel.java b/src/org/esteid/hacker/SecureChannel.java similarity index 99% rename from src/esteidhacker/SecureChannel.java rename to src/org/esteid/hacker/SecureChannel.java index 4d5559a..f5289b6 100644 --- a/src/esteidhacker/SecureChannel.java +++ b/src/org/esteid/hacker/SecureChannel.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package esteidhacker; +package org.esteid.hacker; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException;