0x01 Création d'un owner
jtt take_owner -o passOwner
11:06:49:519 [INFO] TakeOwnership::execute (113): TPM ownership command is disabled
0x02 Génération d'une clé
jtt take_owner -o passOwner
11:06:49:519 [INFO] TakeOwnership::execute (113): TPM ownership command is disabled
Structure des clés TPM |
Usage: pkcs15-init [OPTIONS]
Options:
-E, --erase-card Erase the smart card
-C, --create-pkcs15 Creates a new PKCS #15 structure
-P, --store-pin Store a new PIN/PUK on the card
-G, --generate-key <arg> Generate a new key and store it on the card
-S, --store-private-key <arg>
Store private key
--store-public-key <arg> Store public key
-X, --store-certificate <arg>
Store an X.509 certificate
-U, --update-certificate <arg>
Update an X.509 certificate (carefull with mail decryption certs!!)
-W, --store-data <arg> Store a data object
-D, --delete-objects <arg> Delete object(s) (use "help" for more information)
-A, --change-attributes <arg>
Change attribute(s) (use "help" for more information)
--sanity-check Card specific sanity check and possibly update procedure
--erase-application <arg>
Erase application with AID <arg>
-r, --reader <arg> Specify which reader to use
--pin <arg> Specify PIN
--puk <arg> Specify unblock PIN
--so-pin <arg> Specify security officer (SO) PIN
--so-puk <arg> Specify unblock PIN for SO PIN
--no-so-pin Do not install a SO PIN, and do not prompt for it
--serial <arg> Specify the serial number of the card
-a, --auth-id <arg> Specify ID of PIN to use/create
--puk-id <arg> Specify ID of PUK to use/create
--verify-pin Verify PIN after card binding (use with --auth-id)
-i, --id <arg> Specify ID of key/certificate
-l, --label <arg> Specify label of PIN/key
--puk-label <arg> Specify label of PUK
--public-key-label <arg> Specify public key label (use with --generate-key)
--cert-label <arg> Specify user cert label (use with --store-private-key)
--application-name <arg> Specify application name of data object (use with --store-data-object)
--application-id <arg> Specify application id of data object (use with--store-data-object)
--aid <arg> Specify AID of the on-card PKCS#15 application to be binded to (in hexadecimal form)
-o, --output-file <arg> Output public portion of generated key to file
-f, --format <arg> Specify key/cert file format: PEM (=default), DER or PKCS12
--passphrase <arg> Specify passphrase for unlocking secret key
--authority Mark certificate as a CA certificate
-u, --key-usage <arg> Specify X.509 key usage (use "--key-usage help" for more information)
-F, --finalize Finish initialization phase of the smart card
--update-last-update Update 'lastUpdate' attribut of tokenInfo
--ignore-ca-certificates When storing PKCS#12 ignore CA certificates
--extractable Private key stored as an extractable key
--insecure Insecure mode: do not require a PIN for private key
-T, --use-default-transport-keys
Do not ask for transport keys if the driver thinks it knows the key
--no-prompt Do not prompt the user; if no PINs supplied, pin pad will be used
-p, --profile <arg> Specify the general profile to use
-c, --card-profile <arg> Specify the card profile to use
--options-file <arg> Read additional command line options from file
-w, --wait Wait for card insertion
-h, --help Display this message
-v, --verbose Verbose operation. Use several times to enable debug output.
Usage: pkcs15-tool [OPTIONS]
Options:
-L, --learn-card Stores card info to cache
--list-applications List the on-card PKCS#15 applications
-r, --read-certificate <arg> Reads certificate with ID <arg>
-c, --list-certificates Lists certificates
-R, --read-data-object <arg> Reads data object with OID, applicationName or label <arg>
-C, --list-data-objects Lists data objects
--list-pins Lists PIN codes
--list-secret-keys Lists secret keys
-D, --dump Dump card objects
-u, --unblock-pin Unblock PIN code
--change-pin Change PIN or PUK code
-k, --list-keys Lists private keys
--list-public-keys Lists public keys
--read-public-key <arg> Reads public key with ID <arg>
--read-ssh-key <arg> Reads public key with ID <arg>, outputs ssh format
-T, --test-update Test if the card needs a security update
-U, --update Update the card with a security update
--reader <arg> Uses reader number <arg>
--pin <arg> Specify PIN
--new-pin <arg> Specify New PIN (when changing or unblocking)
--puk <arg> Specify Unblock PIN
--verify-pin Verify PIN after card binding (without 'auth-id' the first non-SO, non-Unblock PIN will be verified)
-o, --output <arg> Outputs to file <arg>
--no-cache Disable card caching
-a, --auth-id <arg> The auth ID of the PIN to use
--aid <arg> Specify AID of the on-card PKCS#15 application to bind to (in hexadecimal form)
-w, --wait Wait for card insertion
-v, --verbose Verbose operation. Use several times to enable debug output.
Usage: pkcs15-crypt [OPTIONS]
Options:
-s, --sign Performs digital signature operation
-c, --decipher Decipher operation
-k, --key <arg> Selects the private key ID to use
-r, --reader <arg> Uses reader number <arg>
-i, --input <arg> Selects the input file to use
-o, --output <arg> Outputs to file <arg>
-R, --raw Outputs raw 8 bit data
--sha-1 Input file is a SHA-1 hash
--sha-256 Input file is a SHA-256 hash
--sha-384 Input file is a SHA-384 hash
--sha-512 Input file is a SHA-512 hash
--sha-224 Input file is a SHA-224 hash
--md5 Input file is a MD5 hash
--pkcs1 Use PKCS #1 v1.5 padding
-p, --pin <arg> Uses password (PIN) <arg> (use - for reading PIN from STDIN)
--aid <arg> Specify AID of the on-card PKCS#15 application to be binded to (in hexadecimal form)
-w, --wait Wait for card insertion
-v, --verbose Verbose operation. Use several times to enable debug output.
Usage: pkcs11-tool [OPTIONS]
Options:
--module <arg> Specify the module to load (mandatory)
-I, --show-info Show global token information
-L, --list-slots List available slots
-T, --list-token-slots List slots with tokens
-M, --list-mechanisms List mechanisms supported by the token
-O, --list-objects Show objects on token
-s, --sign Sign some data
-h, --hash Hash some data
--derive Derive a secret key using another key and some data
-m, --mechanism <arg> Specify mechanism (use -M for a list of supported mechanisms)
-l, --login Log into the token first
--login-type <arg> Specify login type ('so', 'user', 'context-specific'; default:'user')
-p, --pin <arg> Supply User PIN on the command line (if used inscripts: careful!)
--puk <arg> Supply User PUK on the command line
--new-pin <arg> Supply new User PIN on the command line
--so-pin <arg> Supply SO PIN on the command line (if used in scripts: careful!)
--init-token Initialize the token, its label and its SO PIN (use with --label and --so-pin)
--init-pin Initialize the User PIN (use with --pin and --login)
-c, --change-pin Change User PIN
--unlock-pin Unlock User PIN (without '--login' unlock in logged in session; otherwise '--login-type' has to be 'context-specific')
-k, --keypairgen Key pair generation
--key-type <arg> Specify the type and length of the key to create, for example rsa:1024 or EC:prime256v1
--usage-sign Specify 'sign' key usage flag
--usage-decrypt Specify 'decrypt' key usage flag
--usage-nonrepudiation Specify 'nonrepudiation' key usage flag
-w, --write-object <arg> Write an object (key, cert, data) to the card
-r, --read-object Get object's CKA_VALUE attribute (use with --type)
-b, --delete-object Delete an object
--application-label <arg>
Specify the application label of the data object(use with --type data)
--application-id <arg> Specify the application ID of the data object (use with --type data)
--issuer <arg> Specify the issuer in hexadecimal format (use with --type cert)
--subject <arg> Specify the subject in hexadecimal format (use with --type cert/privkey/pubkey)
-y, --type <arg> Specify the type of object (e.g. cert, privkey,pubkey, data)
-d, --id <arg> Specify the ID of the object
-a, --label <arg> Specify the label of the object
--slot <arg> Specify the ID of the slot to use
--slot-description <arg> Specify the description of the slot to use
--slot-index <arg> Specify the index of the slot to use
--token-label <arg> Specify the token label of the slot to use
-e, --set-id <arg> Set the CKA_ID of an object, <args>= the (new) CKA_ID
--attr-from <arg> Use <arg> to create some attributes when writing an object
-i, --input-file <arg> Specify the input file
-o, --output-file <arg> Specify the output file
-t, --test Test (best used with the --login or --pin option)
--test-hotplug Test hotplug capabilities (C_GetSlotList + C_WaitForSlotEvent)
-z, --moz-cert <arg> Test Mozilla-like keypair gen and cert req, <arg>=certfile
-v, --verbose Verbose operation. (Set OPENSC_DEBUG to enable OpenSC specific debugging)
--private Set the CKA_PRIVATE attribute (object is only viewable after a login)
--test-ec Test EC (best used with the --login or --pin option)
$ opensc-tool --list-readers
# Detected readers (pcsc)
Nr. Card Features Name
0 Yes USB CCID Smart Card Reader 0
$ opensc-tool -reader 0 --name
Using reader with a card: USB CCID Smart Card Reader 0
Failed to connect to card: Card not present
$ opensc-tool -reader 0 --name
Using reader with a card: USB CCID Smart Card Reader 0
AuthentIC v5
$ pkcs15-tool --list-pins
Using reader with a card: USB CCID Smart Card Reader 0
PIN [SO PIN]
Object Flags : [0x3], private, modifiable
ID : ff
Flags : [0xB1], case-sensitive, initialized, needs-padding, soPin
Length : min_len:4, max_len:64, stored_len:64
Pad char : 0xFF
Reference : 132 (0x84)
Type : ascii-numeric
Tries left : 3
PIN [SCM]
Object Flags : [0x3], private, modifiable
ID : 53434d
Flags : [0x33], case-sensitive, local, initialized, needs-padding
Length : min_len:4, max_len:64, stored_len:64
Pad char : 0xFF
Reference : 129 (0x81)
Type : ascii-numeric
Path : 3f005011
Tries left : 1
$ pkcs15-init -C --label "FirasCard" Using reader with a card: USB CCID Smart Card Reader 0 New Security Officer PIN (Optional - press return for no PIN). Please enter Security Officer PIN:
Failed to create PKCS #15 meta structure: Sec urity status not satisfied
$ pkcs15-init -C --label "FirasCard" Using reader with a card: USB CCID Smart Card Reader 0 New Security Officer PIN (Optional - press return for no PIN). Please enter Security Officer PIN: Please type again to verify:
Failed to create PKCS #15 meta structure: Security status not satisfied
C:\Program Files (x86)\OpenSC Project\OpenSC\tools
$ opensc-tool --list-readers
$ opensc-tool --reader 0 --atr
$ opensc-tool --reader 0 --name
$ pkcs11-tool --module=c:\Windows\System32\opensc-pkcs11.dll -l -O