This Appendix is designed to serve as a set of behavior guidelines for CDSA Cryptographic Service Provider (CSP) modules. It is written as an "edge specification" relative to the Cryptographic Service Provider SPI, in that it specifies the apparent behavior of the CSP through the SPI interface, but does not specify how the underlying implementation must be done. In this case, the edge is the boundary between the CSSM and the Service Provider, although it also makes references to the boundary between the application and the CSSM, so in this respect it is also an interface specification.
No examples of interface usage are provided in this Appendix, since it is not a "how-to" guide.
For example, the AlgorithmId field in the CSSM_KEYHEADER structure is referenced as:
Plaintext blobs include PKCS #1 RSA public keys, key references include string names, and wrapped key blobs include PKCS #8 encrypted private key blobs.
The following sections list the CSSM_KEYHEADER field values, and the corresponding CSSM_KEY::KeyData contents that they describe.
Format
RAW_FORMAT_* | Valid key types | CSSM_KEY::KeyData |
---|---|---|
PKCS1 | RSA | An RSA public or private key formatted according to the PKCS #1 v2.0 specification. |
PKCS3 | Diffie-Hellman public key | A Diffie-Hellman public key calculated according to PKCS #3 v1.4. The public key format is the public value as an octet string with the most significant byte first (big-endian). |
PKCS3 | Diffie-Hellman private key | A Diffie-Hellman private key calculated according to PKCS #3 v1.4. The private key format is the BER encoded sequence of the p, g, and x values. |
MSCAPI | All Microsoft CAPI supported | A key formatted according to the Microsoft CAPI 2.0 keyblob specification. |
PGP | All PGP supported | A key formatted according to the PGP keyring specification. |
FIPS186 | DSA | A DSA key formatted as a DER sequence of p, q, g, and either y or x for public or private keys respectively. |
BSAFE | All | A key formatted in the RSA BSafe key format. |
CCA | All | A key formatted according to the IBM CCA specification. |
PKCS8 | All private keys | A private key formatted according to PKCS #8 v1.2, without encryption. |
SPKI | All asymmetric keys | A public or private key formatted according to the SPKI specification. |
OCTET_STRING | All symmetric keys | A symmetric key represented as an octet string, with the most significant byte first (big-endian). |
OTHER | Vendor specific | A key formatted according to individual vendor requirements. See individual documentation for format details. This format is not recommended for most CSPs. |
Every key type has a default format that is used in the cases where the
caller does not specify a specific format type.
AlgorithmId
CSSM_ALGID_* | Format
CSSM_KEYBLOB_RAW_FORMAT_* |
---|---|
RSA | PKCS1 |
DSA | FIPS186 |
DH | PKCS3 |
All symmetric key algorithms | OCTET_STRING |
Format
REF_FORMAT_* | Valid key types | CSSM_KEY::KeyData |
---|---|---|
INTEGER | All | An integer value of any length, and any byte-sex. |
STRING | All | A valid RFC2279 (UTF8)
string that corresponds to the "Label" attribute of a key in a DL
schema, and the Label parameter to the
|
SPKI | All asymmetric keys | A key reference as defined in the SPKI specification. It has the form
(public-key (hash)) or (private-key (hash)) |
OTHER | Vendor specific | A key reference formatted according to individual vendor requirements. See individual documentation for format details. |
Integer references, CSSM_KEYBLOB_REF_FORMAT_INTEGER, are domain
specific to a specific service provider, and must not be interpreted by
a client. A client must consider a reference of this type to become
invalid as soon as the CSP handle used to instantiate the reference is
invalidated using the
String references, CSSM_KEYBLOB_REF_FORMAT_STRING, are valid for the
lifetime of the key that they reference. For instance, if the key is
instantiated with the CSSM_KEYATTR_PERMANENT flag, then the reference
is valid until
SPKI references, CSSM_KEYBLOB_REF_FORMAT_SPKI, have the same lifetimes and deletion requirements as string references.
Vendor specific references, CSSM_KEYBLOB_REF_FORMAT_OTHER, have lifetime behavior that is specific to a certain CSP. They have the same deletion requirements as all other reference types.
The default reference type is CSP specific. The application can safely treat a reference of an unknown type as if it is an integer reference since it has the most restrictive lifetime semantics.
Format
CSSM_KEYBLOB_ WRAPPED_FORMAT_* | Valid key types | CSSM_KEY::KeyData |
---|---|---|
PKCS8 | All private keys | A private key in formatted and encrypted according to PKCS #8 v1.2. This format is used to wrap asymmetric keys using a symmetric algorithm |
PKCS7 | All symmetric keys | A symmetric key encrypted as required by PKCS #7 v1.5. This format is used to wrap symmetric keys using either symmetric or asymmetric algorithms. |
MSCAPI | All Microsoft CAPI supported | A key formatted and encrypted according to the Microsoft CAPI 2.0 keyblob specification. |
OTHER | Vendor specific | A key formatted and encrypted according to individual vendor requirements. See individual documentation for format details. This format is not recommended for most CSPs. |
PKCS #7 wrapping, CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS7, wraps only the raw key value of the symmetric key. None of the information in the CSSM_KEYHEADER structure is encryted with the key. All information in the key header of the key to be wrapped is copied to the wrapped key structure, and updated as necessary by the wrapping operation.
PKCS #8 wrapping, CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS8, wraps only the information specified in the PKCS #8 specification. None of the information in the CSSM_KEYHEADER structure is encryted with the key. All information in the key header of the key to be wrapped is copied to the wrapped key structure, and updated as necessary by the wrapping operation.
Diffie-Hellman Private Keys
Wrapping a Diffie-Hellman private key uses the DHParameter structure defined in PKCS #3 to embed the p and g values into the privateKeyAlgorithmIdentifier field of the PrivateKeyInfo structure. The private value, x, is placed in the privateKey field BER encoded as BER type INTEGER.
DSA Private Keys
Wrapping a DSA private key uses the Dss-parms structure defined in PKCS #11 v2.01 to embed the p, q, and g values into the privateKeyAlgorithmIdentifier field of the PrivateKeyInfo structure. The private value, x, is placed in the privateKey field BER encoded as BER type INTEGER.
The first level of detail is the easiest to use, and implement in a
CSP, but provides only limited amounts of control over the key format.
All CSP APIs that instantiate a key object have a parameter
KeyAttr
(
PublicKeyAttrandPrivateKeyAttr
for
Key Attribute Format Flag | CSP to return format class |
---|---|
CSSM_KEYATTR_RETURN_DATA | Plaintext key |
CSSM_KEYATTR_RETURN_REF | Key reference |
CSSM_KEYATTR_RETURN_NONE | No data |
The second level of detail for specifying the key format provides fine
control over the value returned. Fine control requires that one of the
attribute types listed in
Format types allowed for wrapped keys are those that begin with
CSSM_KEYBLOB_WRAPPED_FORMAT_*. Note that the
Cryptographic Context Attribute
CSSM_ATTRIBUTE_* | Valid for APIs |
---|---|
PUBLIC_KEY_FORMAT | |
PRIVATE_KEY_FORMAT | |
SYMMETRIC_KEY_FORMAT | |
WRAPPED_KEY_FORMAT |
If the application chooses "no data", the CSP instantiates the key in its persistent storage but returns no reference. The CSP will return the error CSSM_CSP_INVALID_KEYATTR if "no data" is requested without setting the CSSM_KEYATTR_PERMANENT flag. All key format attributes in a CC are ignored if "no data" is returned. A key wrapping operation may not specify "no data".
The create event, CSSM_CONTEXT_EVENT_INSERT, is sent to the CSP whenever the client calls one of the CSSM_CSP_Create*Context APIs. The CSSM passes a copy of the new CC and the new CC handle along with the event. At this point, the CSP has the ability to check the CC and reject its contents by returning an error. If the CC is rejected, then the CSSM will fail the context creation call. The CSP is not required to check the CC at this point. If the check is not made when the CC is created, then the check must be performed the first time it is used.
The
update
event, CSSM_CONTEXT_EVENT_UPDATE, is sent to the CSP
whenever the client calls the
The
delete
event, CSSM_CONTEXT_EVENT_DELETE, is
sent to the CSP whenever the client calls the
A service provider module is required to send an insert event, CSSM_NOTIFY_INSERT, to the CSSM for each subservice that it provides regardless of whether or not that subservice can be removed. This allows the CSSM to implement a common interaction model for all service provider modules. If the module implements multiple module types for the same subservice ID, they should both be included in the same insert event. If two module types are implemented for the same subservice ID, the services should be related. For instance, a smartcard module will probably provide both CSP and DL services for the same subservice ID. This is a valid re-use of a subservice ID. A module that interfaces to a database and a totally independent cryptographic library should place those services on different subservice IDs. The CSSM will fail events that break this rule.
The following example shows both correct and
incorrect use of the events and subservice IDs. In the examples,
-
-
/* Typical usage. A single service type with a single subservice ID. */
CssmNotifyCallback( &ADDIN_GUID,
CssmNotifyCallbackCtx,
0,
CSSM_SERVICE_CSP,
CSSM_NOTIFY_INSERT ); /* Correct */
/* Usage by a module that exports multiple service types using the */
/* SAME subservice ID. */
/* Correct usage, services are related and allowed to share an SSID */
CssmNotifyCallback( &ADDIN_GUID,
CssmNotifyCallbackCtx,
1,
CSSM_SERVICE_CSP | CSSM_SERVICE_DL,
CSSM_NOTIFY_INSERT );
/* Incorrect usage, the second event fails, services are not related */
CssmNotifyCallback( &ADDIN_GUID,
CssmNotifyCallbackCtx,
2,
CSSM_SERVICE_CSP,
CSSM_NOTIFY_INSERT );
CssmNotifyCallback( &ADDIN_GUID,
CssmNotifyCallbackCtx,
2,
CSSM_SERVICE_DL,
CSSM_NOTIFY_INSERT );
If a service provider implements subservices that are always available
(like most software-only service providers), then the
insert
events
must be sent to the CSSM when the service provider is handling the
Remove
events,
CSSM_NOTIFY_REMOVE, are used much more sparingly than the corresponding
insert
events. They are used to indicate that a removable device is no
longer available. The definition of "remove" is service provider
specific but the result is always the same, the subservice is no longer
available to the client.
Remove
events should not be sent to the CSSM when the
The CSSM will most likely avoid calling any interfaces in the service provider after receiving a fault event to avoid executing any unstable, or altered code. Therefore, the service provider should insure that it has cleaned up all internal resources before sending the fault event to the CSSM.
Service providers should use the local heap for all internal memory requirements. Internal memory requirements include any memory required to perform an operation that will not be returned to the client. This provides higher performance, and reduces exposure of internal data outside of the service provider.
Any memory that will be returned to the client must be allocated using the application memory functions given to the service provider by the CSSM. The memory obtained this way is guaranteed to be allocated in a way that will allow the client to release them when they are no longer needed.
The
Length | 0 | > |
---|---|---|
_ | ||
Data | ||
NULL | Allocate required memory | Error
= CSSM_CSP_INVALID_INPUT_POINTER |
!NULL | Error
= CSSM_CSP_INVALID_INPUT_POINTER | Use supplied memory
Error = CSSM_CSP_INVALID_INPUT_LENGTH if not suitable size |
When filling an output vector, each component buffer is completely filled before placing any data in the next buffer of the array. None of the length values for the component buffers can be modified by the CSP. The output length parameter that accompanies each output vector must be used to indicate the total number of bytes placed in the output vector.
The CSP should only allocate memory if all of the entries in the vector have a NULL data pointer and a zero length. If memory is allocated, a single output buffer with enough space for the output should be allocated and assigned to the first array element's data pointer. The memory must be allocated using the application memory functions.
The key can be supplied to the function directly or in a cryptographic context. The size of the key must be calculated by looking at the key data itself. The key header information should not be used to calculate the values.
Operation Type | Encrypt Parameter | Result |
---|---|---|
Encrypt | CSSM_TRUE | Returns the output size of the next operation. |
_ | _ | |
Decrypt | CSSM_FALSE | If the cryptographic context (CC) used to perform the operation is currently being used to perform a staged operation, then the output is based on the current state of the algorithm. If the CC is not being used to perform a staged operation, then the result is based on a single stage operation. |
Digest | No effect | Always returns the length of the digest output regardless of the algorithm state. This value is also available by fetching the CSSM_ATTRIBUTE_OUTPUT_SIZE attribute for the corresponding capability information in the MDS. |
Generate MAC | CSSM_TRUE | Always returns the length of the signature output regardless of the algorithm state. For MAC algorithms that always generate the same size signature, this value is also available by fetching the CSSM_ATTRIBUTE_OUTPUT_SIZE attribute for the corresponding capability information in the MDS. |
Verify MAC | CSSM_FALSE | Always returns zero. |
Sign | CSSM_TRUE | Always returns the length of the signature output regardless of the algorithm state. For signature algorithms that always generate the same size signature (i.e. DSA), this value is also available by fetching the CSSM_ATTRIBUTE_OUTPUT_SIZE attribute for the corresponding capability information in the MDS. |
Verify | CSSM_FALSE | Always returns zero. |
Field Name | Description |
---|---|
UserAuthenticated | This field will be set to CSSM_TRUE if
the client has authenticated to the subservice using the
|
DeviceFlags | This field is described in detail in
|
TokenMaxSessionCount | Indicates the maximum number of simultaneous attach handles that can be issued for the subservice. |
TokenOpenedSessionCount | Indicates the number of attach handles that have already been issued for the subservice. |
TokenMaxRWSessionCount | Indicates the maximum number of simultaneous read/write attach handles that can be issued for the subservice. By default, attach handles are created in read/write mode. |
TokenOpenedRWSessionCount | Indicates the number of read/write attach handles that have already been issued for the subservice. |
TokenTotalPublicMem | Indicates the amount of storage
space that can be used to store objects that are usable without the
client authenticating to the subservice using the
|
TokenFreePublicMem | Indicates the amount of storage space that has been
used to store objects that are usable without the client authenticating
to the subservice using the
|
TokenTotalPrivateMem | Indicates the amount of storage space that can be used to store objects
that are not usable without the client authenticating to the subservice
using the
|
TokenFreePrivateMem | Indicates the amount of
storage space that has been used to store objects that are not usable
without the client authenticating to the subservice using the
|
Any of the Token* fields can have the value CSSM_VALUE_NOT_AVAILABLE to indicate that the CSP does not use these values, or that it will not reveal the values. The values are primarily applicable to hardware cryptographic devices.
The
DeviceFlags
field can be a mask of the
values listed in
Field Name | Description |
---|---|
CSSM_CSP_TOK_WRITE_PROTECTED | The meaning of this flag varies by service provider. In some service providers, no objects may be created, deleted, or modified. In others, permanent objects may not be manipulated but transient objects may be freely created. |
CSSM_CSP_TOK_LOGIN_REQUIRED | The CSP requires the client to authenticate to the subservice before cryptographic operations other than random number generation and message digest calculation. |
CSSM_CSP_TOK_USER_PIN_INITIALIZED | If the subservice requires authentication before cryptographic operations can be performed, it indicates that the authentication data for the client has been initialized. |
CSSM_CSP_TOK_PROT_AUTHENTICATION | The subservice provides a protected mechanism for collecting authentication information. |
CSSM_CSP_TOK_USER_PIN_EXPIRED | If the subservice requires authentication before cryptographic operations can be performed, it indicates that the authentication data for the client has expired and must be changed before it can be used. |
CSSM_CSP_TOK_SESSION_KEY_PASSWORD | Indicates that the subservice supports separate authentication data for individual symmetric keys. |
CSSM_CSP_TOK_PRIVATE_KEY_PASSWORD | Indicates that the subservice supports separate authentication data for individual private keys. |
CSSM_CSP_STORES_PRIVATE_KEYS | Indicates that private keys can be stored permanently by the subservice. |
CSSM_CSP_STORES_PUBLIC_KEYS | Indicates that public keys can be stored permanently by the subservice. |
CSSM_CSP_STORES_SESSION_KEYS | Indicates that session keys can be stored permanently by the subservice. |
CSSM_CSP_STORES_CERTIFICATES | Indicates that certificates can be stored permanently by the subservice. This flag can only be set by a multi-service module that also implements a DL interface. |
CSSM_CSP_STORES_GENERIC | Indicates that generic data objects can be stored permanently by the subservice. This flag can only be set by a multi-service module that also implements a DL interface. |
Many CSPs will implement one form or the other, but they are not mutually exclusive. Each authentication mechanism has its own functional properties that make it useful.
If the CSP supports client login ACLs, then it must set the CSSM_CSP_TOK_LOGIN_REQUIRED flag in the CSSM_CSP_OPERATIONAL_STATISTICS::DeviceFlags field.
Client login ACLs
control the visibility of some keys stored in the CSP. Keys with the
CSSM_KEYATTR_PRIVATE flag set in their CSSM_KEY::KeyHeader.KeyAttr
field are not visible to the client until it has authenticated to the
subservice. As a result, functions such as
Client login ACLs also control the ability to use the subservice for cryptographic operations. If the CSSM_CSP_TOK_LOGIN_REQUIRED flag is set, then the client must authenticate to the subservice before operations other than random number generation and message digesting can be performed.
The contents of a client login ACL
can be modified by the ACL owner using the
The contents of a client login owner ACL can be fetched
using the
The contents of a client login ACL
owner can be modified by the subject of the ACL owner using the
If the CSP supports individual key ACLs, then it must set at least one of the CSSM_CSP_TOK_SESSION_KEY_PASSWORD and CSSM_CSP_TOK_PRIVATE_KEY_PASSWORD flags in the CSSM_CSP_OPERATIONAL_STATISTICS::DeviceFlags field to indicate what key types can be protected using individual key ACLs. Public keys never require ACLs.
Individual key ACLs control the ability of clients to use the key for a specific purpose. Since individual key ACLs control the use of the key they protect, the operations listing in the ACL must match the list of operations found in the CSSM_KEY::KeyHeader.KeyUsage field (or specified to a key creation API).
The contents of an individual key
ACL can be modified by the ACL owner using the
The contents of a client login owner ACL can be fetched
using the
The contents of an individual key
ACL owner can be modified by the subject of the ACL owner using the
Field Name | Contents |
---|---|
ModuleId | GUID (in string format) uniquely identifying the service provider. |
Manifest | Signed manifest describing the service provider binary. If the service
provider implements the Module Services and Administration (MSA)
interfaces (i.e.
|
ModuleName | File name of the service provider binary without the system path information. |
Path | List of system paths where the module might be found. The format of the list is system dependent. The paths will be searched in order until the module is found. This path is used to find all binaries required for the service provider. |
Version | CSSM interface version implemented by the service provider. This must be a text representation of the CSSM_MAJOR and CSSM_MINOR constants in the form "X.Y". |
Desc | Human readable text string describing the service provider. |
DynamicFlag | Boolean flag indicating whether or not the
service provider implements dynamic services. Zero indicates static
services and a non-zero value indicates dynamic services. See
|
MultiThreadFlag | Boolean flag indicating whether or
not the CSSM should allow multiple threads to call the service provider
at the same time. Zero indicates that the CSSM should synchronize all
threads making requests to the service provider, non-zero indicates
that any number of threads are allowed to execute at the same time.
Note:
|
ServiceMask | Service Mask of all service types supported by the service provider. The value of the mask is the bitwise logical OR of constants defined for the CSSM_SERVICE_MASK type. |
This record should remain static once the service provider is installed.
Software CSPs that implement a single static
subservice should use a
i
SSID value of zero. CSPs that implement dynamic
subservices can use any
SSID
including zero. A CSP should typically
allocate a new
SSID
value for each logical service. For instance, a
smartcard CSP should allocate an
SSID
value for each card reader slot present on the system.
Field Name | Description |
---|---|
ModuleID | GUID (in string format) uniquely identifying the service provider. This value must be the same as the ModuleId field in the CDSA Common Relation record. |
SSID | Subservice ID. This value can be any unsigned 32-bit value. If the CSP implements a single static subservice, this value should be zero. If the CSP implements one or more dynamic subservices, then this value can be any value including zero. |
Manifest | Signed manifest describing the
service provider binary that implements the subservice. If the service
provider implements the Module Services and Administration (MSA)
interfaces (i.e.
|
ModuleName | File name of the service provider binary without the system path information. The ModulePath value in the CDSA Common relation record will be used as the search path to find the binary. |
Version | CSSM interface version implemented by the service provider. This must be a text representation of the CSSM_MAJOR and CSSM_MINOR constants in the form "X.Y". |
Vendor | Service provider vendor name in ASCII text. |
CspType | CSP implementation type, such as software, hardware, or hybrid. The value corresponds to constants of type CSSM_SERVICE_MASK. |
CspFlags | CSP descriptions flags (32-bits). The flags are a bitwise logical OR of the constants defined for CSSM_CSP_FLAGS. |
CspCustomFlags | CSP specific flags (32-bits). |
UseeTags | Array of 32-bit integers containing the privilege values supported by the CSP. The integers correspond to symbols of type CSSM_PRIVILEGE. |
SampleTypes | An array of 32-bit integers representing the sample types accepted by the CSP. The integers correspond to symbols of type CSSM_SAMPLE_TYPE |
AclSubjectTypes | An array of 32-bit integers representing the ACL subject types accepted by the CSP. The integers correspond to symbols of type CSSM_ACL_SUBJECT_TYPE |
AuthTags | An array of 32-bit integers representing the authorization tag values defined by the CSP. The integers correspond to symbols of type CSSM_ACL_AUTHORIZATION_TAG |
This record should remain static once the service provider is installed. An exception to this rule might be when a user installs a new reader slot supported by a smartcard CSP.
Field Name | Description |
---|---|
ModuleID | GUID (in string format) uniquely identifying the service provider. This value must be the same as the ModuleId field in the corresponding CSP Primary Relation record. |
SSID | Subservice ID. This must match the SSID value of the corresponding CSP Primary Relation record. |
ProductDesc | ASCII text description of the product encapsulated by the CSP implementation. |
ProductVendor | ASCII text description of the vendor that produces the product encapsulated by the CSP implementation. |
ProductVersion | Version string in dotted high/low format (i.e. 2.0) indicating the version of the product encapsulated by the CSP implementation. |
ProductFlags | Product flags (32-bits). The definition of the flag values is product specific. |
CustomFlags | Custom flags (32-bits). The definition of the flag value is product specific. |
StandardDesc | String describing the standard that the implementation encapsulates (i.e. PKCS #11) |
StandardVersion | Version string in dotted high/low format (i.e. 2.0) indicating the version of the standard implemented by the encapsulated product. |
ReaderDesc | If the product encapsulates a hardware device that includes a reader device, this is an ASCII text description of the reader. This field should be empty (" ") if there is no hardware reader. |
ReaderVendor | If the product encapsulates a hardware device that includes a reader device, this is an ASCII text description of the reader vendor. This field should be empty ("") if there is no hardware reader device. |
ReaderVersion | Version string in dotted high/low format (i.e. 2.0) indicating the version of the hardware reader device. This field should be empty (" ") if there is no hardware reader device. |
ReaderFirmwareVersion | Version string in dotted high/low format (i.e. 2.0) indicating the firmware version of the hardware reader device. This field should be empty (" ") if there is no hardware reader device. |
ReaderFlags | Reader flags (32-bits). The flags are a bitwise logical OR of the constants defined for CSSM_CSP_READER_FLAGS. |
ReaderCustomFlags | Reader custom flags (32-bits). The definition of the flag value is product specific. |
ReaderSerialNumber | ASCII representation of the reader device serial number. This field should be empty (" ") if there is no hardware reader device. |
This record should updated to reflect correct information whenever the corresponding CSP Primary Relation record is updated.
Field Name | Comment |
---|---|
ModuleID | GUID (in string format) uniquely identifying the service provider. This value must be the same as the ModuleId field in the corresponding CSP Primary relation record. |
SSID | Subservice ID. This must match the SSID value of the corresponding CSP Primary relation record. |
ScDesc | ASCII text description of the subservice device. |
ScVendor | ASCII text description of the subservice device vendor. |
ScVersion | Version string in dotted high/low format (i.e. 2.0) indicating the product version of the subservice device. This field should be empty (" ") if there is no version information available. |
ScFirmwareVersion | Version string in dotted high/low format (i.e. 2.0) indicating the firmware version of the subservice device. This field should be empty (" ") if there is no version information available. |
ScFlags | Subservice device flags (32-bits). Indicates the set of built-in features of the subservice device. The features should be implemented in hardware. |
ScCustomFlags | Custom subservice flags (32-bits). The definition of the flag value is product specific. |
ScSerialNumber | ASCII text representation of the subservice device serial number. |
The contents of the CSP Smartcard relation record for a
subservice can be updated at any time by the CSP. It must be updated to
reflect current information before the
insert
event is sent to the CSSM,
and it must remain valid until the
remove
event is sent or the module is unloaded from all processes. See
Field Name | Comment |
---|---|
ModuleID | GUID (in string format) uniquely identifying the service provider. This value must be the same as the ModuleId field in the corresponding CSP Primary relation record. |
SSID | Subservice ID. This must match the SSID value of the corresponding CSP Primary relation record. |
UseeTag | 32-bit privilege tag associated with the attribute values. The values correspond to constants of type CSSM_USEE_TAG. |
ContextType | Class of cryptographic operation described by the attribute (32-bit). The value corresponds to constants of type CSSM_CONTEXT_TYPE. |
AlgType | Cryptographic algorithm supported by the CSP (32-bit). The value corresponds to constants of type CSSM_ALGORITHMS. |
GroupId | 32-bit identifier grouping all of the attributes associated with a single cryptographic capability. |
AttributeType | CSP attribute tag to identify the attribute value (32-bit). The value corresponds to constants of type CSSM_ATTRIBUTE_TYPE. |
AttributeValue | Array of 32-bit values. Some attribute types can have multiple values. |
Description | ASCII text, human readable description of the algorithm (.I AlgType ). All attributes with the same GroupId value should have the same Description value. |
The contents of the CSP Capabilities relation records for a subservice
can be updated at any time by the CSP. It must be updated to reflect
current information before the
insert
event is sent to the CSSM, and it
must remain valid until the
remove
event is sent or the module is unloaded from all processes. See
For simplicity, and to allow easier searches for all attributes of a single capability, all capabilities must have a unique GroupId value. The values should range from zero to N-1 without gaps in the sequence, where N is the number of capabilities supported by the CSP.
To indicate privilege restrictions on capabilities, the attributes are entered into the MDS in two "phases". The first phase is the attributes for capabilities supported without special privileges from the client (CSSM_USEE_NONE), otherwise known as the base attributes. The second phase is the deltas to those capabilities available to clients that have been granted special privilege (i.e. CSSM_USEE_FINANCIAL). The two phases build on each other, so that a CSP can reflect upgrades in a capability due to client privilege.
UseeTag | GroupId | ContextType | AlgType | AttributeType | AttributeValue |
---|---|---|---|---|---|
NONE | 0 | KEYGEN | RSA | KEYSIZE | 512 |
KEYEXCH | 0 | KEYGEN | RSA | KEYSIZE | 1024 |
NONE | 1 | DIGEST | SHA1 | OUTPUT_SIZE | 20 |
NONE | 2 | ASYMMETRIC | RSA | KEYSIZE | 512 |
KEYEXCH | 2 | ASYMMETRIC | RSA | KEYSIZE | 1024 |
If a capability does not
have any required attributes and no optional attributes are present, a
single attribute must be inserted with the following fixed values.
Field Name | Value |
---|---|
AttributeType | CSSM_ATTRIBUTE_NONE |
AttributeValue | 0 |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
BLOCK_SIZE | If the RNG algorithm uses a block generation method, this value can be used to indicate the size of each block. |
ROUNDS_RANGE | If the RNG can be configured to use a variable number of rounds to generate random data, this attribute indicates the valid range of round values that are supported by the CSP. |
ROUNDS | This attribute must be specified if the ROUNDS_RANGE attribute is present. It indicates the default rounds value used by the CSP if this attribute is not found in the cryptographic context. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
OUTPUT_SIZE | This is the output length of the message digest algorithm in bytes. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. |
Optional Attributes | |
KEYUSAGE | Indicates the key usage mask values that can be specified for the new key. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
MODE | Indicates the algorithm mode described by this set of attributes. Each algorithm mode should be described by its own capability differentiated using the GroupId field. |
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. |
BLOCK_SIZE | Block size of the cipher. If the cipher is used without a padding method, the length of the input must be a multiple of this value. If a padding method is used, the total output length from the cipher will be a multiple of this value. |
Optional Attributes | |
PADDING | List of padding methods supported for this cipher and mode. |
ROUNDS_RANGE | If the cipher can be configured to use a variable number of rounds to transform data, this attribute indicates the valid range of round values that are supported by the CSP. |
ROUNDS | This attribute must be specified if the ROUNDS_RANGE attribute is present. It indicates the default rounds value used by the CSP if this attribute is not found in the cryptographic context. |
IV_SIZET | If the algorithm and mode requires and initialization vector, this value indicates the required length of the value that must be supplied by the client. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. |
Optional Attributes | |
MODE | Indicates the algorithm mode described by this set of attributes. Each algorithm mode should be described by its own capability differentiated using the GroupId field. |
ROUNDS_RANGE | If the cipher can be configured to use a variable number of rounds to transform data, this attribute indicates the valid range of round values that are supported by the CSP. |
ROUNDS | This attribute must be specified if the ROUNDS_RANGE attribute is present. It indicates the default rounds value used by the CSP if this attribute is not found in the cryptographic context. |
KEYUSAGE | Indicates the key usage mask values that can be specified for the new key. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
MODE | Indicates the algorithm mode described by this set of attributes. Each algorithm mode should be described by its own capability differentiated using the GroupId field. |
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. |
BLOCK_SIZE | Block size of the cipher used to generate the MAC. Optional Attributes |
Optional attributes | |
ROUNDS_RANGE | If the cipher can be configured to use a variable number of rounds to transform data, this attribute indicates the valid range of round values that are supported by the CSP. |
ROUNDS | This attribute must be specified if the ROUNDS_RANGE attribute is present. It indicates the default rounds value used by the CSP if this attribute is not found in the cryptographic context. |
OUTPUT_SIZE | Length of the MAC value generated by the algorithm. |
IV_SIZE | If the algorithm and mode requires an initialization vector, this value indicates the required length of the value that must be supplied by the client. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits |
Optional Attributes | |
KEYUSAGE | Indicates the key usage mask values that can be specified for the new keys. The mask is a combination of the values that are valid for the public and private keys. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. |
Optional Attributes | |
MODE | Indicates the algorithm mode described by this set of attributes. Each algorithm mode should be described by its own capability differentiated using the GroupId field. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits |
Optional Attributes | |
MODE | Indicates the algorithm mode described by this set of attributes. Each algorithm mode should be described by its own capability differentiated using the GroupId field. |
Optional Attributes
CSSM_ATTRIBUTE_* | Description |
---|---|
KEY_LENGTH_RANGE | If the algorithm supports multiple key sizes, this is the range of key sizes supported in bits. |
KEY_LENGTH | If the algorithm uses a fixed key size, this is the logical key size in bits. lb s l l. Optional Attributes ROUNDS_RANGE!T{ If the key derivation algorithm can be configured to use a variable number of rounds to transform data, this attribute indicates the valid range of round values that are supported by the CSP. |
ROUNDS | This attribute must be specified if the ROUNDS_RANGE attribute is present. It indicates the default rounds value used by the CSP if this attribute is not found in the cryptographic context. |
KEY_TYPE | List of algorithm identifiers (CSSM_ALGORITHMS) indicating the types of keys that can be created by the derivation mechanism. |
The capability changes for a CSP combined with a KR service provider are described in the CDSA KR specification and will not be covered here. The most common service provider type is CSP with a DL interface. This combination is covered here in detail.
To specify a specific DB
for key storage, the client must place the CSSM_DL_DB_HANDLE structure
into the cryptographic context (CC) that will create the new key as a
CSSM_ATTRIBUTE_DL_DB_HANDLE attribute using the
A CSP/DL must always
have a default DB that is used for key storage in case the client does
not specify a specific DB in the CC. The default DB is the first one in
the list returned by the
Abbreviation | Algorithm Operation | CSSM API(s) |
---|---|---|
H | Message digest (hashing) | CSSM_DigestData |
M | Message Authentication Code (MAC) | CSSM_GenerateMac
CSSM_VerifyMac |
E | Symmetric key encryption | CSSM_EncryptData
CSSM_DecryptData |
P | Public key encryption/
private key decryption | CSSM_EncryptData(Public key)
CSSM_DecryptData(Private key) |
R | Signature with message recovery (private key encryption / public key decryption) | CSSM_EncryptData(Private key)
or CSSM_SignData(Private key), CSSM_DecryptData(Public key) |
S | Signature w/Appendix | CSSM_SignData(Private key)
CSSM_VerifyData(Public key) |
X | Key exchange | CSSM_WrapKey(Public key) or
CSSM_WrapKey(Symmetric key), CSSM_UnwrapKey(Private key) or CSSM_UnwrapKey(Symmetric key) |
K | Key generation | CSSM_GenerateKey (symmetric)
CSSM_GenerateKeyPair (asymmetric) |
D | Key derivation | CSSM_DeriveKey |
Some signature algorithms are capable of being used in a variety of modes. The mode determines how the message digest is tagged and how the digest is transformed before performing the private key operation. Transformation of the message digest includes padding, masking, etc. Each algorithm that supports multiple modes will have a default mode that is assumed by the CSP if one is not explicitly specified as a CC attribute of type CSSM_ATTRIBUTE_MODE.
-
-
CSSM_ALGID_<DigestAlg>With<PrivateKeyAlg>
DigestAlg identifies the name of the message digest algorithm, such as SHA-1 or MD5. PrivateKeyAlg identifies the algorithm used to perform the private key operation. For instance CSSM_ALGID_MD5WithRSA and CSSM_ALGID_SHA1WithDSA indicate combination signature algorithms.
For a combination algorithm, the CSP
performs all necessary message digest transformations according to the
CSSM_ATTRIBUTE_MODE attribute in the signature CC. In addition, the
DigestAlgorithm
parameter to either
The CSSM_ATTRIBUTE_MODE attribute and the DigestAlgorithm parameter (to
either
Encrypt-only signatures can only be
performed using single-stage APIs (.Fn CSSM_SignData
and
When a client needs to generate the algorithm parameters, it uses the
The formats for the algorithm parameters, if any, will be
given along with the algorithm description in
Context Type
CSSM_ALGCLASS_* | Algorithm Mode
CSSM_ALGMODE_* | Valid
Operations | Applicable Standard |
---|---|---|---|
ASYMMETRIC | NONE | P/R | PKCS #1 v2.0, RSAEP/RSADP |
ASYMMETRIC | PKCS1_EME_V15 | P/R/X | PKCS #1 v2.0, EME-PKCS1-v1_5 |
ASYMMETRIC | PKCS1_EME_OAEP | P/X | PKCS #1 v2.0, EME-OAEP |
SIGNATURE | PKCS1_EMSA_V15 | S/R | PKCS #1 v2.0, EMSA-PKCS1-v1_5 |
SIGNATURE | X9_31 | S | ASNI X9.31-1998 |
ASYMMETRIC | ISO_9796 | P/R | ISO 9796-1 |
SIGNATURE | ISO_9796 | S/R | ISO 9796-1 |
The default algorithm mode if the CSSM_ATTRIBUTE_MODE attribute is not in the CC is CSSM_ALGMODE_PKCS1_EME_V15 for asymmetric contexts and CSSM_ALGMODE_PKCS1_EMSA_V15 for signature contexts.
Refer to the appropriate standards for the input length restrictions and output sizes for each mode.
When generating RSA keypairs, the length of the public-modulus may be specified in 8-bit increments. The resulting public and private keys have CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_RSA.
Signature generation and key unwrapping require a private key with CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_RSA. Signature verification and key wrapping require a public key of the same type. Encryption and decryption accept either a public or private key.
When using
the PKCS #1 OAEP algorithm mode, CSSM_ALGMODE_PKCS1_EME_OAEP, the
client must specify the algorithm parameters as an attribute of type
CSSM_ATTRIBUTE_ALG_PARAMS. The CSSM_DATA::Data value must point to the
start address of a CSSM_PKCS1_OAEP_PARAMS structure, and the
CSSM_DATA::Length value must be the size of the parameter structure.
The
Context Type
CSSM_ALGCLASS_* | Algorithm Mode
CSSM_ALGMODE_* | Valid
Operations | Applicable Standard |
---|---|---|---|
SIGNATURE | PKCS1_EMSA_V15 | S | PKCS #1 v2.0, EMSA-PKCS1-v1_5 |
SIGNATURE | X9_31 | S | ANSI X9.31-1998 |
SIGNATURE | ISO_9796 | S | ISO 9796-1 |
The default algorithm mode if the CSSM_ATTRIBUTE_MODE attribute is not in the CC is CSSM_ALGMODE_PKCS1_EMSA_V15.
Refer to the appropriate standards for the input length restrictions and output sizes for each mode.
Signature generation requires a private key with CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_RSA. Signature verification requires a public key of the same type.
Context Type
CSSM_ALGCLASS_* | Algorithm Mode
CSSM_ALGMODE_* | Valid
Operations | Applicable Standard |
---|---|---|---|
SIGNATURE | NONE | S | NIST FIPS 186-2; ANSI X9.30:1-1993 |
When generating DSA keypairs, the length of the prime may be specified in 64-bit increments, starting at 512. The resulting public and private keys have CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_DSA.
Signature generation requires a private key with
CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_DSA. Signature
verification requires a public key of the same type. The
DigestAlgorithm
parameter to the
Generating DSA parameters requires a 160-bit seed value. The CSP obtains this value using the CSSM_ATTRIBUTE_SEED attribute in the cryptographic context. If the supplied seed value is not 160 bits long, then the seed value is processed using SHA-1 and the resulting 160-bit value is used. If the CSSM_ATTRIBUTE_SEED attribute is not present in the context, then an internally generated 160-bit random value is used.
Context Type
CSSM_ALGCLASS_* | Algorithm Mode
CSSM_ALGMODE_* | Valid
Operations | Applicable Standard |
---|---|---|---|
SIGNATURE | NONE | S | NIST FIPS 186-2; ANSI X9.30:1-1993 |
Signature generation requires a private key with CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_DSA. Signature verification requires a public key of the same type.
Context Type
CSSM_ALGCLASS_* | Algorithm Mode
CSSM_ALGMODE_* | Valid
Operations | Applicable Standard |
---|---|---|---|
KEYGEN | NONE | K | PKCS #3 v1.5 |
DERIVEKEY | NONE | D | PKCS #3 v1.5 |
When generating Diffie-Hellman keypairs, the length of the prime value may be specified in 8-bit increments. The resulting public and private keys have CSSM_KEYHEADER::AlgorithmId equal to CSSM_ALGID_DH. The public key value, CSSM_KEY::KeyData, must be sent to the other party taking part in the key agreement process.
When deriving the symmetric
key, the public value received from the other party is specified using
the
Params
parameter to the
The
,cX table34 "" 1
lists the PBD functions defined in PKCS #5 v2.0.
Context Type
CSSM_ALGCLASS_* | Algorithm
CSSM_ALGID_* | PBD Function | Parameter Structure
CSSM_PKCS5_* |
---|---|---|---|
DERIVEKEY | PKCS5_PBKDF1_MD2 | PBKDF1 | PBKDF1_PARAMS |
DERIVEKEY | PKCS5_PBKDF1_MD5 | PBKDF1 | PBKDF1_PARAMS |
DERIVEKEY | PKCS5_PBKDF1_SHA1 | PBKDF1 | PBKDF1_PARAMS |
DERIVEKEY | PKCS5_PBKDF2 | PBKDF2 | PBKDF2_PARAMS |
All of the PKCS #5 PBD algorithms require salt and iteration count
values. They are obtained from the CSSM_ATTRIBUTE_SALT and
CSSM_ATTRIBUTE_ITERATION_COUNT attributes and specified by the
application using the
Salt
and
Iterations
parameters to the
For PBKDF1 based algorithms, the salt value must be exactly 8 bytes long. For PBKDF2, the salt value may have any non-zero length. The CSP returns CSSMERR_CSP_MISSING_ATTR_SALT if the salt attribute is not present in the context, and CSSMERR_CSP_INVALID_ATTR_SALT if the value does not meet the requirements of the algorithm.
The CSP returns CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT if the iteration count attribute is not present in the context, and CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT if the value is zero.
The type of the output key is determined by the CSSM_ATTRIBUTE_KEY_TYPE attribute in the context. The CSP returns CSSMERR_CSP_MISSING_ATTR_KEY_TYPE if the key type attribute is not present in the context, and CSSMERR_CSP_INVALID_ATTR_KEY_TYPE if the type is not supported by the CSP.
-
-
typedef struct CSSM_PKCS5_PBKDF1_PARAMS {
CSSM_DATA Passphrase; /* Input */
CSSM_DATA InitVector; /* Output */
} CSSM_PKCS5_PBKDF1_PARAMS;
Definitions
CSSM_PKCS5_PBKDF2_PARAMS
-
-
typedef uint32 CSSM_PKCS5_PBKDF2_PRF;
#define CSSM_PKCS5_PBKDF2_PRF_HMAC_SHA1 ( 0 )
typedef struct CSSM_PKCS5_PBKDF2_PARAMS {
CSSM_DATA Passphrase;
CSSM_PKCS5_PBKDF2_PRF PseudoRandomFunction;
} CSSM_PKCS5_PBKDF2_PARAMS;
Definitions
Algorithm Name
CSSM_ALGID_* | Valid
Operations | Applicable Standard |
---|---|---|
MD2 | H | IETF RFC1319, April 1992 |
MD4 | H | IETF RFC1320, April 1992 |
MD5 | H | IETF RFC1321, April 1992 |
SHA1 | H | NIST FIPS 180-1; ASNI X9.30:2-1993 |
RIPEMD160 | H | ISO/IEC 10118-3:1998 |
Generic message digest algorithms do not have different modes of operation.
Refer to the appropriate standards for the input length restrictions and output sizes for each algorithm.
Commonly used block ciphers are listed in
Algorithm
CSSM_ALGID_* | Valid
Operations | Applicable
Standards | Comments |
---|---|---|---|
DES,
3DES_3KEY_EEE, 3DES_3KEY_EDE, 3DES_2KEY_EEE, 3DES_2KEY_EDE, 3DES_1KEY_EEE | E, X, M | NIST FIPS 46-3;
ANSI X9.52- 1998 | The 3KEY identifiers indicate a triple-length DES key. The 2KEY identifiers indicate a double-length DES key. The EEE identifiers indicate an encrypt, encrypt, encrypt sequence is performed using consecutive DES keys within the single, double, or triple length keys. Double length operations use the first key for the first and third operation. Single length operations use the same key for all operations. EDE identifiers indicate an encrypt, decrypt, encrypt sequence using the keys as described for EEE operations. |
RC2 | E, X, M | IETF RFC2268,
January 1998 | |
RC5 | E, X, M | IETF RFC2040,
October 1996 |
Generic block ciphers can be used in a number of different modes, with
multiple padding methods. The most common methods are described in
Algorithm Mode
CSSM_ALGMODE_* | Applicable
Standards | Additional
CC Attributes CSSM_ATTRIBUTE_* | Description |
---|---|---|---|
ECB | NIST FIPS 46-3;
NIST FIPS 81; ANSI X9.52-1998 | None | Electronic Codebook (ECB) mode. Raw block encryption with no feedback between data blocks. Equivalent blocks will encrypt to the same value. The input data length must be a multiple of the cipher block size. |
_ | _ | _ | |
ECBPad | PADDING | ECB mode with data padding. The final block of the input data is padded until a multiple of the block length is obtained. Some padding modes may add an additional block to the output data. | |
_ | _ | _ | |
CBC_IV8
CFB_IV8 OFB_IV8 | INIT_VECTOR | Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB) modes. Block encryption with feedback between blocks. Equivalent blocks will encrypt to different values. The input data length must be a multiple of the cipher block size. | |
_ | _ | _ | |
CBCPadIV8
CFBPadIV8 OFBPadIV8 | INIT_VECTOR,
PADDING | Cipher Block Chaining (CBC), Cipher Feedback (CFB), and Output Feedback (OFB) modes with data padding. The final block of the input data is padded until a multiple of the block length is obtained. Some padding modes may add an additional block to the output data. |
If the algorithm mode indicates
IV8,
then the application must supply
an 8-byte initialization vector using the CSSM_ATTRIBUTE_INIT_VECTOR
attribute, and specified by the application using the
InitVector
parameter to the
If the algorithm mode indicates
Pad,
then the application must supply a padding method using the
CSSM_ATTRIBUTE_PADDING attribute, and specified by the application
using the
Padding
parameter to the
Padding Method
CSSM_PADDING_* | Applicable
Standard | Description |
---|---|---|
ZERO | The final block is padded with zeros until the proper length is reached. The method cannot be accurately stripped during decryption if the data contains trailing zero bytes. | |
ONE | The final block is padded with one bits until the proper length is reached. The method cannot be accurately stripped during decryption if the data contains trailing bytes containing all one bits. | |
PKCS5 | PKCS #5 v2.0 | Popular padding method that can be accurately stripped in all cases. Limited to an 8-byte block length. If the input data length is a multiple of the block length, an extra block of data will be added to the output. |
PKCS7 | PKCS #7 v1.5 | Generalized version of PKCS #5 padding that can be applied to any block length. |
RANDOM | Random bytes are used to extend the input data to the proper length. This padding cannot be stripped by the CSP. |
The block size can be configured using the CSSM_ATTRIBUTE_BLOCK_SIZE attribute in the cryptographic context. The value of the attribute can be 32, 64, or 128. If the attribute is missing from the context, the default value 64 is used. If the value of the attribute is outside the value range, the error CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE is returned.
The number of
rounds can be configured using the CSSM_ATTRIBUTE_ROUNDS attribute in
the cryptographic context. If the attribute is missing from the
context, the default value 16 is used. The CSSM_ATTRIBUTE_BLOCK_SIZE
and CSSM_ATTRIBUTE_ROUNDS attributes must be added to the context using
the
Commonly used stream ciphers are listed in
Algorithm
CSSM_ALGID_* | Valid
Operations | Applicable
Standard | Comments |
---|---|---|---|
RC4 | E, X |
Context Type
CSSM_ALGCLASS_* | Algorithm ID
CSSM_ALGID_* | Parameter Structure
CSSM_SSL3_* |
---|---|---|
KEYGEN | SSL3PreMasterGen | None. |
DERIVEKEY | SSL3MasterDerive | MASTER_KEY_DERIVE_PARAMS |
DERIVEKEY | SSL3KeyAndMacDerive | KEY_AND_MAC_DERIVE_PARAMS |
MAC | SSL3MD5_MAC | N/A |
MAC"SSL3SHA1_MAC | N/A |
-
-
typedef struct CSSM_SSL3_MASTER_KEY_DERIVE_PARAMS {
CSSM_DATA ClientRandom; /* Input */
CSSM_DATA ServerRandom; /* Input */
CSSM_VERSION Version; /* Output */
} CSSM_SSL3_MASTER_KEY_DERIVE_PARAMS;
Definitions
-
-
typedef struct CSSM_SSL3_KEY_AND_MAC_DERIVE_PARAMS {
uint32 MACKeyLogicalSizeInBits; /* Input */
uint32 SecretKeyLogicalSizeInBits; /* Input */
uint32 IVLengthInBits; /* Input */
CSSM_BOOL IsExport; /* Input */
CSSM_DATA ClientRandom; /* Input */
CSSM_DATA ServerRandom; /* Input */
CSSM_KEY ClientMACKey; /* Output */
CSSM_KEY ServerMACKey; /* Output */
CSSM_KEY ClientWriteKey; /* Output */
CSSM_KEY ServerWriteKey; /* Output */
CSSM_DATA ClientIV; /* Output */
CSSM_DATA ServerIV; /* Output */
} CSSM_SSL3_KEY_AND_MAC_DERIVE_PARAMS;
Definitions
The result of the key generation is a symmetric key of type CSSM_ALGID_GenericSecret. The length of the key is always 48 bytes (384 bits). The CSP returns CSSMERR_CSP_INVALID_ATTR_KEY_TYPE or CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH if the requested key algorithm, or the requested length does not match those values respectively.
The pre-master secret includes a protocol version number to prevent version rollback attacks. The client can specify the protocol version by adding a CSSM_ATTRIBUTE_VERSION attribute to the key generation context. If the protocol version is not found in the context, then it defaults to 3.0.
Refer to the SSL 3.0 specification for a detailed description of pre-master key generation.
The result of the key derivation is a symmetric key of type CSSM_ALGID_GenericSecret. The length of the key is always 48 bytes (384 bits). The CSP returns CSSMERR_CSP_INVALID_ATTR_KEY_TYPE or CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH if the requested key algorithm, or the requested length does not match those values respectively. The version number embedded in the pre-master secret is also returned in the CSSM_SSL_MASTER_KEY_DERIVE_PARAMS::Version field of the parameters structure.
The following rules are applied to the CSSM_KEYATTR_ALWAYS_SENSITIVE and CSSM_KEYATTR_NEVER_EXTRACTABLE attributes based on the attributes of the pre-master secret key and the attributes specified for the resulting key:
The two MACing keys are always type CSSM_ALGID_GenericSecret. The CSSM_KEYHEADER::KeyUse fields have the CSSM_KEYUSE_SIGN (generate MAC), CSSM_KEYUSE_VERIFY (verify MAC), and CSSM_KEYUSE_DERIVE flags set.
The two encryption keys are determined by the value of the CSSM_ATTRIBUTE_KEY_TYPE attribute in the context. The CSP will return CSSMERR_CSP_MISSING_ATTR_KEY_TYPE if the key type attribute is not present in the context, and CSSMERR_CSP_INVALID_ATTR_KEY_TYPE if the type is not supported by the CSP. The CSSM_KEYHEADER::KeyUse fields have the CSSM_KEYUSE_ENCRYPT, CSSM_KEYUSE_DECRYPT, and CSSM_KEYUSE_DERIVE flags set.
All four keys always inherit the values of the CSSM_KEYATTR_SENSITIVE, CSSM_KEYATTR_ALWAYS_SENSITIVE, CSSM_KEYATTR_EXTRACTABLE, and CSSM_KEYATTR_NEVER_EXTRACTABLE flags from the base key.
When using this algorithm, the DerivedKey parameter is not used and must be NULL.
Algorithm Name
CSSM_ALGID_* | Valid
Operations | Applicable
Standard |
---|---|---|
SSL3MD5_MAC | M | Netscape SSL 3.0 |
SSL3SHA1_MAC | M | Netscape SSL 3.0 |
The length of the MAC output is variable, from 4 to 8
bytes. The length is determined by specifying the
CSSM_ATTRIBUTE_OUTPUT_SIZE parameter in the context. If the attribute
is not present, then the output size defaults to 8. If the attribute is
presentebut outside the valid range, the CSP returns
CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE. The CSSM_ATTRIBUTE_OUTPUT_SIZE
attribute must be added to the context using the
Both MAC algorithms require a symmetric key with type CSSM_ALGID_GenericSecret.
Contents | Next section | Index |