GPK2000

The gpk2k package, gpk2k::, brings into Tcl the commands to Gemplus's cryptographic GPK2000 smart card.

Here are some sample Tcl scripts using this package:

Here are the 36 commands on the Gemplus GPK2000 interface.

Function

Description

Tcl Usage

Args

Append Record

Append to a record file

gpk2k::appendRecord

 

Card Information

Get some card information from the card

gpk2k::cardInfo

 

Compute DES Key

Computes a DES session key

gpk2k::desKey

 

Create Directory

Create a new directory in the current directory

gpk2k::createDF

 

Create File

Create a new elementary file in the current directory

gpk2k::createEF

 

Create Private Key File

Create a file in which to place an RSA private key.

gpk2k::createPrivateKeyFile

 

DES Encrypt

DES encrypt a block of data using CBC mode.

gpk2k::desEncrypt

 

Erase Card

Zeroizes the card during personalization.

gpk2k::eraseCard

 

Freeze Access

Make the access conditions on a file permanent

gpk2k::freezeAC

 

Get Challenge

Get a random byte block from the card.

gpk2k::getChallenge

 

Get Response

Retrieve waiting data from the smartcard

gpk2k::getResponse

 

Internal Authenticate

Prove that the smartcard has a secret key

gpk2k::internalAuthenticate

 

Load Cryptographic Parameters

Load cryptographic parameters onto the card.

gpk2k::putCryptoData

 

Load Private Key

Load a private key into a private key file.

gpk2k::loadPrivateKey

 

Public Key Direcotry

Obtain a list of the public keys in the current directory.

gpk2k::publicKeyDirectory

 

Public Key Load

Load a public key into the current directory.

gpk2k::publicKeyLoad

 

Public Key Verify

Verify a signature using a public key.

gpk2k::publicKeyVerify

 

Public Sign

Sign a data block with a public key.

gpk2k::publicKeySign

 

Read Binary

Read data from a transparent file

gpk2k::readBinary offset len data

offset - starting offset
len - length to read
data - the data read

Read Binary SFI

Read data from a transparent file named by its short file identifier (SFI)

gpk2k::readBinary offset len data

offset - starting offset
len - length to read
data - the data read

Read Record

Read from a record file

gpk2k::readRecord

 

Select a Cryptograpic Conntext

Select a cryptographic parameter set.

gpk2k::selectCryptoContext

 

Select File

Select a file for subsequent file operations.

gpk2k::selectFile fileID

fileID - the numeric fileID

Select File by Name

Select a file for subsequent file operations by giving its full name.

gpk2k::selectFile fileID

fileID - the numeric fileID

Select Parent

Make parent of current directory the current directory

gpk2k::selectFile fileID

fileID - the numeric fileID

Select Session Key

Generate a session key for secure messaging

gpk2k::selectSessionKey

 

Set Code

Unblock or change a key

   

Set Lock

Set the Personalization Flag

gpk2k::setLock

 

Set Speed

Set the communication speed of the card

gpk2k::setSpeed

 

Update Binary

Update data in a transparent file

gpk2k::updateBinary offset len data

offset - starting offset
len - length to update
data - the data to update

Update Binary by SFI

Update data in a transparent file named by its short file identifier (SFI)

gpk2k::updateBinarySFI offset len data

offset - starting offset
len - length to update
data - the data to update

Update Record

Update within a record file

gpk2k::updateRecord

 

Update Record by SFI

Update within a record file named by its short file identifier (SFI)

gpk2k::updateRecordSFI

 

Verify

Check for a match of given key

gpk2k::verify

keyNum - index of key in external authentication file

key - 8-byte key

Write Binary

Write data in a transparent file

gpk2k::writeBinary offset len data

offset - starting offset
len - length to update
data - the data to update

Write Binary by SFI

Write data in a transparent file named by its short file identifier (SFI)

gpk2k::writeBinarySFI offset len data

offset - starting offset
len - length to update
data - the data to update

 

The Compute DES Key and DES Encrypt commands are only available on the GP2000-sp card.

The following commands have secured message variants, indicated by the SM suffix on the command name: appendRecord_SM, createDF_SM, createEF_SM, freezeAC_SM, readBinary_SM, readBinarySFI_SM, readRecord_SM, setCode_SM, updateBinary_SM, updateBinarySFI_SM, updateRecord_SM, verify_SM, writeBinary_SM, and writeBinarySFI_SM.