Document toolboxDocument toolbox

Certificates and keys in Identity Manager

This article includes updates for Smart ID 23.10.5 

An encoding description contains the information for the electronic personalization of a card. You import the encoding description from a file. This article describes how you create descriptions on how to handle certificates and keys. This can be used in Smart ID Identity Manager.

See also Structure of an encoding description in Identity Manager.

Read and write certificates

Write a certificate

Define like this in the encoding description:

[Fields] CERT_FIELD= ... [Application_A] WriteCertificate=true Certificate=CERT_FIELD

Description of the elements:

Element

Description

Element

Description

WriteCertificate=true

Triggers to write a certificate.

Certificate=...

Specifies from which defined field the certificate is taken. The field's value has to be a base64 encoded X.509 certificate.

Write a Certificate-Key-List

Use this application command to write a structure of base64 encoded certificate and base64 encoded keypair to the smartcard. It can be used as a surrogate to writing a PKCS#12 container directly to the smartcard (even with root and intermediate certificates, that have no private key attached).

Define like this in the encoding description:

[Fields] ENCR_CERT_KEY_LIST= ENCR_CERT_KEY_LIST_RETURN= ... [Application_C] WriteCertKeyList=true CertKeyList=ENCR_CERT_KEY_LIST CertKeyListReturnField=ENCR_CERT_KEY_LIST_RETURN CertKeyListMode=WRITE_ANY_BUT_MANDATORILY_THE_FIRST

Description of the elements:

Element

Description

Element

Description

WriteCertKeyList=true

Triggers to write a certificate-key-list.

CertKeyList=... 

The description key for the input string. (Corresponds to the structure: "<1. cert>,<1. private key>;<2. cert>,<2. private key>;..." without the square brackets, see examples below. You can pass one or multiple certificate-key like that, each base64 encoded.)

The base64 encoded certificate is left-handed to the comma separator and the base64 encoded private key (if any, otherwise empty) is right-handed to the comma separator and each pair of certificate-privatekey is terminated by a semicolon. The certificate and private key are both in DER encoded format and then each base64 encoded.

CertKeyListReturnField=...

The description key where to set the field definition that later gets the list of written certificates.

CertKeyListMode=...

Sets the mode for reacting on errors when writing the certificate-key-list to the smartcard. Options are:

  • WRITE_ALL (default) - All certificates and keypairs have to be successfully written, otherwise the application was not successful.

  • WRITE_ANY - This is the "don't care" case.

  • WRITE_ANY_BUT_MANDATORILY_THE_FIRST - In this mode the first certificate-key has to be mandatorily written successfully (the others may be not written) in order to have this application be successful.

The certificates are sorted chronologically (newer certificates first), that is, if the card is full (and you did not set "WRITE_ALL"), only some older certificates may be unwritten.

Note: StoreUserCertsOnly is ignored for the WriteCertKeyList use-case and all certs from the list are written.

Delete certificates and other objects

Delete certificates

To delete certificates (and optionally their associated keys) on a token, it can be necessary to select special certificates by a selection criteria.

Define like this in the encoding description:

[Fields] DEL_CRITERIA= [Application_A] DeleteCertKeyObjects=true DeleteCertKeyObjectsCriteria=DEL_CRITERIA [Application_B] DeleteCertKeyObjects=true DeleteCertsOnly=true DeleteCertKeyObjectsCriteria=Key_Usage(keyEncipherment,dataEncipherment)

Description of the elements:

Element

Description

Element

Description

DeleteCertKeyObjects=true

Enables deletion of certificates and their associated keys according to given criteria. The parameter name is historic and retained for compatibility.

DeleteCertsOnly=true

Overrides the default behavior of deleting certificates and keys and instead deletes certificates only.

DeleteCertKeyObjectsCriteria=... 

Defines the selection criteria to be used to find the certificates. This option can have one of these values:

  • SOME_FIELD_NAME
    The name of a mapped field, containing one of the deletion criteria shown below:

  • KeyUsage (fixed, comma-separated strings) 
    or
    Key_Usage (fixed, comma-separated strings)
    Pass at least one string, which can be mapped to an implementation of type ICertificateSelectionStrategy. Only certificates (with their keys) matching exactly these specified KeyUsage(s) will be deleted. Possible values are decipherOnly, encipherOnly, cRLSign, keyCertSign, keyAgreement, dataEncipherment, keyEncipherment, nonRepudiation, digitalSignature

  • Label (fixed string)
    The label of the certificate and keypair to be deleted. Only one value can be set here. To delete more than one certificate by label, add multiple applications.

  • CertSerial (fixed, comma-separated strings)
    or
    Cert_Serial (fixed, comma-separated strings)
    Pass at least one certificate serial number in hex-format.

