JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

ECC implementation: 6F 00 during installation

Algorithm School

Moderator: UNKNwYSHSA

User avatar
lostsiwonlw
Posts: 55
Joined: Fri Jul 31, 2015 9:09 pm
Points :358
Contact:

ECC implementation: 6F 00 during installation

Post by lostsiwonlw » Wed Aug 26, 2015 5:12 am

I am using ECC to implement the signing function.

Code: Select all

package ECCtest;

import javacard.framework.*;
import javacard.security.*;
import javacardx.crypto.*;

public class ECCtest extends Applet
{
private byte[] PLAINTEXT ;
private ECPrivateKey objECDSAPriKey=null;   
private ECPublicKey objECDSAPubKey=null;   
private KeyPair objECDSAKeyPair=null;       
private Signature objECDSASign=null;       

final static short BAS =  0;

public static void install(byte[] bArray, short bOffset, byte bLength)
{
  new ECCtest(bArray, bOffset, bLength);
}

private ECCtest(byte bArray[], short bOffset, byte bLength)
 {
  PLAINTEXT = new byte[0x100] ;
  Util.arrayFillNonAtomic(PLAINTEXT,  BAS, (short)0x100, (byte)0);

  objECDSAKeyPair= new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_192);         

  objECDSASign = Signature.getInstance(Signature.ALG_ECDSA_SHA, false);

  register();
}

public void process(APDU apdu)
{
  byte buf[] = apdu.getBuffer();
 
  switch(buf[1])
   {
      case (byte)0xA4:
              break;

      case (byte)0x46:
           objECDSAKeyPair.genKeyPair();
           objECDSAPriKey = (ECPrivateKey)objECDSAKeyPair.getPrivate();
           objECDSAPubKey = (ECPublicKey)objECDSAKeyPair.getPublic();
           break;

  case (byte)0x2E:
           short Le = apdu.setOutgoing();
           short sSignLen=0 ;
          objECDSASign.init(objECDSAPriKey, Signature.MODE_SIGN);

          sSignLen = objECDSASign.sign(PLAINTEXT, BAS, Le, buf, BAS);

         apdu.setOutgoingLength(sSignLen);
         apdu.sendBytes(BAS, sSignLen);
          break;
  default:
  ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
  }

  return;
}

}


But when I install my applet,I encounter error code: 6F 00.
I don't know what's wrong with my code.
In addition, I am told that my card supports ECC, but I'm not sure if it really supports ECC.
How can I check it?
Searching for meaning...

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: ECC implementation: 6F 00 during installation

Post by UNKNwYSHSA » Thu Aug 27, 2015 3:01 am

1 First, the statement:

Code: Select all

PLAINTEXT = new byte[0x100]; 

Is there enouth NVM free for the applet?
2 If you comments code line:

Code: Select all

    objECDSAKeyPair= new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_192);         
    objECDSASign = Signature.getInstance(Signature.ALG_ECDSA_SHA, false);

and the applet install no problem, then the ECC support of your card may had problem, you need to confirm this.
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 12 guests

JavaCard OS : Disclaimer