com.musclecard.CardEdge
Class CardEdge

java.lang.Object
  extended byApplet
      extended bycom.musclecard.CardEdge.CardEdge

public class CardEdge
extends Applet

Implements MUSCLE's Card Edge Specification.

TODO:

NOTES:

Version:
0.9.10
Author:
Tommaso Cucinotta, David Corcoran, Ludovic Rousseau
See Also:
Serialized Form

Field Summary
private static byte[] acl
           
private static byte ALG_3DES
           
private static byte ALG_3DES3
           
private static byte ALG_DES
           
private static byte ALG_DSA
           
private static byte ALG_RSA
           
private static byte ALG_RSA_CRT
           
private static byte BLOB_ENC_PLAIN
           
private static byte CardEdge_CLA
           
private static byte CD_DECRYPT
           
private static byte CD_ENCRYPT
           
private static byte CD_SIGN
           
private static byte CD_VERIFY
           
private  byte[] ciph_dirs
           
private  javacardx.crypto.Cipher[] ciphers
           
private static byte CM_DES_CBC_NOPAD
           
private static byte CM_DES_ECB_NOPAD
           
private static byte CM_DSA_SHA
           
private static byte CM_RSA_NOPAD
           
private static byte CM_RSA_PAD_PKCS1
           
private  byte create_key_ACL
           
private  byte create_object_ACL
           
private  byte create_pin_ACL
           
private static byte DL_APDU
           
private static byte DL_OBJECT
           
private  boolean getChallengeDone
           
private static short IN_OBJECT_CLA
           
private static short IN_OBJECT_ID
           
private static byte INS_CHANGE_PIN
           
private static byte INS_COMPUTE_CRYPT
           
private static byte INS_CREATE_OBJ
           
private static byte INS_CREATE_PIN
           
private static byte INS_DELETE_OBJ
           
private static byte INS_EXPORT_KEY
           
private static byte INS_EXT_AUTH
           
private static byte INS_GEN_KEYPAIR
          Instruction codes
private static byte INS_GET_CHALLENGE
           
private static byte INS_GET_STATUS
           
private static byte INS_IMPORT_KEY
           
private static byte INS_LIST_KEYS
           
private static byte INS_LIST_OBJECTS
           
private static byte INS_LIST_PINS
           
private static byte INS_LOGOUT_ALL
           
private static byte INS_READ_OBJ
           
private static byte INS_SETUP
           
private static byte INS_UNBLOCK_PIN
           
private static byte INS_VERIFY_PIN
           
private static byte INS_WRITE_OBJ
           
private static byte KEY_3DES
           
private static byte KEY_3DES3
           
private static byte KEY_ACL_SIZE
           
private static byte KEY_DES
           
private static byte KEY_DSA_PRIVATE
           
private static byte KEY_DSA_PUBLIC
           
private  byte key_it
           
private static byte KEY_RSA_PRIVATE
           
private static byte KEY_RSA_PRIVATE_CRT
           
private static byte KEY_RSA_PUBLIC
           
private  byte[] keyACLs
           
private  javacard.security.KeyPair[] keyPairs
           
private  javacard.security.Key[] keys
           
private  byte[] keyTries
           
private static byte LIST_OPT_NEXT
           
private static byte LIST_OPT_RESET
          List option
private  short logged_ids
           
private static byte MAX_KEY_TRIES
           
private static byte MAX_NUM_AUTH_KEYS
           
private static byte MAX_NUM_KEYS
           
private static byte MAX_NUM_PINS
           
private  MemoryManager mem
          Instance variables declaration
private static short OFFSET_GENKEY_ALG
           
private static short OFFSET_GENKEY_DSA_GPQ
           
private static short OFFSET_GENKEY_OPTIONS
           
private static short OFFSET_GENKEY_PRV_ACL
           
private static short OFFSET_GENKEY_PUB_ACL
           
private static short OFFSET_GENKEY_RSA_PUB_EXP_LENGTH
           
private static short OFFSET_GENKEY_RSA_PUB_EXP_VALUE
           
