-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from crocs-muni/devel
Synchronizing devel to master v1.6
- Loading branch information
Showing
199 changed files
with
54,309 additions
and
4,668 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
language: java | ||
|
||
jdk: | ||
- oraclejdk7 | ||
|
||
|
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file renamed
BIN
+371 KB
AlgTest_JClient/test/jcardsim-2.2.1-all.jar → ...t_JClient/dist/lib/jcardsim-2.2.2-all.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.88 KB
AlgTest_JClient/libs/api_export_files/javacard/framework/javacard/framework.exp
Binary file not shown.
Binary file added
BIN
+2.83 KB
AlgTest_JClient/libs/api_export_files/javacard/framework/service/javacard/service.exp
Binary file not shown.
Binary file added
BIN
+8.78 KB
AlgTest_JClient/libs/api_export_files/javacard/security/javacard/security.exp
Binary file not shown.
Binary file added
BIN
+113 Bytes
AlgTest_JClient/libs/api_export_files/javacardx/apdu/javacard/apdu.exp
Binary file not shown.
Binary file added
BIN
+2.2 KB
AlgTest_JClient/libs/api_export_files/javacardx/biometry/javacard/biometry.exp
Binary file not shown.
Binary file added
BIN
+1.35 KB
AlgTest_JClient/libs/api_export_files/javacardx/crypto/javacard/crypto.exp
Binary file not shown.
Binary file added
BIN
+857 Bytes
AlgTest_JClient/libs/api_export_files/javacardx/external/javacard/external.exp
Binary file not shown.
Binary file added
BIN
+812 Bytes
AlgTest_JClient/libs/api_export_files/javacardx/framework/math/javacard/math.exp
Binary file not shown.
Binary file added
BIN
+2.94 KB
AlgTest_JClient/libs/api_export_files/javacardx/framework/tlv/javacard/tlv.exp
Binary file not shown.
Binary file added
BIN
+309 Bytes
AlgTest_JClient/libs/api_export_files/javacardx/framework/util/intx/javacard/intx.exp
Binary file not shown.
Binary file added
BIN
+819 Bytes
AlgTest_JClient/libs/api_export_files/javacardx/framework/util/javacard/util.exp
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/* | ||
Copyright (c) 2004-2014 Petr Svenda <[email protected]> | ||
LICENSE TERMS | ||
The free distribution and use of this software in both source and binary | ||
form is allowed (with or without changes) provided that: | ||
1. distributions of this source code include the above copyright | ||
notice, this list of conditions and the following disclaimer; | ||
2. distributions in binary form include the above copyright | ||
notice, this list of conditions and the following disclaimer | ||
in the documentation and/or other associated materials; | ||
3. the copyright holder's name is not used to endorse products | ||
built using this software without specific written permission. | ||
ALTERNATIVELY, provided that this notice is retained in full, this product | ||
may be distributed under the terms of the GNU General Public License (GPL), | ||
in which case the provisions of the GPL apply INSTEAD OF those given above. | ||
DISCLAIMER | ||
This software is provided 'as is' with no explicit or implied warranties | ||
in respect of its properties, including, but not limited to, correctness | ||
and/or fitness for purpose. | ||
Please, report any bugs to author <[email protected]> | ||
*/ | ||
|
||
/** | ||
* | ||
* @author Petr Svenda, Lenka Kunikova, Lukas Srom | ||
*/ | ||
package AlgTest; | ||
|
||
|
||
import javacard.framework.*; | ||
import javacard.security.*; | ||
|
||
|
||
public class AlgKeyHarvest { | ||
private KeyPair m_keyPair = null; | ||
private AlgTest.TestSettings m_testSettings = null; | ||
private RSAPublicKey m_rsaPublicKey = null; | ||
private RSAPrivateCrtKey m_rsaPrivateCrtKey = null; | ||
private RSAPrivateKey m_rsaPrivateKey = null; | ||
|
||
private static final byte KeyPair_ALG_RSA = 1; | ||
private static final byte KeyPair_ALG_RSA_CRT = 2; | ||
private static final byte KeyBuilder_ALG_TYPE_RSA_PUBLIC = 11; | ||
private static final byte KeyBuilder_ALG_TYPE_RSA_PRIVATE = 12; | ||
private static final byte KeyBuilder_ALG_TYPE_RSA_CRT_PRIVATE = 13; | ||
|
||
|
||
AlgKeyHarvest() { | ||
m_testSettings = new AlgTest.TestSettings(); | ||
} | ||
|
||
public byte process(APDU apdu) throws ISOException { | ||
byte bProcessed = 0; | ||
byte[] apduBuffer = apdu.getBuffer(); | ||
|
||
if (apduBuffer[ISO7816.OFFSET_CLA] == AlgTest.Consts.CLA_CARD_ALGTEST) { | ||
bProcessed = 1; | ||
switch ( apduBuffer[ISO7816.OFFSET_INS]) { | ||
case AlgTest.Consts.INS_CARD_GETRSAKEY: GetRSAKey(apdu); break; | ||
default : { | ||
bProcessed = 0; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return bProcessed; | ||
} | ||
|
||
/** | ||
* Method for on-card generation of RSA keypair and export of result outside (in two apdu) | ||
* @param apdu | ||
*/ | ||
void GetRSAKey(APDU apdu) { | ||
byte[] apdubuf = apdu.getBuffer(); | ||
m_testSettings.parse(apdu); | ||
|
||
// Generate new object if not before yet | ||
if (m_keyPair == null) { | ||
m_keyPair = new KeyPair((byte)m_testSettings.keyClass, m_testSettings.keyLength); | ||
// m_keyPair = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_512); | ||
} | ||
|
||
switch (m_testSettings.keyType) { | ||
case KeyBuilder_ALG_TYPE_RSA_PUBLIC: { | ||
m_keyPair.genKeyPair(); | ||
m_rsaPublicKey = (RSAPublicKey) m_keyPair.getPublic(); | ||
|
||
short offset = 0; | ||
apdubuf[offset] = (byte)0x82; offset++; | ||
short len = m_rsaPublicKey.getExponent(apdubuf, (short)(offset + 2)); | ||
Util.setShort(apdubuf, offset, len); | ||
offset += 2; // length | ||
offset += len; // value | ||
|
||
apdubuf[offset] = (byte)0x82; offset++; | ||
len = m_rsaPublicKey.getModulus(apdubuf, (short) (offset + 2)); | ||
Util.setShort(apdubuf, offset, len); | ||
offset += 2; // length | ||
offset += len; // value | ||
|
||
apdu.setOutgoingAndSend((short) 0, offset); | ||
|
||
break; | ||
} | ||
case KeyBuilder_ALG_TYPE_RSA_PRIVATE: { | ||
short offset = 0; | ||
if(m_testSettings.keyClass == KeyPair_ALG_RSA_CRT) { | ||
m_rsaPrivateCrtKey = (RSAPrivateCrtKey) m_keyPair.getPrivate(); | ||
|
||
short len = m_rsaPrivateCrtKey.getP(apdubuf, (short)(offset + 3)); | ||
apdubuf[offset] = (byte)0x82; offset++; | ||
Util.setShort(apdubuf, offset, len); offset += 2; | ||
offset += len; | ||
|
||
len = m_rsaPrivateCrtKey.getQ(apdubuf, (short)(offset + 3)); | ||
apdubuf[offset] = (byte)0x82; offset++; | ||
Util.setShort(apdubuf, offset, len); offset += 2; | ||
offset += len; | ||
} | ||
else if(m_testSettings.keyClass == KeyPair_ALG_RSA) { | ||
m_rsaPrivateKey = (RSAPrivateKey) m_keyPair.getPrivate(); | ||
|
||
short len = m_rsaPrivateKey.getExponent(apdubuf, (short)(offset + 3)); | ||
apdubuf[offset] = (byte)0x82; offset++; | ||
Util.setShort(apdubuf, offset, len); offset += 2; | ||
offset += len; | ||
|
||
len = m_rsaPrivateKey.getModulus(apdubuf, (short)(offset + 3)); | ||
apdubuf[offset] = (byte)0x82; offset++; | ||
Util.setShort(apdubuf, offset, len); offset += 2; | ||
offset += len; | ||
} | ||
else ISOException.throwIt( ISO7816.SW_COMMAND_NOT_ALLOWED) ; | ||
|
||
apdu.setOutgoingAndSend((short) 0, offset); | ||
break; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.