mixconfig.tools.dataretention.DataRetentionSmartCard Class Reference

List of all members.

Public Member Functions

List GetReaderList ()
boolean connectToSmartCard () throws Exception
void DisconnectFromCard () throws Exception
MyRSAPublicKey retrievePublicKey () throws Exception
byte[] EncryptLogKey (byte[] logKey, byte day, byte month, short year, PublicKey publicKey) throws Exception
int GetExpectedLogLineLength (int plainDataLength) throws Exception
byte[] EncryptLogLine (byte[] logKey, byte[] data, byte[] iv) throws Exception
byte[] DecryptLogLine (byte[] encrLogKey, byte[] encrData, byte[] iv) throws Exception
byte[] DecryptLogLineKey (byte[] logKey, byte[] encrData, byte[] iv) throws Exception
boolean authenticateUser (byte[] pin) throws Exception
boolean Admin_Authenticate (byte[] key) throws Exception
boolean Admin_SetCurrentDate (byte day, byte month, short year) throws Exception
boolean Admin_SetAdminPIN (byte[] newPINValue) throws Exception
boolean Admin_UnblockUserPIN (byte[] newPINValue) throws Exception
byte[] decrpytSymmetricKey (byte[] encryptedKey) throws Exception
byte[] CreateIV (int blocksCounter)
byte[] CreateFooter (byte[] logKey, int blocksCounter) throws Exception
int VerifyFooter (byte[] logKey, byte[] footer, int counter) throws Exception
String byteToHex (byte data)
char toHexChar (int i)
String bytesToHex (byte[] data)

Static Public Attributes

static final byte DATE_LENGTH = (short) 0x04
static final byte DATE_AUTH_TAG_LENGTH = (short) 0x10
static final short GCM_AUTH_TAG_LENGTH = (short) 128
static final short ENCRYPTED_KEY_LENGTH = (short) 256
static byte entity_entry_lengths [] = {(byte) 0, (byte) 18, (byte) 16, (byte) 18, (byte) 12}
static final short AES_BLOCK_LENGTH = (short) 16
static final short AES128_KEY_LENGTH = (short) 16

Package Attributes

CardTerminal m_terminal = null
CardChannel m_channel = null
Card m_card = null

Private Member Functions

ResponseAPDU sendAPDU (byte apdu[]) throws Exception

Private Attributes

final byte OFFSET_CLA = 0x00
final byte OFFSET_INS = 0x01
final byte OFFSET_P1 = 0x02
final byte OFFSET_P2 = 0x03
final byte OFFSET_LC = 0x04
final byte OFFSET_DATA = 0x05
final byte HEADER_LENGTH = 0x05
final short RSA_KEY_LENGTH = (short) 256
final byte CLA_ANON = (byte) 0xB0
final byte INS_AUTHADMIN = 0x30
final byte INS_SETDATE = 0x31
final byte INS_UNBLOCKUSERPIN = 0x32
final byte INS_SETADMINPIN = 0x33
final byte INS_AUTHUSER = (byte) 0x50
final byte INS_GETLOGKEY = (byte) 0x51
final byte INS_GETPUBLICKEY_EXP = (byte) 0x52
final byte INS_GETPUBLICKEY_MOD = (byte) 0x53
final byte ANON_LOG_KEY_LENGTH = (byte) 0x10
final short APDU_DATA_LENGTH = (short) 0xc8
final byte selectANONApplet []

Static Private Attributes

static final short EXCEPTION_NEW_DATE_IN_PAST = (short) 0x6001
static final short EXCEPTION_OUTSIDE_RETENTION_PERIOD = (short) 0x6002
static final short SW_SECURITY_STATUS_NOT_SATISFIED = (short) 0x6002


Detailed Description

Author:
Petr Svenda

Member Function Documentation

List mixconfig.tools.dataretention.DataRetentionSmartCard.GetReaderList (  ) 

Method returns list of smart card readers available in system

Returns:
readersList

Referenced by mixconfig.tools.dataretention.DataRetentionSmartCard.connectToSmartCard().

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.connectToSmartCard (  )  throws Exception

void mixconfig.tools.dataretention.DataRetentionSmartCard.DisconnectFromCard (  )  throws Exception

Method disconnect from cad and close session

References mixconfig.tools.dataretention.DataRetentionSmartCard.m_card.

MyRSAPublicKey mixconfig.tools.dataretention.DataRetentionSmartCard.retrievePublicKey (  )  throws Exception

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.EncryptLogKey ( byte[]  logKey,
byte  day,
byte  month,
short  year,
PublicKey  publicKey 
) throws Exception

Method encrypts provided log key by public key of secure hardware (e.g. smart card) together with date of log key creation. Log key can be retrieved back only of entity controling private key (smart card) verifies date to be in data retention period.

Parameters:
logKey value of symmetrci cryptography key used to encrypt log entries
day actual day of log file creation
month actual month of log file creation
year actual year of log file creation
publicKey RSA public key used to store log key.
Returns:
encrypted block by publicKey with logKey and date inside

References mixconfig.tools.dataretention.DataRetentionSmartCard.ANON_LOG_KEY_LENGTH, mixconfig.tools.dataretention.DataRetentionSmartCard.bytesToHex(), mixconfig.tools.dataretention.DataRetentionSmartCard.DATE_AUTH_TAG_LENGTH, and mixconfig.tools.dataretention.DataRetentionSmartCard.DATE_LENGTH.

int mixconfig.tools.dataretention.DataRetentionSmartCard.GetExpectedLogLineLength ( int  plainDataLength  )  throws Exception

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.EncryptLogLine ( byte[]  logKey,
byte[]  data,
byte[]  iv 
) throws Exception