private static short OFFSET_GENKEY_SIZE
           
private  ObjectManager om
           
private static byte OP_FINALIZE
           
private static byte OP_INIT
           
private static byte OP_PROCESS
           
private static byte OPT_DEFAULT
           
private static byte OPT_DSA_GPQ
           
private static byte OPT_RSA_PUB_EXP
           
private static short OUT_OBJECT_CLA
           
private static short OUT_OBJECT_ID
           
private static byte PIN_CHARSET_LC_LETTERS
          Lower case letters
private static byte PIN_CHARSET_NUMBERS
          Numbers are allowed
private static byte PIN_CHARSET_OTHERS
          Other binary codes (NUMBERS | OTHERS excludes LETTERS and PUNCT)
private static byte PIN_CHARSET_PUNCT
          Punctuation symbols: , .
private static byte PIN_CHARSET_UC_LETTERS
          Upper case letters
private static byte[] PIN_INIT_VALUE
           
private static byte PIN_MIXED_ALL
          PIN must at least contain 1 char from each char set
private static byte PIN_MIXED_CASE
          PIN must at least contain chars from both upper and lower case
private static byte PIN_MIXED_TWO
          PIN must contain chars from at least 2 different char sets
private static byte PIN_POLICY_CHARSET
          Enable pin charset check
private static byte PIN_POLICY_MIXED
          Enable charset mixing check
private static byte PIN_POLICY_SIZE
          Enable pin size check
private static byte pinMaxSize
           
private static byte pinMinSize
           
private static byte pinPolicies
           
private  javacard.framework.OwnerPIN[] pins
           
private  javacard.security.RandomData randomData
           
private  boolean setupDone
           
private  javacard.security.Signature[] signatures
           
private static byte[] STD_PUBLIC_ACL
           
private static short SW_AUTH_FAILED
          Entered PIN is not correct
private static short SW_IDENTITY_BLOCKED
          Operation has been blocked for security reason
private static short SW_INCORRECT_ALG
          Algorithm specified is not correct
private static short SW_INCORRECT_P1
          Incorrect P1 parameter
private static short SW_INCORRECT_P2
          Incorrect P2 parameter
private static short SW_INTERNAL_ERROR
          For debugging purposes
private static short SW_INVALID_PARAMETER
          Invalid input parameter to command
private static short SW_NO_MEMORY_LEFT
          There have been memory problems on the card
private static short SW_OBJECT_EXISTS
          New object ID already in use
private static short SW_OBJECT_NOT_FOUND
          Required object is missing
private static short SW_OPERATION_NOT_ALLOWED
          Required operation is not allowed in actual circumstances
private static short SW_SEQUENCE_END
          No more data available
private static short SW_SIGNATURE_INVALID
          Verify operation detected an invalid signature
private static short SW_UNAUTHORIZED
          Required operation was not authorized because of a lack of privileges
private static short SW_UNSUPPORTED_FEATURE
          Required feature is not (yet) supported
private  javacard.framework.OwnerPIN[] ublk_pins
           
private static byte VERSION_APPLET_MAJOR
           
private static byte VERSION_APPLET_MINOR
           
private static byte VERSION_PROTOCOL_MAJOR
           
private static byte VERSION_PROTOCOL_MINOR
           
 
Constructor Summary
private CardEdge(byte[] bArray, short bOffset, byte bLength)
           
 
Method Summary
(package private)  boolean authorizeKeyRead(byte key_nb)
          Check from ACL if a key can be read
(package private)  boolean authorizeKeyUse(byte key_nb)
          Check from ACL if a key can be used
(package private)  boolean authorizeKeyWrite(byte key_nb)
          Check from ACL if a key can be overwritten
private  void ChangePIN(APDU apdu, byte[] buffer)
           
private  boolean CheckPINPolicy(byte[] pin_buffer, short pin_offset, byte pin_size)
          Checks if PIN policies are satisfied for a PIN code
private  void ComputeCrypt(APDU apdu, byte[] buffer)
          APDU handlers