It is not possible to leave the parentheses empty.

If you use a mapped field, you can link it to a process variable created e.g. via a Groovy script like this:

 

Delete orphan keys

Orphan keys are private and/or public keys that have no matching certificate on the card. This can happen for example when a keypair is created but the certification request fails because the CA is unreachable. Typically this leads to a useless keypair on the card.

You can delete such orphan keys. The keys can be selected by their label or you can delete all orphan keys of a card. If a key does have a matching certificate, it will not be deleted without raising any error.

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

DeleteOrphanKeys=Label(…)

This will trigger deletion of all orphan private and/or public keys with the labels specified. Several labels can be separated using comma. If the label is empty, like in the second example, all orphan public and private keys will be deleted.

Delete all objects from smartcard

This use case clears all objects (actually just public- and private keys and certificates) from the smartcard, instead of re-initializing the smartcard. This is done by searching all objects on the smartcard and executing a delete operation on each returned object handle. (You just need to login with PIN, to be able to also search for private keys and delete them. No PUK or SO-PIN needed.)

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

DeleteAllObjects=true

Triggers the use case.

Save certificate with specific object relation type

Save certificate with specific object relation type

You can specify the relation type between card and certificates. Otherwise the default is used (see Object Relation section in Identity Manager Admin):

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

ObjectRelationType=

Provides the possibility to save the card and certificate to a specified object relation type. If this is not provided in the encoding description, Identity Manager uses default relationship. 

PKCS#10 requests

Generates a key pair on the smartcard and then invokes a PKCS#10 request (Certificate Signing Request) to a CA (defined by a certificate template name). After receiving the response from the CA with the signed certificate (and optional CA certificates), the user certificate will be written to the beforehand generated key pair. Available CA certificates will also be written to the smartcard to form the chain of trust (can optionally be disabled, see heading "Skip Writing CA Certificates"). Afterwards the CKA_ID and labels of the keys will be modified to match the ones of the written user certificate.

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

CertTempl=... 

Defines the certificate template name to be used, which is configured to reference the CA and the token procedure on the CA.

PubKeyReturnField=...  (optional)

Set this to get the PublicKey back into the mapped fields, that is, into the task.

Temporary revoke a certificate right after P10-request

When requesting a certificate by CSR (P10-Request), it is very useful to also revoke that certificate right after it has been requested (inside jpki_encoder), that is, on client-side before communicating back to the server. This helps in cases where an error occurs and the server could, for example, not fulfil further steps with this certificate. It also benefits from better security when the certificates remains temporary revoked on the CA as long as the user, for example, retracts the temporary revocation on his certificate(s). This triggers a new communication to the CA right after the P10-Request.

On each application which requests a certificate, you could add a flag to indicate temporary revocation:

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

RevokeOnIssue=true

Triggers the temporary revocation directly in InvokeCaApplicationCommand right after the P10-Request.

RevocationReason=certificateHold

Sets the revocation reason to "certificateHold". This is also the default if no RevocationReason is set.

Create external card serial number and reuse value (CM)

Return card serial number from CM

Nexus Certificate Manager (CM) supports the token procedure type Smart Card. This token procedure type is used to describe various certificates on one type of smart card. When such a card is personalized, CM creates a unique card serial number. 

Define like this in the encoding description to let CM create the CM card serial number and return the value:

Description of the elements:

Element

Description

Element

Description

CardSerialNumberReturnField=...

Point it to a field.

Map the field in CardSerialNumberReturnField to the ${carddatapool_cardnumber} (or to generally any other process variable) and activate the 'read' option. In the example above the cardnumber value would be read from CM_CARD_NUMBER_RETURN_FIELD.

Specify card serial number

When requesting a certificate for an existing card, for example, in a second, third... application, you use the CardSerialNumberField and point it to a field containing the card serial number. In the following example, Application_A generates the card serial number and reuses the value in the second application to make sure, that the certificate is created on the same card as the previous certificate from Application_A.

Define like this in the encoding description:

Description of the elements:

Elements

Description

Elements

Description

CardSerialNumberReturnField=...

Point it to a field.

CardSerialNumberField=...

Point it to a field.

Add KeyUsage to specify the corresponding certificate