Method encrypts provided data in GCM mode with AES 128bits keys

Parameters:
logKey value of symmetrci cryptography key used to encrypt log entries
data raw log data to be encrypted
iv initialization vector used to symmetric cryptography encryption
year actual year of log file creation
publicKey RSA public key used to store log key. Log key can be retrieved back only of entity controling private key (smart card) verifies date to be in data retention period
Returns:
encrypted block by publicKey with logKey and date inside

References mixconfig.tools.dataretention.DataRetentionSmartCard.GCM_AUTH_TAG_LENGTH.

Referenced by mixconfig.tools.dataretention.DataRetentionSmartCard.CreateFooter().

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.DecryptLogLine ( byte[]  encrLogKey,
byte[]  encrData,
byte[]  iv 
) throws Exception

Method tries to retrieve decrypted log key from smart card and then decrypt provided data. Key is returned only if request is within data reteion period. User must be authenticated to smart card by User_Authenticate() method in advance.

Parameters:
encrLogKey encrypted value of symmetric cryptography key used to encrypt log entries
encrData encrypted raw log data to be decrypted
iv initialization vector used to symmetric cryptography encryption
Returns:
decrypted raw log data

References mixconfig.tools.dataretention.DataRetentionSmartCard.decrpytSymmetricKey(), and mixconfig.tools.dataretention.DataRetentionSmartCard.DecryptLogLineKey().

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.DecryptLogLineKey ( byte[]  logKey,
byte[]  encrData,
byte[]  iv 
) throws Exception

Method decrypt provided data with provided log key.

Parameters:
logKey AES128bits key used to encrypt log entries
encrData encrypted raw log data to be decrypted
iv initialization vector used to symmetric cryptography encryption
Returns:
decrypted raw log data

References mixconfig.tools.dataretention.DataRetentionSmartCard.GCM_AUTH_TAG_LENGTH.

Referenced by mixconfig.tools.dataretention.DataRetentionSmartCard.DecryptLogLine(), mixconfig.tools.dataretention.RetentionDlg.retrieveLogsActionPerformed(), and mixconfig.tools.dataretention.DataRetentionSmartCard.VerifyFooter().

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.authenticateUser ( byte[]  pin  )  throws Exception

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.Admin_Authenticate ( byte[]  key  )  throws Exception

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.Admin_SetCurrentDate ( byte  day,
byte  month,
short  year 
) throws Exception

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.Admin_SetAdminPIN ( byte[]  newPINValue  )  throws Exception

boolean mixconfig.tools.dataretention.DataRetentionSmartCard.Admin_UnblockUserPIN ( byte[]  newPINValue  )  throws Exception

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.decrpytSymmetricKey ( byte[]  encryptedKey  )  throws Exception

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.CreateIV ( int  blocksCounter  ) 

Method creates proper raw initialization vector from value of blocksCounter.

Parameters:
blocksCounter Actual counter of blocks (aka log lines)
Returns:
Array with initialization vector.

Referenced by mixconfig.tools.dataretention.DataRetentionSmartCard.CreateFooter(), and mixconfig.tools.dataretention.RetentionDlg.retrieveLogsActionPerformed().

byte [] mixconfig.tools.dataretention.DataRetentionSmartCard.CreateFooter ( byte[]  logKey,
int  blocksCounter 
) throws Exception

Method creates footer from total number of blocks value and encrypts it with log key for this file.

Parameters:
blocksCounter Total blocks (aka log lines) in file.
Returns:
Array with footer bytes.

References mixconfig.tools.dataretention.DataRetentionSmartCard.CreateIV(), and mixconfig.tools.dataretention.DataRetentionSmartCard.EncryptLogLine().

int mixconfig.tools.dataretention.DataRetentionSmartCard.VerifyFooter ( byte[]  logKey,
byte[]  footer,
int  counter 
) throws Exception

Method verifies footer integrity and return number of blocks (log lines) stored in file.

Parameters:
logKey Log key used to encrypt and MAC file
footer Encrypted footer.
counter Expected value of blocks stored in file - must be supplied as is used as IV for decryption.
Returns:
Number of blocks that should be present in file.

References mixconfig.tools.dataretention.DataRetentionSmartCard.DecryptLogLineKey().

Referenced by mixconfig.tools.dataretention.RetentionDlg.retrieveLogsActionPerformed().

String mixconfig.tools.dataretention.DataRetentionSmartCard.byteToHex ( byte  data  ) 

char mixconfig.tools.dataretention.DataRetentionSmartCard.toHexChar ( int  i  ) 

String mixconfig.tools.dataretention.DataRetentionSmartCard.bytesToHex ( byte[]  data  ) 

ResponseAPDU mixconfig.tools.dataretention.DataRetentionSmartCard.sendAPDU ( byte  apdu[]  )  throws Exception [private]


Member Data Documentation

Initial value:

 {
        (byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x00, (byte) 0x0D, (byte) 0x41, (byte) 0x4E, (byte) 0x4F, (byte) 0x4E,
        (byte) 0x4C, (byte) 0x6F, (byte) 0x67, (byte) 0x41, (byte) 0x70, (byte) 0x70, (byte) 0x6C, (byte) 0x65, (byte) 0x74}

Referenced by mixconfig.tools.dataretention.DataRetentionSmartCard.connectToSmartCard().

byte mixconfig.tools.dataretention.DataRetentionSmartCard.entity_entry_lengths[] = {(byte) 0, (byte) 18, (byte) 16, (byte) 18, (byte) 12} [static]


The documentation for this class was generated from the following file:

Generated on Mon Nov 16 23:24:48 2009 for MixConfig by  doxygen 1.5.6