64 44 error when installing applet
843851Nov 20 2003 — edited Nov 27 2003My code here
////////////////////////////////////////////////////////////////////////////////////////////////////
package GenKey;
import javacard.framework.*;
import javacard.security.*;
/**
* The framework for a small Java Card 2.1 application.
*
*/
public class GenKey extends Applet
{
/**
* Installs the GenKey applet.
* @param bArray to pass to register() method.
* @param bOffset to pass to register() method.
* @param bLength to pass to register() method.
*/
final static byte genKey_CLA = (byte)0xB0;
final static byte genKeyPair = (byte)0x10;
final static byte getPriExp = (byte)0x20;
final static byte getPriMod = (byte)0x30;
final static byte getPubExp = (byte)0x40;
final static byte getPubMod = (byte)0x50;
KeyPair keyPairDvc;// = new KeyPair(KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_1024);
byte[] skExp; short skExp_len;
byte[] skMod; short skMod_len;
byte[] pkExp; short pkExp_len;
byte[] pkMod; short pkMod_len;
public static void install(byte[] bArray, short bOffset, byte bLength)
{
new GenKey();
}
/**
* Performs memory allocations, initialization, and applet registration.
*
* @param bArray to pass to register() method.
* @param bOffset to pass to register() method.
* @param bLength to pass to register() method.
*/
private GenKey()
{
//try {
keyPairDvc = new KeyPair(KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_1024);
//}
//catch(CryptoException e){
// CryptoException.throwIt(CryptoException.NO_SUCH_ALGORITHM);
//}
register();
}
/**
* Dispatches APDU commands.
* @param apdu APDU object
*/
public boolean select(){
// selection initialization
//someByteArray[17] = 42; // set selection state
return true;
}
public void deselect(){
}
public void process(APDU apdu)
{
if (selectingApplet())
return;
// APDU processing here.
byte[] buffer = apdu.getBuffer();
if (buffer[ISO7816.OFFSET_CLA] != genKey_CLA)
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
switch (buffer[ISO7816.OFFSET_INS])
{
case genKeyPair: genKeyPair(apdu); return;
case getPriExp : getPriExp(apdu); return;
case getPriMod : getPriMod(apdu); return;
case getPubExp : getPriExp(apdu); return;
case getPubMod : getPriMod(apdu); return;
default: ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
public void genKeyPair(APDU apdu)
{
keyPairDvc.genKeyPair();
}
public void getPriExp(APDU apdu)
{
byte[] buffer = apdu.getBuffer();
RSAPrivateKey k = (RSAPrivateKey)keyPairDvc.getPrivate();
skExp_len = k.getExponent(skExp, (short)0);
apdu.setOutgoingLength(skExp_len);
buffer = skExp;
apdu.sendBytes((short)0, skExp_len);
}
public void getPriMod(APDU apdu)
{
byte[] buffer = apdu.getBuffer();
RSAPrivateKey k = (RSAPrivateKey)keyPairDvc.getPrivate();
skMod_len = k.getModulus(skMod, (short)0);
apdu.setOutgoingLength(skMod_len);
buffer = skMod;
apdu.sendBytes((short)0, skMod_len);
}
public void getPubExp(APDU apdu)
{
byte[] buffer = apdu.getBuffer();
RSAPublicKey k = (RSAPublicKey)keyPairDvc.getPublic();
pkExp_len = k.getExponent(pkExp, (short)0);
apdu.setOutgoing();
apdu.setOutgoingLength(pkExp_len);
buffer = pkExp;
apdu.sendBytes((short)0, pkExp_len);
}
public void getPubMod(APDU apdu)
{
byte[] buffer = apdu.getBuffer();
RSAPublicKey k = (RSAPublicKey)keyPairDvc.getPublic();
pkMod_len = k.getExponent(pkMod, (short)0);
apdu.setOutgoing();
apdu.setOutgoingLength(pkMod_len);
buffer = pkMod;
apdu.sendBytes((short)0, pkMod_len);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
when I sent apdu to install applet I got error 64 44
my apdu is
80 b8 00 00 0f 08 f2 34 12 34 56 10 00 01 00 7f
What happen? What I mistake?