private  void CreateObject(APDU apdu, byte[] buffer)
           
private  void CreatePIN(APDU apdu, byte[] buffer)
           
private  void DeleteObject(APDU apdu, byte[] buffer)
           
 void deselect()
           
private  void ExportKey(APDU apdu, byte[] buffer)
           
private  void GenerateKeyPair(APDU apdu, byte[] buffer)
           
private  void GenerateKeyPairRSA(byte[] buffer)
           
private  void GetChallenge(APDU apdu, byte[] buffer)
           
private  Cipher getCipher(byte key_nb, byte alg_id)
           
(package private)  byte[] getCurrentACL()
          Returns an ACL that requires current logged in identities.
private  Key getKey(byte key_nb, byte key_type, short key_size)
          Retrieves the Key object to be used w/ the specified key number, key type (KEY_XX) and size.
private  byte getKeyType(Key key)
           
(package private)  byte[] getRestrictedACL()
          Returns an ACL that disables all operations for the application.
private  Signature getSignature(byte key_nb, byte alg_id)
           
private  void GetStatus(APDU apdu, byte[] buffer)
           
private  void ImportKey(APDU apdu, byte[] buffer)
           
static void install(byte[] bArray, short bOffset, byte bLength)
           
private  byte keyType2JCType(byte key_type)
           
private  void ListKeys(APDU apdu, byte[] buffer)
           
private  void ListObjects(APDU apdu, byte[] buffer)
           
private  void ListPINs(APDU apdu, byte[] buffer)
           
private  void LoginStrongIdentity(byte key_nb)
          Registers login of strong identity associated with a key number
private  void LogOutAll()
           
private  void LogoutIdentity(byte id_nb)
          Registers logout of an identity.
 void process(APDU apdu)
           
private  void ReadObject(APDU apdu, byte[] buffer)
           
 boolean select()
           
private  void sendData(APDU apdu, byte[] data, short offset, short size)
          UTILITY FUNCTIONS
private  void setup(APDU apdu, byte[] buffer)
           
private  void ThrowDeleteObjects(short exception)
          Deletes and zeros the IO objects and throws the passed in exception
private  void UnblockPIN(APDU apdu, byte[] buffer)
           
private  void VerifyPIN(APDU apdu, byte[] buffer)
           
