Javacard kit 3.0.4 & crypto algorithm
Posted: Tue Nov 28, 2017 10:12 am
Hi,
I wrote this little applet to see if your simulator (and later one of your cards) supports this style of crypto:
Signature. getInstance (MessageDigest. ALG_NULL, Signature. SIG_CIPHER_ECDSA, Cipher. PAD_NULL, false);
my applet this compiles in java card kit 3.0.4, but during the installation on the simulator I have a: 69 85 Conditions of use not satisfied with the INSTALL for install & make selectable command.
Is your simulator fully compatible with java card kit 3.0.4?
Do you have a card that is compatible with java card kit 3.0.4?
Thank you in advance for your help,
Pascal
code of the applet:
package com.fime.ecTest;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.AppletEvent;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.security.MessageDigest;
import javacard.security.Signature;
import javacardx.crypto.Cipher;
public class Application extends Applet implements AppletEvent {
/** SM2 cryptographic object */
private static Signature sm2Object;
Application()
{
sm2Object = Signature.getInstance(MessageDigest.ALG_NULL, Signature.SIG_CIPHER_ECDSA, Cipher.PAD_NULL, false);
}
public static void install(byte[] bArray, short bOffset, byte bLength) {
// GP-compliant JavaCard applet registration
new Application().register(bArray, (short) (bOffset + 1),
bArray[bOffset]);
}
public void process(APDU apdu) {
// Good practice: Return 9000 on SELECT
if (selectingApplet()) {
return;
}
byte[] buf = apdu.getBuffer();
switch (buf[ISO7816.OFFSET_INS]) {
case (byte) 0x00:
break;
default:
// good practice: If you don't know the INStruction, say so:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
public void uninstall() {
sm2Object = null;
}
}
I wrote this little applet to see if your simulator (and later one of your cards) supports this style of crypto:
Signature. getInstance (MessageDigest. ALG_NULL, Signature. SIG_CIPHER_ECDSA, Cipher. PAD_NULL, false);
my applet this compiles in java card kit 3.0.4, but during the installation on the simulator I have a: 69 85 Conditions of use not satisfied with the INSTALL for install & make selectable command.
Is your simulator fully compatible with java card kit 3.0.4?
Do you have a card that is compatible with java card kit 3.0.4?
Thank you in advance for your help,
Pascal
code of the applet:
package com.fime.ecTest;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.AppletEvent;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.security.MessageDigest;
import javacard.security.Signature;
import javacardx.crypto.Cipher;
public class Application extends Applet implements AppletEvent {
/** SM2 cryptographic object */
private static Signature sm2Object;
Application()
{
sm2Object = Signature.getInstance(MessageDigest.ALG_NULL, Signature.SIG_CIPHER_ECDSA, Cipher.PAD_NULL, false);
}
public static void install(byte[] bArray, short bOffset, byte bLength) {
// GP-compliant JavaCard applet registration
new Application().register(bArray, (short) (bOffset + 1),
bArray[bOffset]);
}
public void process(APDU apdu) {
// Good practice: Return 9000 on SELECT
if (selectingApplet()) {
return;
}
byte[] buf = apdu.getBuffer();
switch (buf[ISO7816.OFFSET_INS]) {
case (byte) 0x00:
break;
default:
// good practice: If you don't know the INStruction, say so:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
public void uninstall() {
sm2Object = null;
}
}