As a smartcard token procedure contains multiple certificates, we eventually need to specify the Key usage of the according certificate. This is done using the KeyUsage key in the description file. It corresponds to the key usage value(s) in the CM definition.

Define like this in the encoding description:

Note: KeyUsage attribute is ignored in the key archiving process.

Required configuration in Identity Manager Admin

The card serial number encoding field (named CM_CARD_NUMBER in the examples above) acts as output and input field for Identity Manager's encoding component.

It is required:

  • to map this field in the encoding mappings of the encoding description configuration to a Identity Manager variable or database field using an appropriate JUEL expression and

  • to set the Read flag for this field mapping.

Plain-text request

Plain-text requests are relevant, when:

  • Personal Desktop Client is used and

  • the used card profile does not allow to access the private key to sign the request.

Usually, the JPKI-Encoder creates a PKCS10 request that is sent to the server. But in special cases, a plain text request is required. Such profiles are used when customer's processes define, that the certificate/keypair is only activated in the field (by a separate mechanism). Note that the plain text request also requires a CM Token Procedure of type "Smart card". You cannot use the type "PKCS10" and "PKCS12" for this request. To turn on the plain text request, SendPlainTextRequest must be set to true. Regarding the data which is technically sent, see also the actual REST call content behind.

Key archiving does not make sense if there is no private key. The default (and only reasonable) option for KeyArchivalRequest in a plain-text request is false. Keep in mind to use the plain-text requests only if the PKCS10 can not be created. And it's only implemented for Nexus Certificate Manager

Define like this in the encoding description:
In the following example, all the certificate related fields (subject/distinguished name fields and subject alternative names, keysize, keyusage, the existing publickey and if keyarchival is requested), will be sent as parameters to the server.

Description of the elements:

Element

Description

Element

Description

SendPlainTextRequest=true

Triggers the use case.

For certain cards that contain pre-generated keys with CKA_ID, it may be required to set this as well, to read the existing ID instead of trying to generate it from the public key's modulus:

Key archival

Certificate and key pair are generated on the server and the card is written on the client. When using CardOS middleware, Secure Key Injection (SKI) is supported to transport the private key from the server to the smart card.

Key archival without Secure Key Injection

In the non SKI case, normal PKCS#12 file data is transferred from server to client instead of encrypted key pair.

Define like this in the encoding description:

Encoding Description details:

Description of the elements:

Element

Description

Element

Description

KeyArchivalRequest=true

Triggers the KeyArchivalRequestPreProcessor which executes the KeyArchival request at the CA.

WriteP12Data=true

Triggers the WriteP12KeyStoreApplicationCommand which writes P12 certificates to a token/smartcard.

Note: This flag is ignored for integrated CA connectors (they get their P12 data via a different mechanism: the client requests the application by ID from the integrated CA connector and receives the P12 data or SKI-encrypted key-pair in the response).

Certificate=P12Certificate_A

Mapping for the KeyArchival certificate returned by the server side KeyArchival request at the CA. This is ignored for integrated CA connectors (see above).

P12PASSWORD=P12PASSWORD_A

The P12 password used for the KeyArchival request. It is mandatory to set a P12PASSWORD for the KeyArchivalRequest.

CertTempl=...

Defines a certificate template name for the KeyArchival request at the CA.

ClearFields=...

Remember to set ClearFields=... otherwise the P12 container and the P12 password will be written into the database, or might be written to log file (which is often not wished!) when returning the fields after the encoding is done.

The Result of a P12 request will be stored as base64 encoded value for the requesting application like:

Key archival with Secure Key Injection

Encrypted key pair is transferred from server to client. Secure Key Injection (SKI) will only be supported by CardOS 5.4W14 or later middleware with MiniDriver and CardOS card should be 5.3 or higher.

Prerequisites

  • The CardOS middleware must be installed on the Identity Manager server

  • Set EnableSKI=true in the encoding description to activate SKI.

Define like this in the encoding description (in addition to the definition for nonSKI):

Additional description fields:

Description of the elements:

Element

Description

Element

Description

EnableSKI=true

Enable SKI process execution. SKI is disabled by default.

CardOSSkiThumbprintField=Thumbprint

Thumbprint will be supplied from Card which was stored earlier. Set the "Read"-attribute in the "Encoding Fields" tab to get the value into your data-Map.

ForceSKI=true

If set to true, Identity Manager will perform SKI key archival forcefully, meaning if middleware/card do not support it, the CA connector endpoints will refuse a non-SKI request. This field is optional. SKI card support is checked at client side via smart card driver api.

 