private  void WriteObject(APDU apdu, byte[] buffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acl

private static byte[] acl

ALG_3DES

private static final byte ALG_3DES
See Also:
Constant Field Values

ALG_3DES3

private static final byte ALG_3DES3
See Also:
Constant Field Values

ALG_DES

private static final byte ALG_DES
See Also:
Constant Field Values

ALG_DSA

private static final byte ALG_DSA
See Also:
Constant Field Values

ALG_RSA

private static final byte ALG_RSA
See Also:
Constant Field Values

ALG_RSA_CRT

private static final byte ALG_RSA_CRT
See Also:
Constant Field Values

BLOB_ENC_PLAIN

private static final byte BLOB_ENC_PLAIN
See Also:
Constant Field Values

CardEdge_CLA

private static final byte CardEdge_CLA
See Also:
Constant Field Values

CD_DECRYPT

private static final byte CD_DECRYPT
See Also:
Constant Field Values

CD_ENCRYPT

private static final byte CD_ENCRYPT
See Also:
Constant Field Values

CD_SIGN

private static final byte CD_SIGN
See Also:
Constant Field Values

CD_VERIFY

private static final byte CD_VERIFY
See Also:
Constant Field Values

ciph_dirs

private byte[] ciph_dirs

ciphers

private javacardx.crypto.Cipher[] ciphers

CM_DES_CBC_NOPAD

private static final byte CM_DES_CBC_NOPAD
See Also:
Constant Field Values

CM_DES_ECB_NOPAD

private static final byte CM_DES_ECB_NOPAD
See Also:
Constant Field Values

CM_DSA_SHA

private static final byte CM_DSA_SHA
See Also:
Constant Field Values

CM_RSA_NOPAD

private static final byte CM_RSA_NOPAD
See Also:
Constant Field Values

CM_RSA_PAD_PKCS1

private static final byte CM_RSA_PAD_PKCS1
See Also:
Constant Field Values

create_key_ACL

private byte create_key_ACL

create_object_ACL

private byte create_object_ACL

create_pin_ACL

private byte create_pin_ACL

DL_APDU

private static final byte DL_APDU
See Also:
Constant Field Values

DL_OBJECT

private static final byte DL_OBJECT
See Also:
Constant Field Values

getChallengeDone

private boolean getChallengeDone

IN_OBJECT_CLA

private static final short IN_OBJECT_CLA
See Also:
Constant Field Values

IN_OBJECT_ID

private static final short IN_OBJECT_ID
See Also:
Constant Field Values

INS_CHANGE_PIN

private static final byte INS_CHANGE_PIN
See Also:
Constant Field Values

INS_COMPUTE_CRYPT

private static final byte INS_COMPUTE_CRYPT
See Also:
Constant Field Values

INS_CREATE_OBJ

private static final byte INS_CREATE_OBJ
See Also:
Constant Field Values

INS_CREATE_PIN

private static final byte INS_CREATE_PIN
See Also:
Constant Field Values

INS_DELETE_OBJ

private static final byte INS_DELETE_OBJ
See Also:
Constant Field Values

INS_EXPORT_KEY

private static final byte INS_EXPORT_KEY
See Also:
Constant Field Values

INS_EXT_AUTH

private static final byte INS_EXT_AUTH
See Also:
Constant Field Values

INS_GEN_KEYPAIR

private static final byte INS_GEN_KEYPAIR
Instruction codes

See Also:
Constant Field Values

INS_GET_CHALLENGE

private static final byte INS_GET_CHALLENGE
See Also:
Constant Field Values

INS_GET_STATUS

private static final byte INS_GET_STATUS
See Also:
Constant Field Values

INS_IMPORT_KEY

private static final byte INS_IMPORT_KEY
See Also:
Constant Field Values

INS_LIST_KEYS

private static final byte INS_LIST_KEYS
See Also:
Constant Field Values

INS_LIST_OBJECTS

private static final byte INS_LIST_OBJECTS
See Also:
Constant Field Values

INS_LIST_PINS

private static final byte INS_LIST_PINS
See Also:
Constant Field Values

INS_LOGOUT_ALL

private static final byte INS_LOGOUT_ALL
See Also:
Constant Field Values

INS_READ_OBJ

private static final byte INS_READ_OBJ
See Also:
Constant Field Values

INS_SETUP

private static final byte INS_SETUP
See Also:
Constant Field Values

INS_UNBLOCK_PIN

private static final byte INS_UNBLOCK_PIN
See Also:
Constant Field Values

INS_VERIFY_PIN

private static final byte INS_VERIFY_PIN
See Also:
Constant Field Values

INS_WRITE_OBJ

private static final byte INS_WRITE_OBJ
See Also:
Constant Field Values

KEY_3DES

private static final byte KEY_3DES
See Also:
Constant Field Values

KEY_3DES3

private static final byte KEY_3DES3
See Also:
Constant Field Values

KEY_ACL_SIZE

private static final byte KEY_ACL_SIZE
See Also:
Constant Field Values

KEY_DES

private static final byte KEY_DES
See Also:
Constant Field Values

KEY_DSA_PRIVATE

private static final byte KEY_DSA_PRIVATE
See Also:
Constant Field Values

KEY_DSA_PUBLIC

private static final byte KEY_DSA_PUBLIC
See Also:
Constant Field Values

key_it

private byte key_it

KEY_RSA_PRIVATE

private static final byte KEY_RSA_PRIVATE
See Also:
Constant Field Values

KEY_RSA_PRIVATE_CRT

private static final byte KEY_RSA_PRIVATE_CRT
See Also:
Constant Field Values

KEY_RSA_PUBLIC

private static final byte KEY_RSA_PUBLIC
See Also:
Constant Field Values

keyACLs

private byte[] keyACLs

keyPairs

private javacard.security.KeyPair[] keyPairs

keys

private javacard.security.Key[] keys

keyTries

private byte[] keyTries

LIST_OPT_NEXT

private static final byte LIST_OPT_NEXT
See Also:
Constant Field Values

LIST_OPT_RESET

private static final byte LIST_OPT_RESET
List option

See Also:
Constant Field Values

logged_ids

private short logged_ids

MAX_KEY_TRIES

private static final byte MAX_KEY_TRIES
See Also:
Constant Field Values

MAX_NUM_AUTH_KEYS

private static final byte MAX_NUM_AUTH_KEYS
See Also:
Constant Field Values

MAX_NUM_KEYS

private static final byte MAX_NUM_KEYS
See Also:
Constant Field Values

MAX_NUM_PINS

private static final byte MAX_NUM_PINS
See Also:
Constant Field Values

mem

private MemoryManager mem
Instance variables declaration


OFFSET_GENKEY_ALG

private static final short OFFSET_GENKEY_ALG
See Also:
Constant Field Values

OFFSET_GENKEY_DSA_GPQ

private static final short OFFSET_GENKEY_DSA_GPQ
See Also:
Constant Field Values

OFFSET_GENKEY_OPTIONS

private static final short OFFSET_GENKEY_OPTIONS
See Also:
Constant Field Values

OFFSET_GENKEY_PRV_ACL

private static final short OFFSET_GENKEY_PRV_ACL
See Also:
Constant Field Values

OFFSET_GENKEY_PUB_ACL

private static final short OFFSET_GENKEY_PUB_ACL
See Also:
Constant Field Values

OFFSET_GENKEY_RSA_PUB_EXP_LENGTH

private static final short OFFSET_GENKEY_RSA_PUB_EXP_LENGTH
See Also:
Constant Field Values

OFFSET_GENKEY_RSA_PUB_EXP_VALUE

private static final short OFFSET_GENKEY_RSA_PUB_EXP_VALUE
See Also:
Constant Field Values

OFFSET_GENKEY_SIZE

private static final short OFFSET_GENKEY_SIZE
See Also:
Constant Field Values

om

private ObjectManager om

OP_FINALIZE

private static final byte OP_FINALIZE
See Also:
Constant Field Values

OP_INIT

private static final byte OP_INIT
See Also:
Constant Field Values

OP_PROCESS

private static final byte OP_PROCESS
See Also:
Constant Field Values

OPT_DEFAULT

private static final byte OPT_DEFAULT
See Also:
Constant Field Values

OPT_DSA_GPQ

private static final byte OPT_DSA_GPQ
See Also:
Constant Field Values

OPT_RSA_PUB_EXP

private static final byte OPT_RSA_PUB_EXP
See Also:
Constant Field Values

OUT_OBJECT_CLA

private static final short OUT_OBJECT_CLA
See Also:
Constant Field Values

OUT_OBJECT_ID

private static final short OUT_OBJECT_ID
See Also:
Constant Field Values

PIN_CHARSET_LC_LETTERS

private static final byte PIN_CHARSET_LC_LETTERS
Lower case letters

See Also:
Constant Field Values

PIN_CHARSET_NUMBERS

private static final byte PIN_CHARSET_NUMBERS
Numbers are allowed

See Also:
Constant Field Values

PIN_CHARSET_OTHERS

private static final byte PIN_CHARSET_OTHERS
Other binary codes (NUMBERS | OTHERS excludes LETTERS and PUNCT)

See Also:
Constant Field Values

PIN_CHARSET_PUNCT

private static final byte PIN_CHARSET_PUNCT
Punctuation symbols: , .

See Also:
Constant Field Values

PIN_CHARSET_UC_LETTERS

private static final byte PIN_CHARSET_UC_LETTERS
Upper case letters

See Also:
Constant Field Values

PIN_INIT_VALUE

private static byte[] PIN_INIT_VALUE

PIN_MIXED_ALL

private static final byte PIN_MIXED_ALL
PIN must at least contain 1 char from each char set

See Also:
Constant Field Values

PIN_MIXED_CASE

private static final byte PIN_MIXED_CASE
PIN must at least contain chars from both upper and lower case

See Also:
Constant Field Values

PIN_MIXED_TWO

private static final byte PIN_MIXED_TWO
PIN must contain chars from at least 2 different char sets

See Also:
Constant Field Values

PIN_POLICY_CHARSET

private static final byte PIN_POLICY_CHARSET
Enable pin charset check

See Also:
Constant Field Values

PIN_POLICY_MIXED

private static final byte PIN_POLICY_MIXED
Enable charset mixing check

See Also:
Constant Field Values

PIN_POLICY_SIZE

private static final byte PIN_POLICY_SIZE
Enable pin size check

See Also:
Constant Field Values

pinMaxSize

private static final byte pinMaxSize
See Also:
Constant Field Values

pinMinSize

private static final byte pinMinSize
See Also:
Constant Field Values

pinPolicies

private static final byte pinPolicies
See Also:
Constant Field Values

pins

private javacard.framework.OwnerPIN[] pins

randomData

private javacard.security.RandomData randomData

setupDone

private boolean setupDone

signatures

private javacard.security.Signature[] signatures

STD_PUBLIC_ACL

private static byte[] STD_PUBLIC_ACL

SW_AUTH_FAILED

private static final short SW_AUTH_FAILED
Entered PIN is not correct

See Also:
Constant Field Values

SW_IDENTITY_BLOCKED

private static final short SW_IDENTITY_BLOCKED
Operation has been blocked for security reason

See Also:
Constant Field Values

SW_INCORRECT_ALG

private static final short SW_INCORRECT_ALG
Algorithm specified is not correct

See Also:
Constant Field Values

SW_INCORRECT_P1

private static final short SW_INCORRECT_P1
Incorrect P1 parameter

See Also:
Constant Field Values

SW_INCORRECT_P2

private static final short SW_INCORRECT_P2
Incorrect P2 parameter

See Also:
Constant Field Values

SW_INTERNAL_ERROR

private static final short SW_INTERNAL_ERROR
For debugging purposes

See Also:
Constant Field Values

SW_INVALID_PARAMETER

private static final short SW_INVALID_PARAMETER
Invalid input parameter to command

See Also:
Constant Field Values

SW_NO_MEMORY_LEFT

private static final short SW_NO_MEMORY_LEFT
There have been memory problems on the card

See Also:
Constant Field Values

SW_OBJECT_EXISTS

private static final short SW_OBJECT_EXISTS
New object ID already in use

See Also:
Constant Field Values

SW_OBJECT_NOT_FOUND

private static final short SW_OBJECT_NOT_FOUND
Required object is missing

See Also:
Constant Field Values

SW_OPERATION_NOT_ALLOWED

private static final short SW_OPERATION_NOT_ALLOWED
Required operation is not allowed in actual circumstances

See Also:
Constant Field Values

SW_SEQUENCE_END

private static final short SW_SEQUENCE_END
No more data available

See Also:
Constant Field Values

SW_SIGNATURE_INVALID

private static final short SW_SIGNATURE_INVALID
Verify operation detected an invalid signature

See Also:
Constant Field Values

SW_UNAUTHORIZED

private static final short SW_UNAUTHORIZED
Required operation was not authorized because of a lack of privileges

See Also:
Constant Field Values

SW_UNSUPPORTED_FEATURE

private static final short SW_UNSUPPORTED_FEATURE
Required feature is not (yet) supported

See Also:
Constant Field Values

ublk_pins

private javacard.framework.OwnerPIN[] ublk_pins

VERSION_APPLET_MAJOR

private static final byte VERSION_APPLET_MAJOR
See Also:
Constant Field Values

VERSION_APPLET_MINOR

private static final byte VERSION_APPLET_MINOR
See Also:
Constant Field Values

VERSION_PROTOCOL_MAJOR

private static final byte VERSION_PROTOCOL_MAJOR
See Also:
Constant Field Values

VERSION_PROTOCOL_MINOR

private static final byte VERSION_PROTOCOL_MINOR
See Also:
Constant Field Values
Constructor Detail

CardEdge

private CardEdge(byte[] bArray,
                 short bOffset,
                 byte bLength)
Method Detail

authorizeKeyRead

boolean authorizeKeyRead(byte key_nb)
Check from ACL if a key can be read


authorizeKeyUse

boolean authorizeKeyUse(byte key_nb)
Check from ACL if a key can be used


authorizeKeyWrite

boolean authorizeKeyWrite(byte key_nb)
Check from ACL if a key can be overwritten


ChangePIN

private void ChangePIN(APDU apdu,
                       byte[] buffer)

CheckPINPolicy

private boolean CheckPINPolicy(byte[] pin_buffer,
                               short pin_offset,
                               byte pin_size)
Checks if PIN policies are satisfied for a PIN code


ComputeCrypt

private void ComputeCrypt(APDU apdu,
                          byte[] buffer)
APDU handlers


CreateObject

private void CreateObject(APDU apdu,
                          byte[] buffer)

CreatePIN

private void CreatePIN(APDU apdu,
                       byte[] buffer)

DeleteObject

private void DeleteObject(APDU apdu,
                          byte[] buffer)

deselect

public void deselect()

ExportKey

private void ExportKey(APDU apdu,
                       byte[] buffer)

GenerateKeyPair

private void GenerateKeyPair(APDU apdu,
                             byte[] buffer)

GenerateKeyPairRSA

private void GenerateKeyPairRSA(byte[] buffer)

GetChallenge

private void GetChallenge(APDU apdu,
                          byte[] buffer)

getCipher

private Cipher getCipher(byte key_nb,
                         byte alg_id)

getCurrentACL

byte[] getCurrentACL()
Returns an ACL that requires current logged in identities.


getKey

private Key getKey(byte key_nb,
                   byte key_type,
                   short key_size)
Retrieves the Key object to be used w/ the specified key number, key type (KEY_XX) and size.

If exists, check it has the proper key type * If not, creates it.

Returns:
Retrieved Key object
Throws:
SW_UNATUTHORIZED
SW_OPERATION_NOT_ALLOWED

getKeyType

private byte getKeyType(Key key)

getRestrictedACL

byte[] getRestrictedACL()
Returns an ACL that disables all operations for the application.


getSignature

private Signature getSignature(byte key_nb,
                               byte alg_id)

GetStatus

private void GetStatus(APDU apdu,
                       byte[] buffer)

ImportKey

private void ImportKey(APDU apdu,
                       byte[] buffer)

install

public static void install(byte[] bArray,
                           short bOffset,
                           byte bLength)

keyType2JCType

private byte keyType2JCType(byte key_type)

ListKeys

private void ListKeys(APDU apdu,
                      byte[] buffer)

ListObjects

private void ListObjects(APDU apdu,
                         byte[] buffer)

ListPINs

private void ListPINs(APDU apdu,
                      byte[] buffer)

LoginStrongIdentity

private void LoginStrongIdentity(byte key_nb)
Registers login of strong identity associated with a key number


LogOutAll

private void LogOutAll()

LogoutIdentity

private void LogoutIdentity(byte id_nb)
Registers logout of an identity.

This must be called anycase when a PIN verification or external authentication fail


process

public void process(APDU apdu)

ReadObject

private void ReadObject(APDU apdu,
                        byte[] buffer)

select

public boolean select()

sendData

private void sendData(APDU apdu,
                      byte[] data,
                      short offset,
                      short size)
UTILITY FUNCTIONS


setup

private void setup(APDU apdu,
                   byte[] buffer)

ThrowDeleteObjects

private void ThrowDeleteObjects(short exception)
Deletes and zeros the IO objects and throws the passed in exception


UnblockPIN

private void UnblockPIN(APDU apdu,
                        byte[] buffer)

VerifyPIN

private void VerifyPIN(APDU apdu,
                       byte[] buffer)

WriteObject

private void WriteObject(APDU apdu,
                         byte[] buffer)