The ForceSKI flag has priority over the EnableSKI flag. The ForceSKI flag enables forcefully execution of SKI use cases even though the EnableSKI flag is not provided. Here are some use cases:

ForceSKI

EnableSKI

Selected process

ForceSKI

EnableSKI

Selected process

true

false

SKI

true

true

SKI

false

true

SKI

false

false

Non SKI

Repackage PKCS#12 file right after KeyArchival request

To support renaming of the friendly name according to a configurable pattern (also with case-sensitivity) and for renaming friendly names of the CA certificates (intermediates and the root) according to the same pattern, inject this PKCS#12 Repackager mechanism into the KeyArchivalRequestPreProcessor:

Note the value of "naming" - here "§{CN} - _!CERT_SERIAL_NUM", where you can mix Juel-like expressions (here with "§" (paragraph) which is resolved out of the certificates' DN), free text and a special identifier _!CERT_SERIAL_NUM (that is replaced by the real certificate serial number of the certificate).

With the property "certSerialInHex" as boolean flag, you can change the usage of the certificate serial number in the friendly name by applying it in hexadecimal (true) or decimal (false) notation. Prefix and suffix are free text options to be attached in front of the resolved naming or behind, however, there is no resolving inside the pre- and suffix, just in the "naming" string sequence.

Key recovery

Certificates and corresponding private keys are fetched from from the certificate authority (CA). The requested certificates can be provided either as a list of Core Object IDs or CoreObjectDescriptors via the RecoveryCertificateData attribute of encoding description. Thus the certificates to be recovered can either be looked up via Cert: Load Key History List or Processes: Execute Search Task or any other way that can provide either format. 

Key recovery without Secure Key Injection

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

RecoveryCertificateData

The field holding the certificates to be recovered, either as a list of CoreObjectDescriptors or as a list of Core Object IDs. 

The name of the field must be RecoveryCertificateData_<ApplicationId> as shown in the example.

 

Key recovery with Secure Key Injection

This use case is only supported with CardOS 5.4 middleware or later with MiniDriver and CardOS 5.3 cards.

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

RecoveryCertificateData

The field holding the certificates to be recovered, either as a list of CoreObjectDescriptors or as a list of Core Object IDs. 

 

 

CardOSSkiThumbprintField=Thumbprint

Used to read the Card thumbprint value and hold into this field. The card must be initialized and thumbprint value should be available into the card. 

Enforce Secure Key Injection for PKCS#12 requests

Enforce Secure Key Injection for PKCS#12 requests

For applications that require a CA-supplied key-pair to be written to the card, key-pair transfer can be enforced via Secure Key Injection (SKI) to prevent eavesdropping by a malicious client. For SKI to work, the CardOS middleware must also be installed on the Identity Manager server. By default, when SKI is not supported, the client may fall back to a less secure non-SKI request.

Define like this in the encoding description:

If the ForceSKI flag is set, then non-SKI PKCS#12 endpoints of the integrated CA connector will refuse to process the application requested by the client and the CA request will be blocked.

Key pair generation and discovery

Generate key pair

To explicitly generate a key pair, trigger it in an application part of the encoding description.

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

GenerateKeyPair=true

Triggers the key pair generation.

PubKeyReturnField=...

Defines the field in which to store the generated public key. You must also define the field in the Fields section.

Discover generated key pair

When you re-use already generated key pairs on the smartcard, you can search such a key pair to place a certificate to it. This is especially done for signature- and authentication certificates in the context of Nexus Personal Desktop, which creates 2 such key pairs on initialization of the smartcard with a special card profile. A key pair can be searched by an object criteria specifying the following 4 parameters:

  • The constant of objects type to be found, for example, CKO_PUBLIC_KEY

  • The constant of attribute type to be found, for example, CKA_LABEL

  • The type of attribute to be found, for example, string

  • The value of the attribute to be found, for example, a label name

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

UseExistingKeyPair=1

Triggers the key pair discovery.

PubKeyReturnField=...

Defines the field in which to store the discovered public key. You must also define the field in the Fields section.

ObjectCriteria=...

See the description above concerning the 4 parameters. Note! Use single quotes (not double quotes) to enclose the value of the attribute.

 

Skip writing CA certificates

If you would like to just write user certificates without intermediate certificates and without a root certificate to the smartcard, you can add an encoding property to your certificte application:

Define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

StoreUserCertOnly=true

Triggers writing only user certificates without intermediate certificates and without a root certificate.

 

 

Object labels

The label (CKA_LABEL value) for certificates, public and private keys using the default template, is generated using the CN from the DN followed by a white space and a two digit counter that starts by 01. The CN is limited to 36 characters. Doing so, the complete value is never longer than 39 characters. The reason for that is that CSPs in Windows have issues with longer values.

For example: Max Mustermann 01

Applying these values, each certificate and key pair bundle carries a unique name. However, the generation of the label can be configured using the keys Description/labelCounter and Application_X/LabelTemplate.

LabelCounter is the start value for the global counter.

LabelTemplate is the template that instructs the generation of the label. It has following syntax: LabelTemplate=[<labelAttr>=<value>],[<labelAttr>=<value>],…

Valid values for labelAttr:

Element

Description

Element

Description

name

The CN from the certificate’s DN. A value is not used. If the CN is empty, it uses the DN’s email, or if that is empty, it uses the OU.

limitedName=<n characters>

The same description as name, but limited to the length of n characters.

snr

The SERIALNUMBER from the certificate’s DN.

cert_snr

The serialnumber from the certificate itself

blank=<n>

Inserts n white spaces

certcounter=<start value>

Defines a two digit global counter value that is incremented with each certificate. Default value is 10. However, the value is not used directly. When an encoding process is started, the count of possible available certificates on the card is retrieved. Then, this counter value is added.

keyUsageDigSig=<text>

Defines the value that is used when the certificate’s key usage digital signature is set.

keyUsageNotDataEnc=<text>

Defines the value that is used when the certificate’s key usage data encipherment is not set.

keyUsageDataEnc=<text>

Defines the value that is used when the certificate’s key usage data encipherment is set

fixtext=<text>

Defines a fix string

complete-dn

Defines the encoding of the complete DN

notbefore

Defines the valid from date in ISO format (2019-01-15)

notafter

Defines the valid to date in ISO format (2019-12-30)

applicationCertCounter=<start value>

Defines a counter value that is incremented with each main certificate that is handled within a single application section of the encoding description.

Example: During a recovery of several certificates the counter will be incremented for every recovered certificate, but not for any certificate in the respective chain. 

Corresponding to this definition, the default label template is

labeltemplate=limitedname=36,blank=1,certcounter

The content of the every type of LabelTemplate can also be concatenated using the fields in the Fields section of the encoding description, using an expression language based on the exclamation mark. See https://docs.spring.io/spring-framework/reference/core/expressions.html for details. Examples:

Define like this in the encoding description:

 

Define the attribute set (PKCS#11 template)

Template

When an object (certificate, public or private key) on the card is stored or created, it contains a set of attributes as defined by the PKCS#11 standard. The PKCS#11 standard typically names this set as template. For our use cases, templates are used for:

  • storing a certificate (using a certificate template),

  • storing a private key (using a private key template),

  • creating a key pair (using a private key and public key template).

The set of attributes are basically "hard coded" by the JPKIEncoder. However, the attribute sets can be varied by the corresponding description file entry. Using such an entry,

  • may change the value of the corresponding attribute,

  • may extend the default list of attributes inclusive defining their values.

Template for storing a certificate

Attribute

Value

Attribute

Value

CKA_TOKEN

CK_TRUE

CKA_CERTIFICATE_TYPE

CKC_X_509

CKA_CLASS

CKO_CERTIFICATE

CKA_VALUE

DER encoded certificate

CKA_ISSUER

DER encoded issuer from the certificate

CKA_SERIAL_NUMBER

DER encoded serial from the certificate

CKA_SUBJECT

DER encoded subject from the certificate

CKA_ID

See "Notes for CKA_ID" below

CKA_LABEL

 


Template for storing a private key

Attribute

Value

Attribute

Value

CKA_CLASS

CKO_PRIVATE_KEY

CKA_TOKEN

CK_TRUE

CKA_ID

See "Notes for CKA_ID" below

CKA_MODULUS

 

CKA_PRIVATE_EXPONENT

 

CKA_PRIVATE

CK_TRUE

CKA_LABEL

 

CKA_MODIFIABLE

CK_TRUE

CKA_KEY_TYPE

CKK_RSA

CKA_PUBLIC_EXPONENT

 

CKA_PRIME_1

 

CKA_PRIME_2

 

CKA_EXPONENT_1

 

CKA_EXPONENT_2

 

CKA_COEFFICIENT

 

CKA_SUBJECT

DER encoded subject from the certificate

CKA_DERIVE

CK_FALSE

CKA_DECRYPT

CK_TRUE

CKA_SIGN

CK_TRUE

CKA_UNWRAP

CK_TRUE

Template for generating a private key

Attribute

Value

Attribute

Value

CKA_CLASS

CKO_CERTIFICATE

CKA_TOKEN

CK_TRUE

CKA_ID

See "Notes for CKA_ID" below

CKA_SUBJECT

DER encoded subject from the certificate

CKA_ISSUER

DER encoded issuer from the certificate

CKA_SERIAL_NUMBER

DER encoded serial from the certificate

CKA_LABEL

 

CKA_VALUE

DER encoded certificate

CKA_CERTIFICATE_TYPE

CKC_X_509


Template for generating a public key

Attribute

Value

Attribute

Value

CKA_CLASS

CKO_PRIVATE_KEY

CKA_TOKEN

CK_TRUE

CKA_ID

See "Notes for CKA_ID" below

CKA_MODULUS

 

CKA_PRIVATE_EXPONENT

 

CKA_PRIVATE

CK_TRUE

CKA_LABEL

 

CKA_MODIFIABLE

CK_TRUE

CKA_KEY_TYPE

CKK_RSA

CKA_PUBLIC_EXPONENT

 

CKA_PRIME_1

 

CKA_PRIME_2

 

CKA_EXPONENT_1

 

CKA_EXPONENT_2

 

CKA_COEFFICIENT

 

CKA_SUBJECT

DER encoded subject from the certificate

CKA_DERIVE

CK_FALSE

CKA_DECRYPT

CK_TRUE

CKA_SIGN

CK_TRUE

CKA_UNWRAP

CK_TRUE

Notes for CKA_ID

The CKA_ID establishes the link between certificate, private and public key.

Variant 1: It is stored as twenty bytes long value, generated from the public key’s modulus using the SHA-1 hash algorithm.

Variant 2: Alternatively, the SubjectKeyIdentifier of the object bundle is used, when this field is contained in the corresponding certificate of the object bunch. The SubjectKeyIdentifier is then stored in its DER encoded form.

Example for variant 2:

A certificates' SubjectKeyIdentifier is defined in the x509 extensions section, as seen in this image:

  • This SubjectKeyIdentifier is then taken for CKA_ID generation with the following generation rules:

    1. Byte is an encoding identifier. Generally DER encoding is preferred, represented by the byte sequence 04h.

    2. Byte is the length of the SubjectKeyIdentifier (here 6 bytes, therefore 06h).

    3. The following Bytes are the SubjectKeyIdentifier bytes.

  • The resulting CKA_ID (8 bytes length) then is: 0406014B2ADD5F66 (=example)

 

Apply extra attributes
To change the default sets used by the JPKIEncoder, define like this in the encoding description:

Description of the elements:

Element

Description

Element

Description

AttributesCert=...

Contains comma separated lists of [Attribute]=[Value] pairs which are used when the object is written or created. When specified using one of these three attributes, it may either overwrite the above named default value or add this value to the template.

AttributesPubKey=...

~

AttributesPrvKey=...

~

 

These attributes are supported to be overwritten or added to the JPKIEncoder’s default templates:

Attribute

Data type

Value (as appearing in the dsc file

Attribute

Data type

Value (as appearing in the dsc file

CKA_DERIVE

CK_BBOOL

TRUE | FALSE

CKA_LOCAL

CK_BBOOL

TRUE | FALSE

CKA_MODIFIABLE

CK_BBOOL

TRUE | FALSE

CKA_ENCRYPT

CK_BBOOL

TRUE | FALSE

CKA_VERIFY

CK_BBOOL

TRUE | FALSE

CKA_VERIFY_RECOVER

CK_BBOOL

TRUE | FALSE

CKA_WRAP

CK_BBOOL

TRUE | FALSE

CKA_TRUSTED

CK_BBOOL

TRUE | FALSE

CKA_SENSITIVE

CK_BBOOL

TRUE | FALSE

CKA_DECRYPT

CK_BBOOL

TRUE | FALSE

CKA_SIGN

CK_BBOOL

TRUE | FALSE

CKA_SIGN_RECOVER

CK_BBOOL

TRUE | FALSE

CKA_UNWRAP

CK_BBOOL

TRUE | FALSE

CKA_EXTRACTABLE

CK_BBOOL

TRUE | FALSE

CKA_ALWAYS_SENSITIVE

CK_BBOOL

TRUE | FALSE

CKA_NEVER_EXTRACTABLE

CK_BBOOL

TRUE | FALSE

CKA_PRIVATE

CK_BBOOL

TRUE | FALSE

Optional attributes

Similar to the definition of extra attributes, the encoding description allows the definition of optional attributes (which is, however, a JPKIEncoder internal name for the way to consider these attributes). The general meaning of this feature is also minor, see the remarks below.

The mechanism to apply optional attributes, works like this:

  • A Smartcard object (certificate, public key, private key) is created on the card. It then owns some attributes as described above in the section for standard and default attributes.

  • When optional attributes are defined in the description file, the JPKIEncoder checks if such an attribute exists and if it has a different value from the requested one. If so, it updates the existing value.

The mechanism basically exists to support various middleware with various support of such attributes - without having knowledge how far a middleware uses such attributes.

Define the optional attributes like this in the encoding description:

Description of the elements

The examples above demonstrate the usage of optional attributes for allowed use cases. Please note the specialty of the separate and global attribute definition for root and intermediate certificates. Attributes for user certificates are always taken from the corresponding Application_X section, but if an Application_X defined use case provides root or intermediate certificates, their definition is taken from the global Description section. The table describes all allowed attributes that may be used as optional attributes. The actual usage of an attribute depends on the corresponding object and use case.

Attributes of type CK_BBOOL and CK_ULONG require a corresponding value in the encoding description. CK_DATE and Byte array values are implicitly generated from the related certificate and do not require a value. That means, the different kind of attributes are defined like this:

AttributesCertOpt=CKA_ALWAYS_AUTHENTICATE=TRUE,CKA_CERTIFICATE_CATEGORY=1,CKA_START_DATE,CKA_HASH_OF_SUBJECT_PUBLIC_KEY

 

Attribute

Data type

Value (as appearing in the dsc file)

Attribute

Data type

Value (as appearing in the dsc file)

CKA_DERIVE

CK_BBOOL

TRUE | FALSE

CKA_LOCAL

CK_BBOOL

TRUE | FALSE

CKA_MODIFIABLE

CK_BBOOL

TRUE | FALSE

CKA_ENCRYPT

CK_BBOOL

TRUE | FALSE

CKA_VERIFY

CK_BBOOL

TRUE | FALSE

CKA_VERIFY_RECOVER

CK_BBOOL

TRUE | FALSE

CKA_WRAP

CK_BBOOL

TRUE | FALSE

CKA_TRUSTED

CK_BBOOL

TRUE | FALSE

CKA_SENSITIVE

CK_BBOOL

TRUE | FALSE

CKA_DECRYPT

CK_BBOOL

TRUE | FALSE

CKA_SIGN

CK_BBOOL

TRUE | FALSE

CKA_SIGN_RECOVER

CK_BBOOL

TRUE | FALSE

CKA_UNWRAP

CK_BBOOL

TRUE | FALSE

CKA_EXTRACTABLE

CK_BBOOL

TRUE | FALSE

CKA_ALWAYS_SENSITIVE

CK_BBOOL

TRUE | FALSE

CKA_NEVER_EXTRACTABLE

CK_BBOOL

TRUE | FALSE

CKA_PRIVATE

CK_BBOOL

TRUE | FALSE

CKA_TRUSTED

CK_BBOOL

TRUE | FALSE

CKA_WRAP_WITH_TRUSTED

CK_BBOOL

TRUE | FALSE

CKA_ALWAYS_AUTHENTICATE

CK_BBOOL

TRUE | FALSE

CKA_CERTIFICATE_CATEGORY

CK_ULONG

Categorization of the

certificate: 0 = unspecified (default

value), 1 = token user, 2 =

authority, 3 = other entity

CKA_START_DATE

CK_DATE

Implicit. Start date for the certificate, taken from the certificate that was encoded.

CKA_END_DATE

CK_DATE

Implicit. End date for the certificate, taken from the certificate that was encoded.

CKA_HASH_OF_SUBJECT_PUBLIC_KEY

Byte array

Implicit. SHA-1 hash of the subject public key, automatically calculated from the certificate that was encoded.

CKA_HASH_OF_ISSUER_PUBLIC_KEY

Byte array

Implicit. SHA-1 hash of the issuer public key, automatically calculated from the certificate that was encoded.

CKA_CHECK_VALUE

Byte array

Implicit. First  three  bytes  of  the  SHA-1  hash  of  the  certificate’s attribute CKA_VALUE, automatically calculated from the certificate that was encoded

Transport certificates

Example of transport certificate

Transport certificates (TC) are a Nexus Personal Desktop feature for cards that are pre-personalized with keypairs. The purpose of a transport certificate is to guarantee the originator of the pre-personalized card, to avoid that other cards, with non-secret private keys, are used when issuing certificates. The public keys on a pre-personalized smart card produced in the Key Generation System (KGS) are normally not signed and therefore not protected against tampering during the transport from the KGS to the Registration Authority (RA) where the cards are personalized. To improve the security of the issuing system, the public key can be embedded in a transport certificate signed by a dedicated "transport CA". When the personalization takes place in the RA, a special token procedure must be selected by the officer. The token procedure must include a special modifier that checks the signature and validity of the transport certificate.

Generally, a certificate requested using a TC will replace the TC on the card. When - in the future - the requested certificate is renewed, the requested certificate will in turn act as a TC.

Identity Manager supports transport certificates. Nexus CM must be used as a CA. If pre-personalized cards with generated keypairs are being used, any transport certificates matching the generated keys will automatically be used. The requested certificate will automatically replace the TC. No further configuration is needed in Identity Manager. The JPKIEncoder Log will indicate whether a transport certificate was found or not.

This is an example of an encoding description:

Generate card with transport certificate

  1.  Install current version of CM Key Generation System

  2. Install Personal Desktop Client, see Install Personal Desktop Client.

  3. In C:\Program Files (x86)\Nexus\Certificate Manager\Key Generation System\Cardprofiles you can find some CPFs. The ones that end with "Transport" are relevant. Choose one fitting the card you want to use, for example, RaP15Siemens50_2FCa1P_2048_OKG_KAR_Transport.cpf for a CardOS 5.0 ("50" stands for the CardOS version) token, and copy it to some directory. Uncomment the following lines in your copy:

    .cpf

    and comment out the previous values for SEC_*. Note that the profile for 5.0 cards specifies PIN minlength = 8. Initializing with "132435" will seem to work but you won't be able to log in or change PIN. To be sure, search for "minlength" in the cpf you use.

  4. Some certificates are needed. Example certificates can be found in C:\Program Files (x86)\Nexus\Certificate Manager\Key Generation System\Certificates. Open the Personal GUI > View > Preferences > Electronic Identity Token Search > Browse > open the aforementioned folder > Add.
    You should now see tcsigner in your Nexus Personal GUI, its PIN is 1234 . This will be the the CA for signing the transport certificates.

  5. Edit C:\Program Files (x86)\Nexus\Certificate Manager\Key Generation System\ppa.cfg or %APPDATA%\Nexus\Certificate Manager\Key Generation System\ppa.cf (the latter wins, if it exists), and make the following adjustments:

    ppa.cfg

  6. Start KGS.

  7. Select Target card reader.

  8. Insert an erased card with the OS that fits your CPF.

  9. Click Start.

  10. In case of errors, consult the logfile specified in the [Trace] section.

Configure CM for transport certificates

  1. Copy config\certformats\rfc5280.conf to config\certformats\rfc5280-tc.conf

  2. Edit rfc5280-tc.conf and add transport certificate module after ID2Legacy:

  3. Edit config\tcconfig.conf as you see fit.

  4. Restart CM.

  5. Clone an existing certificate procedure using rfc5280 certificate format and edit it

    • Rename appropriately

    • Set Certificate Format to rfc5280-tc (the one you just created)

  6. Clone a token procedure that uses the certificate procedure you just cloned and edit it

    • Rename appropriatelly

    • Set Certificate Procedure to the one you just created

    • Set Storage Profile to PKCS10

  7. Further information can be found here:

Use elliptic curves cryptography

The type of the created keys is coded into the KeySize property. The value is 'ECC/' plus a curve name. Supported curves are limited by Bouncy Castle, the PKCS#11 middleware and the certificate authority. For details, refer to the respective documentation. The PKCS10SigningAlgorithm needs to be specified when using elliptic curves cryptography.

  • PRIME 3.9: Elliptic curves is only supported for Cryptovision and Nexus Certificate Manager. Other middlewares are guaranteed to NOT work, while other CA connectors are not tested.

  • PRIME 3.10: Support is added for TCOS cards with ECC. Note that those only support SHA1_ECDSA as PKCS10SigningAlgorithm, SHA2-variants do not work.

  • PRIME 3.11: Support is added for EJBCA.

Define like this in the encoding description:

 

 

Copyright 2024 Technology Nexus Secured Business Solutions AB. All rights reserved.
Contact Nexus | https://www.nexusgroup.com | Disclaimer | Terms & Conditions