TechnicalReference KeyM
TechnicalReference KeyM
Technical Reference
Key Manager
Version 4.2.0
Document Information
History
Reference Documents
Caution
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
Contents
1 Introduction.......................................................................................................................... 11
1.1 Architecture Overview ............................................................................................... 12
3 Integration ............................................................................................................................ 36
3.1 Embedded Implementation ....................................................................................... 36
3.2 Critical Sections ........................................................................................................ 36
3.3 Certificate Configuration............................................................................................ 37
3.3.1 Algorithm family ........................................................................................ 37
3.3.2 Verification Job and Key Dependencies .................................................... 37
3.3.3 Certificate Initial Value ............................................................................... 38
3.3.4 Element configuration ............................................................................... 39
3.3.5 Public key configuration ............................................................................ 40
3.3.6 Object Type ............................................................................................... 40
3.3.7 Configuration of CRLs ............................................................................... 41
5 Configuration ....................................................................................................................... 88
5.1 Configuration Variants ............................................................................................... 88
5.2 Certificate Elements .................................................................................................. 88
5.3 NvM Block Needs ..................................................................................................... 88
5.4 FAQ .......................................................................................................................... 89
7 Contact ................................................................................................................................. 92
Illustrations
Figure 1-1 Interfaces to adjacent modules of the KeyM ...................................................... 12
Figure 2-1 Setting CA Certificate......................................................................................... 16
Figure 2-2 Certificate Status ............................................................................................... 17
Figure 2-3 Preset Issuer vs. Dynamic Issuer ....................................................................... 25
Figure 2-4 Group Certificates .............................................................................................. 26
Figure 3-1 Certificate Verification Job and Key References ................................................ 38
Tables
Table 2-1 Supported AUTOSAR standard conform features .............................................. 13
Table 2-2 Not supported AUTOSAR standard conform features ........................................ 14
Table 2-3 Features provided beyond the AUTOSAR standard ........................................... 14
Table 2-4 Failure State Transitions .................................................................................... 17
Table 2-5 Dispatching Remote Service Requests .............................................................. 32
Table 2-6 Service IDs ........................................................................................................ 35
Table 2-7 Errors reported to DET....................................................................................... 35
Table 3-1 Implementation files ........................................................................................... 36
Table 3-2 Supported universal ASN.1 tags ........................................................................ 41
Table 3-3 Supported CVC Tags ......................................................................................... 41
Table 4-1 KeyM_CertElementIteratorType ......................................................................... 42
Table 4-2 KeyM_CSRInfoType .......................................................................................... 43
Table 4-3 KeyM_ConstCertDataType ................................................................................ 44
Table 4-4 KeyM_ConstCertDataPointerType ..................................................................... 44
Table 4-5 KeyM_CertificateGroupIdType ........................................................................... 44
Table 4-6 KeyM_CertificateGroupStatusType .................................................................... 44
Table 4-7 KeyM_CertificateStructureType ......................................................................... 45
Table 4-8 KeyM_InitMemory .............................................................................................. 46
Table 4-9 KeyM_Init .......................................................................................................... 46
Table 4-10 KeyM_Deinit ...................................................................................................... 47
Table 4-11 KeyM_GetVersionInfo ........................................................................................ 47
Table 4-12 KeyM_MainFunction .......................................................................................... 48
Table 4-13 KeyM_MainBackgroundFunction ....................................................................... 48
Table 4-14 KeyM_Prepare................................................................................................... 49
Table 4-15 KeyM_Start ........................................................................................................ 50
Table 4-16 KeyM_Update .................................................................................................... 51
Table 4-17 KeyM_Finalize ................................................................................................... 52
Table 4-18 KeyM_Verify ...................................................................................................... 53
Table 4-19 KeyM_ServiceCertificate.................................................................................... 54
Table 4-20 KeyM_SetCertificate .......................................................................................... 55
Table 4-21 KeyM_SetCertificateWithConstPtr ..................................................................... 55
Table 4-22 KeyM_GetCertificate.......................................................................................... 56
Table 4-23 KeyM_VerifyCertificate ...................................................................................... 57
Table 4-24 KeyM_VerifyCertificates ..................................................................................... 58
Table 4-25 KeyM_VerifyCertificateChain ............................................................................. 59
Table 4-26 KeyM_VerifyCertificateChainWithConstPtr......................................................... 60
Table 4-27 KeyM_CertElementGet ...................................................................................... 61
Table 4-28 KeyM_CertElementGetFirst ............................................................................... 62
Table 4-29 KeyM_CertElementGetNext ............................................................................... 63
Table 4-30 KeyM_CertGetStatus ......................................................................................... 63
Table 4-31 KeyM_Cert_SearchCert ..................................................................................... 64
Table 4-32 KeyM_CertificateElementGetByIndex ................................................................ 65
1 Introduction
This document describes the functionality, API and configuration of the AUTOSAR BSW
module KeyM as specified in [1].
The AUTOSAR KeyM module is separated into two sub modules, the crypto key submodule
and the certificate submodule.
The crypto key submodule provides services to introduce or update pre-defined
cryptographic key material.
The certificate submodule provides services for different operations on certificates. It allows
to define and configure certificates in a hierarchical PKI structure with root, intermediate and
target certificates. In this way, certificates can be stored and updated in permanent or
temporary storage. Furthermore, the submodule provides services to verify individual
certificates against already stored and provided certificates in a chain. Besides, the
submodule allows to access certificate data as well as specific certificate elements and to
verify their contents.
Application
«optional»
KeyM
«optional»
«optional»
Read Write
Csm_SignatureVerify Csm_KeySetValid «optional»
NvM Csm
2 Functional Description
2.1 Features
The features listed in the following tables cover the functionality specified for the KeyM.
The AUTOSAR standard functionality is specified in [1], the corresponding features are listed
in the tables
> Table 2-1 Supported AUTOSAR standard conform features
> Table 2-2 Not supported AUTOSAR standard conform features
Vector Informatik provides further KeyM functionality beyond the AUTOSAR standard. The
corresponding features are listed in the table
> Table 2-3 Features provided beyond the AUTOSAR standard
2.1.1 Deviations
The following features specified in [1] are not supported:
Category Description ASR Version
Functional Crypto Key Submodule 4.4.0
Functional Key Generation for CSR 4.4.0
2.1.3 Limitations
2.1.3.1 CSR
The current implementation supports only synchronous CSM jobs for the signature
generation within the scope of a certificate signing request.
In addition, only certificate signing requests for X.509 certificates are supported so far.
2.1.3.2 ECDSA certificates
The signature of an ECDSA certificate contains two integers, an r- and an s-component. If
the lengths in bytes of these components are smaller than the maximum length according
to the ECC curve type of the certificate, the KeyM will format the components in such a way
that both are padded to the next larger multiple of 8 bytes with zero bytes. Thus, it must be
ensured that the underlying Crypto modules can handle signatures formatted in this way.
2.2 Initialization
Before any other functionality of the KeyM module can be called the initialization function
KeyM_Init() has to be called by the BswM.
For manual null initialization of RAM variables, the KeyM offers the function
KeyM_InitMemory() which can be called before the KeyM_Init().
2.3 States
The certificate handling is split into smaller computational units that form a state machine.
This way the main task of KeyM can perform asynchronously certificate operations as a
background task.
The main function can handle only one certificate operation at a time. This operation may
consist of multiple internal states. Internal states are:
The following sequence diagram depicts the states listed above using the example of setting
a CA certificate. Furthermore, it gives an overview of the services provided by other BSW
components used by the KeyM.
DFSeq Functional
KeyM_ServiceCertificate()
Parsing
Verifying elements
Subject check
StbM_GetCurrentTime()
Csm_KeySetValid()
Csm_SignatureVerify()
opt
[Verification successful]
alt
[Nvm used for Key storage]
NvM_WriteBlock()
Csm_KeySetValid()
Parse Validate
certificate certificate
Load certificate at startup
or
KeyM_SetCertificate(len>0) Parsing succeeded Validation succeeded
KEYM_CERTIFICATE
KEYM_CERTIFICATE KEYM_CERTIFICATE _PARSED_NOT_VALI KEYM_CERTIFICATE
_NOT_AVAILABLE _NOT_PARSED DATED _VALID
Power
Up
KeyM_Init
ST4 ST5
or
ST 1
KeyM_SetCertificate(len=0)
ST 8
ST2 ST 6
ST 9
KEYM_E_CERTIFICATE
KEYM_E_CERTIFICATE _VALIDITY KEYM_E_CERTIFICATE
_INVALID_TYPE _PERIOD_FAIL _REVOKED
ST 7
ST3
KEYM_E_CERTIFICATE
KEYM_E_CERTIFICATE _INVALID_CHAIN_OF
_INVALID_CONTENT _TRUST
is needed. The background main function can be used for calling time consuming
synchronous functions.
> DEFERRED
The Block will only be marked as changed via NvM_SetRamBlockStatus.
> IMMEDIATE
The block is marked as changed via NvM_SetRamBlockStatus and the
NvM_WriteBlock is called. It is possible to overwrite the NvM write function and
configure it for NvM writing of KeyM. For this purpose, the name of the function
must be entered in the configuration
"/MICROSAR/KeyM/KeyMGeneral/KeyMNvWriteBlockFctName". Therefore, there is
a delay until the block is written to NvM.
Caution
Depending on the Block Processing mode, the KeyM tries to trigger the write
operation. If the request to start the write operation fails (NvM_SetRamBlockStatus and
NvM_WriteBlock), the KeyM service function will not return with an error. The
KeyM will retry the operation in the next KeyM_MainFunction.
If the NvM operation fails and one of the configured callbacks reports an error, the
write operation will not be retried. The failure needs to be detected by the customer
using NvM. If an NVM write error occurs, the retry of the writing operation needs to be
handled by the customer, e.g. by calling NvM_WriteBlock for the effected block.
Note
It is recommended to ensure that KeyM data, which are stored in one or
more NvM blocks configured by
/MICROSAR/KeyM/KeyMCertificate/KeyMNvmBlock or
/MICROSAR/KeyM/KeyMCRE/KeyMCRENvmBlock,
are restored unchanged. The data integrity can be ensured e.g. by NvM using CRC.
The KeyM module does handle its configured NvM blocks. Therefore, the KeyM provides a
callback for block initialization, reading from blocks and writing to blocks. These callbacks
are specified in 4.4. All blocks need to be mapped to the NvM_ReadAll operation and it is
recommended to map DEFERRED blocks to the NvM_WriteAll operation.
Caution
The KeyM_NvBlock_Callback_KeyMCertificate _<NvBlock> and
KeyM_NvBlock_Callback_CRE must always be called for a write operation. This
includes NvM_WriteBlock and NvM_WriteAll. This can be either ensured by
configuration see 5.3 or by user code.
in the upper hierarchy that is used to verify the signature of the lower certificate (see Chapter
4.2.8.6).
Furthermore, it is possible to verify a given certificate against all certificates in the associated
certificate chain (see Chapter 4.2.8.5). This chain can consist of certificates that are not
permanently available according to the configuration, so that the KeyM offers also an
additional service to pass the missing certificates to complete the chain for verification (see
Chapter 4.2.8.7).
certificate with the certificates in the upper hierarchies. In case of a new root certificate, the
root is verified with its own public key (self-signed). After a successful verification and
storage of the newly added certificate, the certificate status is set to valid, while all
certificates in the lower certificate are invalidated automatically and their status is reset to
parsed but not validated.
Note
During the installation of a CRL the parameter revocationDate is not checked.
The necessary request data for a CSR, such as subject name and optional attributes, is
initialized in a first step by calling KeyM_InitCSR and passing the request data in
CsrInfo. For each array element in CsrInfo all configured subject names and as well
optional attributes have to be set by initializing a data pointer, a data length and an element
type before calling KeyM_InitCSR. All array elements need to be set in the exact order
as the corresponding certificate elements are configured. This parameter points to an array
of request data objects. The data returned by KeyM_InitCSR is then passed as request
data in KeyM_ServiceCertificate for the service
Therefore, the KeyM supports a secondary iterative approach to set CSR element data. By
calling KeyM_CsrElementSet, each CSR element can be set separately. In this regard,
the certificate and element identifier as well as the encoding type need to be referenced.
While the element data for subject names and optional attributes has to be passed as plain
data (KEYM_CERT_ASN1_CSR_NO_ENCODING), extensions need to be encoded
(KEYM_CERT_ASN1_CSR_DER_ENCODING) before being passed in
KeyM_CsrElementSet. This input data includes the complete DER encoded data that
follows an object identifier in a certificate extension. After all CSR elements are set, calling
KeyM_ServiceCertificate with the service KEYM_SERVICE_CERT_REQUEST_CSR,
generates the final CSR structure [7]. Since no data is passed as input information for this
request, the parameter RequestDataLength needs to be zero. Note, however, that
RequestDataLength must still be a valid (i.e., not null) pointer.
After the Certificate Authority has signed the generated CSR, the resulting certificate can be
stored and validated by calling KeyM_ServiceCertificate with the service
KEYM_SERVICE_CERT_UPDATE_SIGNED_CSR.
Note
The following distinguished name attributes are not supported for the CSR
initialization with the service KeyM_InitCSR:
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_SURNAME,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_SERIALNUMBER,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_STREETADDRESS,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_TITLE,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_GIVENNAME,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_EMAIL,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_USERID,
KEYM_CERT_ASN1_CSR_ELEMENT_SUBJECT_DOMAINCOMPONENT
Instead use KeyM_CsrElementSet to initialize a CSR with the upper
distinguished name attributes.
The concept of dynamic certificate issuers mainly has the advantage of flexible PKI handling,
so that the user has to neither know the hierarchical relationships between certificates at
configuration time nor keep a specific order in which certificates have to be installed.
Furthermore, this approach saves resources, as the required memory for certificate data
storage can be reduced, since it eliminates the need to keep empty and unused certificate
slots for all possible configuration variants.
R R
I1 I2 I1 I2
W1 ? ? W2 W1 ? W2
Figure 2-3 shows an example of a traditional preset-issuer scenario (left) and an example
of a dynamic issuer scenario (right). Both examples depict the use-case in which a working
certificate (named “?” in the figure) can be issued by one of two intermediary CA certificates.
In the traditional scenario, this use-case requires the user to create the working certificate
twice, once with every possible issuer. In scenario 2, the working certificate is configured so
that its issuer is determined dynamically at runtime. As shown in the figure, the configuration
can be flexibly extended to even include the root certificate. In this scenario, no additional
certificates are required and thus no additional memory resources are consumed.
If dynamic issuers are enabled for a certificate, its issuer is determined based on its issuer
common name.
In theory, this may enable an attack in which an attacker installs a certificate with a forged
subject common name, so that some certificates with dynamic issuers falsely identify it as
their issuer. The attacker has thus tampered with the legitimate issuer relations within the
PKI.
In order to thwart this kind of attack, the MICROSAR Classic KeyM introduces the concept
of Certificate Groups.
Certificate Groups reference two kinds of certificates:
> Members, which may act as issuer for each other. Every certificate with a dynamic
issuer must be a member of exactly one Certificate Group. All members of a
Certificate Group must have the exact same structure (for reasons explained in the
next paragraph), except for heterogeneous groups (see Chapter 2.6.11.1). Group
members can be configured via a group’s KeyMCertificateGroupCertRef parameter.
> Additional Issuers, which are themselves not members of the group but may act as
issuer for group members. A certificate may act as an Additional Issuer for several
Certificate Groups. This is illustrated in Figure 2-4. Additional Issuers can be
configured via a group’s KeyMCertificateGroupIssuerRef parameter.
Besides defining which certificates may issue each other, Certificate Groups can also be
used to dynamically determine slots for certificates at runtime. For example, the user may
want to set a KeyM certificate at runtime, but does not know its ID. With Certificate Groups,
all the user needs to know about the certificate is its Group ID. The KeyM will determine the
certificate’s slot based on the certificate’s subject common name. If a certificate with the
same subject name is already present in the group, the KeyM will update that certificate. If
such a certificate is not yet present, it will select the next free slot within the group.
Shared additional
R dynamic issuer
reference
Group certificate
references
Group A Group B
Figure 2-4 Group Certificates
Members of a certificate group can be initially installed and updated using the service
KeyM_SetCertificateInGroup (see 4.2.8.18). When a certificate is initially set, the
parsing and the verification of certificate elements is processed synchronously within this
function. When a certificate is updated all certificates in the lower hierarchies are invalidated
For persisting the CREs in NvM, the same principles apply as for certificates. See 2.6.3.2
for further information.
whole structure together with its structure header. The certificate structures that can be
retrieved via this API are listed in Table 4-7.
There are some certificate elements that do not consist of ASN.1 structures, such as the
Version or Serial Number fields. For these elements, the returned data consists only of the
primitive element data.
Note
It must be secured that in the CSM hash primitive, which is referenced in the CSM
hash job, the result length is big enough to store the calculated hash
Thus, a Certificate Status message is conveyed to the client, containing a list of all single
OCSP responses. The KeyM offers a service to parse and verify a Certificate Status
message and retrieve the revocation status for the corresponding certificates. For this
purpose, the common AUTOSAR API KeyM_ServiceCertificate() (see Chapter
4.2.8.1) can be used along with a custom service KEYM_SERVICE_CERT_STATUS_OCSP.
The Certificate Status message is passed as input data in the parameters RequestData
and RequestDataLenght. In case of an erroneous OCSP response within the Certificate
Status message, the OCSP response status will be returned in ResponseData and
ResponseDataLength. The remaining parameters are not used for the
KEYM_SERVICE_CERT_STATUS_OCSP service but still need to be valid. Ensure that the
parameter CertNamePtr is no null pointer. The parsing and verification of the passed
Certificate Status message is processed synchronously.
The KeyM supports both status types for Certificate Status messages containing single or
multiple OCSP responses. Besides, the KeyM is capable of processing OCSP responses of
the id-pkix-ocsp-basic response type. Within this context, a single OCSP response
can contain multiple certificates that are used to verify the OCSP signature. Furthermore,
the KeyM offers full support of hashing algorithms for the CertId element. The used OCSP
signature algorithm can be ECDSA or RSA.
After parsing of the Certificate Status message finished, the OCSP elements are verified
according to [8]. The KeyM verifies the following:
> OCSP response status
> Basic Response type
> Certificate identified in a received response
> Validity period of OCSP response (thisUpdate and nextUpdate)
> Version
> OCSP response signature
> Responder’s signature against certificate chain
> Certificate Status Value
Any other optional element within the OCSP response is parsed but not verified. If the OCSP
response is valid and the certificate shall be revoked according to the Certificate Status
Value, the KeyM will set the certificate status to KEYM_E_CERTIFICATE_REVOKED and a
revocation entry is added (see Chapter 2.6.12).
In order to enable the support of OCSP revocation for a given certificate, the optional sub
container KeyMOCSP needs to be configured per certificate. If the OCSP response contains
optional certificates for the OCSP signature verification, the optional parameter
KeyMOCSPDelegatedResponderRef needs to be configured. The dynamic group
referenced by this parameter is used to install the additional certificates. The hash algorithm
used for the CertId element in a OCSP response can be specified by configuring
KeyMOCSPResponseCertIdHashCsmJobRef. Furthermore, if the responder of the OCSP
response is identified by a public key hash, instead of its distinguished name, the CSM job
used for this hash operation can be configured in
Caution
Please ensure that separate CSM jobs and CSM keys are configured for each certificate.
The crypto key identifier in the referenced CSM job corresponds to the certificate
identifier of the certificate on remote side. Therefore, the custom Crypto driver (e.g.
Crypto_30_KeyM) shall provide a mapping between crypto key identifier and certificate
identifier.
Also ensure that the used CSM job primitive is set to the AEAD Decrypt primitive
provided by the custom Crypto driver.
Caution
Please consider that the startup handling for preconfigured certificates is processed on
remote side only.
Caution
Since the revocation of a single certificate can have an effect on the complete PKI, CRE
(see Chapter 2.6.12) and OCSP (see Chapter 2.6.15) are processed either fully on
application side or remote side. Mixed PKIs with application and remote certificates are
suppressed by generator validation. This applies for both certificates with preset issuer
as well as certificates with dynamic issuer (see Chapter 2.6.11).
KeyM_DispatchRemoteJob KeyM_ServiceCertificate
KeyM_ServiceCertificateById
KeyM_VerifyCertificates
KeyM_VerifyCertificate
KeyM_VerifyCertificateChain
KeyM_SetCertificateInGroup
KeyM_VerifyGroup
KeyM_DispatchRemoteKeyElementSet KeyM_SetCertificate
KeyM_SetCRE
KeyM_CsrElementSet
KeyM_DispatchRemoteKeyElementGet KeyM_GetCertificate
KeyM_CertElementGet
KeyM_CertGetStatus
KeyM_CertificateElementGetByIndex
KeyM_CertificateElementGetCount
KeyM_CertStructureGet
KeyM_GetIssuerCertId
KeyM_GetCertHash
Table 2-5 Dispatching Remote Service Requests
Caution
Due to parameter limitations of CSM primitives and key management APIs, the following
KeyM services are not supported for remote service handling:
• KeyM_CertElementGetFirst
• KeyM_CertElementGetNext
• KeyM_InitCSR
• KeyM_GetGroupCertId
Note
If a CA certificate shares a RAM slot with another certificate and the CA certificate is
preempted from the RAM slot, all of its directly and indirectly issued certificates will
remain in their current respective certificate statuses (e.g.
KEYM_CERTIFICATE_VALID).
If a verification is not explicitly triggered on these certificates, they will remain in their
certificate status until ECU restart and will, for example, not react to a revocation of an
upper certificate.
If a verification is triggered on one of these certificates and the CA certificate is still
preempted from the RAM slot, the verification will fail and the orphaned certificate's
status will reflect this.
Service ID Service
0x09 KeyM_ServiceCertificate()
0x0A KeyM_SetCertificate()
0x0B KeyM_GetCertificate()
0x0C KeyM_VerifyCertificates()
0x0D KeyM_VerifyCertificate()
0x0E KeyM_VerifyCertificateChain()
0x0F KeyM_CertElementGet()
0x10 KeyM_CertElementGetFirst()
0x11 KeyM_CertElementGetNext()
0x12 KeyM_CertGetStatus()
0x19 KeyM_MainFunction()
0x1A KeyM_MainBackgroundFunction()
0x80 KeyM_NvBlock_ReadFromBlock()
0x81 KeyM_NvBlock_WriteToBlock()
0x82 KeyM_NvBlock_Init()
0x83 KeyM_NvBlock_Callback()
0x84 KeyM_NvBlock_ReadFromBlock_CRE()
0x85 KeyM_NvBlock_WriteToBlock_CRE()
0x86 KeyM_NvBlock_Init_CRE()
0x87 KeyM_NvBlock_Callback_CRE()
0x88 KeyM_CertificateElementGetByIndex()
0x89 KeyM_CertificateElementGetCount()
0x8A KeyM_InitCSR()
0x8B KeyM_ServiceCertificateById()
0x8C KeyM_SetCertificateInGroup()
0x8D KeyM_GetGroupCertId()
0x8E KeyM_VerifyGroup()
0x8F KeyM_SetCRE()
0x90 KeyM_CertStructureGet()
0x91 KeyM_GetIssuerCertId()
0x92 KeyM_GetCertHash()
0x93 KeyM_CsrElementSet()
0x94 KeyM_DispatchRemoteJob()
0x95 KeyM_DispatchRemoteKeyElementSet()
0x96 KeyM_DispatchRemoteKeyElementGet()
0x97 KeyM_SetCertificateWithConstPtr()
0x98 KeyM_VerifyCertificateChainWithConstPtr()
0x99 KeyM_Cert_SearchCert()
Service ID Service
0x9A KeyM_Cert_IsBusy()
0x9B KeyM_CallbackNotificationSignature()
0x9C KeyM_CertElementGetByStructureType()
Table 2-6 Service IDs
3 Integration
This chapter gives necessary information for the integration of the MICROSAR Classic
KeyM into an application environment of an ECU.
> KEYM_EXLUSIVE_AREA_1
This critical section protects concurrent accesses to KeyM_CertStorage by KeyM and
NVM, e.g. copy operations, and accesses to KeyM_NvBlock_State used for NVM
handling. Furthermore, it ensures the consistency of global RAM variables for
certificate data.
Caution
The configuration of the KeyM has dependencies to the Crypto Stack and the NvM.
Therefore, it is necessary to always generate the KeyM in case the configuration of the
Crypto Stack or NvM was changed.
Caution
All signature verify jobs need to be configured either as synchronous or as
asynchronous jobs. A mixed configuration leads to undefined behavior.
Intermediate
Job 2
Signature Verify Job Ref
Job Key Ref
Working Certificate
Job 3
Caution
Certificate information and the length of the certificate information provided via
KeyMCertInitCallout may not be changed during the lifetime of the data. If this
happens, the processing of the certificate information may return with errors.
The path is based on the outer ASN.1 sequence element of the basic element structure. The
certificate element path is configured in chapters so that each chapter corresponds to a
nesting level within the ASN.1 sequence. Chapters are specified with decimal integers and
dots in between subchapters.
Exemplary configuration of the element path for the red INTEGER within the following ASN.1
SEQUENCE and path 1.2.1:
SEQUENCE {
OBJECT IDENTIFIER,
OCTET STRING {
INTEGER,
}
}
Caution
Mandatory certificate elements that are relevant for the verification (e.g. public key,
signature, validity period, issuer and subject common names) need to be configured in
order to ensure an accurate processing.
Object Id 0x06
Enumerated 0x0A
UTF8 0x0C
Printable String 0x13
IA5 String 0x16
UTC Time 0x17
Generalized Time 0x18
BMPString 0x1E
Table 3-2 Supported universal ASN.1 tags
CVC certificates, in particular, include application elements with tags that are encoded in
one or two octets. Besides the element class and structure type, the remaining tag number
is an identifier for the element description type.
The table below shows the complete tag value for all supported element description types
and the corresponding object type which should be used for the corresponding element in
the configuration.
Element Description Tag Object Type
Certificate Profile Identifier 0x5F29 0x2
Certification Authority Reference 0x42 0xC
Public Key 0x7F49 0x81 / 0x86
Certificate Holder Reference 0x5F20 0xC
Certificate Holder Authorization 0x7F4C 0x4
Template
Certificate Effective Date 0x5F25 0x17
Certificate Expiration Date 0x5F24 0x17
Signature 0x5F37 0x4
Discretionary Data 0x53 0x4
Table 3-3 Supported CVC Tags
The element for elliptic curve public keys can include all curve parameters marked with
corresponding tags (0x81 – 0x87). In this case the object type for the public key element
has to be configured to 0x81.
It is also possible that only the public point is available as curve parameter in the plain data
of the public key, designated with the tag 0x86. In this case the object type has to be
configured to 0x86.
4 API Description
KeyM_CertElementIteratorType
This structure is used to iterate through a number of elements of a certificate.
Struct Element C-Type Description Value Range
Name
certId uint16 Holds the identifier of the
certificate.
Holds the offset to the parsed
offset uint16
element in the RAM buffer.
Holds the length of the element
elementLength uint16
to be retrieved.
Holds the element index of the
rootElementIdx uint16
root element.
KEYM_CERT_ELEMENT_ITERATION
_NOT_INITIALIZED
KEYM_CERT_ELEMENT_ITERATION
Holds the current status of the _INITIALIZED
iterationStatus uint8
iteration process. KEYM_CERT_ELEMENT_ITERATION
_VALID
KEYM_CERT_ELEMENT_ITERATION
_INVALID
Table 4-1 KeyM_CertElementIteratorType
KeyM_CSRInfoType
This structure is used to initialize the request objects for a CSR.
Struct C-Type Description Value Range
Element
Name
dataPtr uint8* Points to an array that
holds request object
data.
Holds the length of the
dataLength uint16
request object data.
The buffer referenced by dataPtr must provide at least as many bytes as stored in
dataLength.
KeyM_ConstCertDataType
This structure is used to provide initial certificate data with an optional callout (see 4.5.2.3).
The buffer referenced by certData must provide at least as many bytes as stored in
certDataLength.
KeyM_ConstCertDataPointerType
This type is used in KeyM_ConstCertDataType.
Type Name C-Type Description
KeyM_ConstCertDataPointerType const uint8* Points to an array that holds initial certificate
data.
KeyM_CertificateGroupIdType
This type is used to identify a certificate group.
Type Name C-Type Description
KeyM_CertificateGroupIdType uint16 Holds the certificate group identifier.
KeyM_CertificateGroupStatusType
This type is used for the overall status of a certificate group verification.
Type Name C- Description Value Range
Type
KeyM_CertificateGroupStatusType uint8 Holds the KEYM_CERT_VERIFY_GROUP_VALID
result of a All group member certificates were
certificate verified successfully.
group
verification. KEYM_CERT_VERIFY_GROUP_INVALID
One or more group member certificates
could not be verified successfully.
Table 4-6 KeyM_CertificateGroupStatusType
KeyM_CertificateStructureType
This uint32-based enumeration type is used by APIs that allow the configuration-
independent retrieval of certificate element data. There are multiple APIs like this and the
way in which they format the retrieved data may differ slightly (see chapters 2.6.5 and 2.6.13
and for details). Note that not all APIs are compatible with all structures. The right columns
of the following table show which values are compatible with which API. Some values are
currently not used by any API, but may be supported in the future.
KeyM_CertStructureGet
KeyM_CertElementGet
ByStructureType
Value
KEYM_CERTIFICATE_EXTENSION X
KEYM_CERTIFICATE_ISSUER_NAME X
KEYM_CERTIFICATE_ISSUER_UNIQUE_IDENTIFIER
KEYM_CERTIFICATE_REVOCATION_LIST
KEYM_CERTIFICATE_SERIAL_NUMBER X X
KEYM_CERTIFICATE_SIGNATURE X X
KEYM_CERTIFICATE_SIGNATURE_ALGORITHM X X
KEYM_CERTIFICATE_SIGNATURE_ALGORITHM_ID X X
KEYM_CERTIFICATE_SUBJECT_NAME X
KEYM_CERTIFICATE_SUBJECT_PUBLIC_KEY_INFO_PUBLIC_KEY_ALGORITHM X
KEYM_CERTIFICATE_SUBJECT_PUBLIC_KEY_INFO_SUBJECT_PUBLIC_KEY
KEYM_CERTIFICATE_SUBJECT_UNIQUE_IDENTIFIER
KEYM_CERTIFICATE_VALIDITY_PERIOD_NOT_AFTER X
KEYM_CERTIFICATE_VALIDITY_PERIOD_NOT_BEFORE X
KEYM_CERTIFICATE_VERSION_NUMBER X X
KEYM_CERTIFICATE_SUBJECT_PUBLIC_KEY_INFO X
KEYM_CERTIFICATE_VALIDITY_PERIOD X
KEYM_CERTIFICATE_SUBJECT_PUBLIC_KEY_INFO_PUBLIC_KEY_ECC_CURVE X
Table 4-7 KeyM_CertificateStructureType
4.2.1 KeyM_InitMemory
Prototype
void KeyM_InitMemory (void)
Parameter
void none
Return code
void none
Functional Description
The function initializes variables, which cannot be initialized with the startup code.
Initialize component variables at power up.
Particularities and Limitations
Module is uninitialized.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-8 KeyM_InitMemory
4.2.2 KeyM_Init
Prototype
void KeyM_Init (const KeyM_ConfigType *ConfigPtr)
Parameter
ConfigPtr [in] Pointer to the configuration set in VARIANT-POST-BUILD
Return code
void none
Functional Description
Initializes the Key Manager.
This function initializes the KeyM module. It initializes all variables and sets the module state to initialized.
Particularities and Limitations
Interrupts are disabled. Module is uninitialized.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-9 KeyM_Init
4.2.3 KeyM_Deinit
Prototype
void KeyM_Deinit (void)
Parameter
void none
Return code
void none
Functional Description
Resets the Key Manager.
This function resets the KeyM module to the uninitialized state.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-10 KeyM_Deinit
4.2.4 KeyM_GetVersionInfo
Prototype
void KeyM_GetVersionInfo (Std_VersionInfoType *VersionInfo)
Parameter
VersionInfo [out] Pointer to where to store the version information. Parameter must not be
NULL.
Return code
void none
Functional Description
Returns the version information.
KeyM_GetVersionInfo() returns version information, vendor ID and AUTOSAR module ID of the component.
Particularities and Limitations
-
Configuration Variant(s): KEYM_VERSION_INFO_API == STD_ON
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-11 KeyM_GetVersionInfo
4.2.5 KeyM_MainFunction
Prototype
void KeyM_MainFunction (void)
Parameter
void none
Return code
void none
Functional Description
Main function of the module. Is called cyclically and handles asynchronous jobs.
Particularities and Limitations
Declared and called by SchM.
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-12 KeyM_MainFunction
4.2.6 KeyM_MainBackgroundFunction
Prototype
void KeyM_MainBackgroundFunction (void)
Parameter
void none
Return code
void none
Functional Description
Main function for background tasks.
Function is called from a pre-emptive operating system when no other task operation is needed. Can be
used for calling time consuming synchronous functions.
Particularities and Limitations
Declared and called by SchM.
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-13 KeyM_MainBackgroundFunction
4.2.7.2 KeyM_Start
Prototype
Std_ReturnType KeyM_Start (KeyMStartType StartType, const uint8 *RequestData,
uint32 RequestDataLength, uint8 *ResponseData, uint32 *ResponseDataLength)
Parameter
StartType [in] Defines in which mode the key operation shall be executed.
RequestData [in] Information that comes along with the request, e.g. signature.
RequestDataLength [in] Length of data in the RequestData array.
ResponseDataLength In: Max number of bytes available in ResponseData. Out: Actual number.
[in,out]
ResponseData [out] Data returned by the function.
Return code
Std_ReturnType E_OK Start operation successfully performed. Key update operations are now
allowed.
E_NOT_OK Start operation not accepted.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Starts a session for key operations.
This function is optional and only used if the configuration item
KeyMCryptoKeyStartFinalizeFunctionEnabled is set to true. It intends to allow key update operation.
Particularities and Limitations
-
Configuration Variant(s): KEYM_CRYPTO_KEY_START_FINALIZE_FUNCTION_ENABLED == STD_ON
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-15 KeyM_Start
4.2.7.3 KeyM_Update
Prototype
Std_ReturnType KeyM_Update (const uint8 *KeyNamePtr, uint32 KeyNameLength,
const uint8 *RequestDataPtr, uint32 RequestDataLength, uint8 *ResultDataPtr,
uint32 ResultDataMaxLength)
Parameter
KeyNamePtr [in] Pointer to an array that defines the name of the key to be updated.
KeyNameLength [in] Specifies the number of bytes in keyName. The value 0 indicates that no
keyName is provided within this function.
RequestDataPtr [in] Information that comes along with the request.
RequestDataLength [in] Length of data in the RequestData array.
ResultDataMaxLength [in] Max number of bytes available in ResultDataPtr.
ResultDataPtr [out] Pointer to a data buffer used by the function to store results.
Return code
Std_ReturnType E_OK Service has been accepted and will be processed
internally. Results will be provided through a callback
4.2.7.4 KeyM_Finalize
Prototype
Std_ReturnType KeyM_Finalize (const uint8 *RequestDataPtr, uint32
RequestDataLength, uint8 *ResponseDataPtr, uint32 ResponseMaxDataLength)
Parameter
RequestDataPtr [in] Information that comes along with the request.
RequestDataLength [in] Length of data in the RequestData array.
ResponseMaxDataLength In: Max number of bytes available in ResponseData. Out: Actual number of
[in,out] bytes in ResponseData or left untouched if service runs in asynchronous
mode and function returns KEYM_E_OK.
ResponseDataPtr [out] Data returned by the function.
Return code
Std_ReturnType E_OK Service has been accepted and will be processed
internally. Results will be provided through a callback
4.2.7.5 KeyM_Verify
Prototype
Std_ReturnType KeyM_Verify (const AUTOMATIC *KeyNamePtr, uint32 KeyNameLength,
const uint8 *RequestData, uint32 RequestDataLength, uint8 *ResponseData, uint32
*ResponseDataLength)
Parameter
KeyNamePtr [in] Points to an array that defines the name of the key to be updated.
KeyNameLength [in] Specifies the number of bytes in KeyNamePtr. The value 0 indicates that no
KeyNamePtr is provided within this function.
RequestData [in] Information that comes along with the request.
RequestDataLength [in] Length of data in the RequestData array
ResponseDataLength In: Max number of bytes available in ResponseData. Out: Actual number of
[in,out] bytes in ResponseData or left untouched if service runs in asynchronous
mode and function returns KEYM_E_PENDING.
ResponseData [out] Data returned by the function.
Return code
Std_ReturnType E_OK Operation was successfully performed. Result
information are available.
4.2.8.2 KeyM_SetCertificate
Prototype
Std_ReturnType KeyM_SetCertificate (KeyM_CertificateIdType CertId, const
KeyM_CertDataType *CertificateDataPtr)
Parameter
CertId [in] Holds the identifier of the certificate.
CertificateDataPtr [in] Pointer to a structure that provides the certificate data.
Return code
Std_ReturnType E_OK Certificate accepted.
E_NOT_OK Certificate could not be set.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Temporarily store certificate.
This function provides the certificate data to the key management module to temporarily store the
certificate.
Particularities and Limitations
CertificateDataPtr->certData must be a valid, non-NULL pointer to a buffer of at least
CertificateDataPtr->certDataLength bytes.
The parsing of a certificate and the verifying of certificate elements is performed synchronously within this
function.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-20 KeyM_SetCertificate
4.2.8.3 KeyM_SetCertificateWithConstPtr
Prototype
Std_ReturnType KeyM_SetCertificateWithConstPtr (KeyM_CertificateIdType CertId,
const KeyM_ConstCertDataType *CertificateDataPtr)
Parameter
CertId [in] Holds the identifier of the certificate.
CertificateDataPtr [in] Pointer to a structure that provides the certificate data.
Return code
Std_ReturnType E_OK Certificate accepted.
E_NOT_OK Certificate could not be set.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Temporarily store certificate.
This function is identical to KeyM_SetCertificate, but it accepts a const pointer to certificate data.
Particularities and Limitations
CertificateDataPtr->certData must be a valid, non-NULL pointer to a buffer of at least
CertificateDataPtr->certDataLength bytes.
The parsing of a certificate and the verifying of certificate elements is performed synchronously within this
function.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-21 KeyM_SetCertificateWithConstPtr
4.2.8.4 KeyM_GetCertificate
Prototype
Std_ReturnType KeyM_GetCertificate (KeyM_CertificateIdType CertId,
KeyM_CertDataType *CertificateDataPtr)
Parameter
CertId [in] Holds the identifier of the certificate.
CertificateDataPtr [in,out] Provides a pointer to a certificate data structure. The buffer located by the
pointer in the structure shall be provided by the caller of this function. The
length information indicates the maximum length of the buffer when the
function is called. If E_OK is returned, the length information indicates the
actual length of the certificate data in the buffer.
Return code
Std_ReturnType E_OK Certificate data available and provided.
E_NOT_OK Operation not accepted due to an internal error.
KEYM_E_PARAMETER_MISMATCH Certificate ID invalid.
KEYM_E_KEY_CERT_SIZE_MISMATCH Provided buffer for the certificate
too small.
KEYM_E_KEY_CERT_EMPTY No certificate data available, the certificate slot
is empty.
KEYM_E_KEY_CERT_READ_FAIL Certificate cannot be provided, access
denied.
Functional Description
Provide certificate.
This function provides the certificate data.
Particularities and Limitations
CertificateDataPtr->certData must be a valid, non-NULL pointer to a buffer of at least
CertificateDataPtr->certDataLength bytes.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-22 KeyM_GetCertificate
4.2.8.5 KeyM_VerifyCertificate
Prototype
Std_ReturnType KeyM_VerifyCertificate (KeyM_CertificateIdType CertId)
Parameter
CertId [in] Holds the identifier of the lower certificate in the chain.
Return code
Std_ReturnType E_OK Certificate verification request accepted. Operation will be
performed in the background and response is given through a callback.
E_NOT_OK Operation not accepted due to an internal error.
KEYM_E_BUSY Validation cannot be performed yet. KeyM is
currently busy with other jobs.
4.2.8.6 KeyM_VerifyCertificates
Prototype
Std_ReturnType KeyM_VerifyCertificates (KeyM_CertificateIdType CertId,
KeyM_CertificateIdType CertUpperId)
Parameter
CertId [in] Holds the identifier of the lower certificate in the chain.
CertUpperId [in] Holds the identifier of the upper certificate in the chain.
Return code
Std_ReturnType E_OK Certificate verification request accepted. Operation will be
performed in the background and response is given through a callback.
4.2.8.7 KeyM_VerifyCertificateChain
Prototype
Std_ReturnType KeyM_VerifyCertificateChain (KeyM_CertificateIdType CertId,
const KeyM_CertDataType certChainData[], uint8 NumberOfCertificates)
Parameter
CertId [in] Holds the identifier of the last certificate in the chain.
certChainData [in] This is a pointer to an array of certificates sorted according to the order in the
PKI.
NumberOfCertificates [in] Defines the number of certificates stored in the CertChainData array.
Return code
Std_ReturnType E_OK Certificate verification request accepted. Operation will be
performed in the background and response is given through a callback.
4.2.8.8 KeyM_VerifyCertificateChainWithConstPtr
Prototype
Std_ReturnType KeyM_VerifyCertificateChainWithConstPtr (KeyM_CertificateIdType
CertId, const KeyM_ConstCertDataType certChainData[], uint8
NumberOfCertificates)
Parameter
CertId [in] Holds the identifier of the last certificate in the chain.
certChainData [in] This is a pointer to an array of certificates sorted according to the order in the
PKI.
NumberOfCertificates [in] Defines the number of certificates stored in the CertChainData array.
Return code
Std_ReturnType E_OK Certificate verification request accepted. Operation will be
performed in the background and response is given through a callback.
Call context
> TASK
> This function is not synchronous
> This function is Non-Reentrant
Table 4-26 KeyM_VerifyCertificateChainWithConstPtr
4.2.8.9 KeyM_CertElementGet
Prototype
Std_ReturnType KeyM_CertElementGet (KeyM_CertificateIdType CertId,
KeyM_CertElementIdType CertElementId, uint8 *CertElementData, uint32
*CertElementDataLength)
Parameter
CertId [in] Holds the identifier of the last certificate in the chain.
CertElementId [in] Specifies the ElementId where the data shall be read from.
CertElementDataLength In: Pointer to a value that contains the maximum data length of the
[in,out] CertElementData buffer. Out: The data length will be overwritten with the
actual length of data placed to the buffer if the function returns E_OK.
Otherwise, the it will be overwritten with the value zero.
CertElementData [out] Pointer to a data buffer allocated by the caller of this function. If available, the
function returns E_OK and copies the data into this buffer.
Return code
Std_ReturnType E_OK Element found and data provided in the buffer.
E_NOT_OK Element data not found.
KEYM_E_PARAMETER_MISMATCH Certificate ID or certificate element ID
invalid.
KEYM_E_KEY_CERT_SIZE_MISMATCH Provided buffer for the certificate
element too small.
KEYM_E_KEY_CERT_EMPTY No certificate data available, the certificate slot
is empty.
KEYM_E_KEY_CERT_INVALID The certificate is not valid or has not yet been
verified.
Functional Description
Provide certificate element.
Provides the content of a specific certificate element. The certificate configuration defines how the
certificate submodule can find the element, e.g. by providing the object identifier (OID). This function is
used to retrieve this information if only one element is assigned to the respective OID.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
4.2.8.10 KeyM_CertElementGetFirst
Prototype
Std_ReturnType KeyM_CertElementGetFirst (KeyM_CertificateIdType CertId,
KeyM_CertElementIdType CertElementId, KeyM_CertElementIteratorType
*CertElementIterator, uint8 *CertElementData, uint32 *CertElementDataLength)
Parameter
CertId [in] Holds the identifier of the last certificate in the chain.
CertElementId [in] Specifies the ElementId where the data shall be read from.
CertElementIterator [in,out] Pointer to a structure that is allocated and maintained by the caller. It shall not
be destroyed or altered by the application until all elements have been
retrieved through KeyM_CertElementGetNext().
CertElementDataLength In: Pointer to a value that contains the maximum data length of the
[in,out] CertElementData buffer. Out: The data length will be overwritten with the
actual length of data placed to the buffer if the function returns E_OK.
CertElementData [out] Pointer to a data buffer allocated by the caller of this function. If available, the
function returns E_OK and copies the data into this buffer.
Return code
Std_ReturnType E_OK Element found and data provided in the buffer.
The certElementIterator has been initialized accordingly.
4.2.8.11 KeyM_CertElementGetNext
Prototype
Std_ReturnType KeyM_CertElementGetNext (KeyM_CertElementIteratorType
*CertElementIterator, uint8 *CertElementData, uint32 *CertElementDataLength)
Parameter
CertElementIterator [in,out] Pointer to a structure that is allocated by the caller and used by the function. It
shall not be destroyed or altered by the application until all elements have
been read from the list.
CertElementDataLength In: Pointer to a value that contains the maximum length of the
[in,out] CertElementData buffer. Out: The data length will be overwritten with the
actual length of data placed to the buffer if the function returns E_OK.
CertElementData [out] Pointer to a data buffer allocated by the caller of this function. If available, the
function returns E_OK and copies the data into this buffer.
Return code
Std_ReturnType E_OK Element found and data provided in the buffer.
The certElementIterator has been initialized accordingly.
4.2.8.12 KeyM_CertGetStatus
Prototype
Std_ReturnType KeyM_CertGetStatus (KeyM_CertificateIdType CertId,
KeyM_CertificateStatusType *Status)
Parameter
CertId [in] Holds the identifier of the certificate.
Status [out] Provides the status of the certificate.
Return code
Std_ReturnType E_OK Certificate status available and provided.
E_NOT_OK Status provisioning currently not possible.
KEYM_E_PARAMETER_MISMATCH Certificate ID invalid.
Functional Description
Provides certificate status.
This function provides the status of a certificate.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-30 KeyM_CertGetStatus
4.2.8.13 KeyM_Cert_SearchCert
Prototype
boolean KeyM_Cert_SearchCert (const uint8 *certNamePtr, uint32 certNameLength,
KeyM_CertificateIdType *certId)
Parameter
certNamePtr [in] Pointer to a buffer that defines the name of the certificate.
certNameLength [in] Name buffer length.
certId [out] Holds the identifier of the certificate.
Return code
boolean TRUE Certificate with given name is available.
FALSE Certificate with given name is not available.
Functional Description
Search name of referenced certificate in configuration.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-31 KeyM_Cert_SearchCert
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-32 KeyM_CertificateElementGetByIndex
4.2.8.15 KeyM_CertificateElementGetCount
Prototype
Std_ReturnType KeyM_CertificateElementGetCount (KeyM_CertificateIdType CertId,
KeyM_CertElementIdType CertElementId, uint16 *Count)
Parameter
CertId [in] Holds the identifier of the certificate.
CertElementId [in] Holds the identifier of the certificate element.
Count [out] Total number of iterable certificate elements.
Return code
Std_ReturnType E_OK Element found and number of element items provided.
E_NOT_OK Element data not found.
KEYM_E_PARAMETER_MISMATCH Certificate ID or certificate element ID
invalid.
KEYM_E_KEY_CERT_SIZE_MISMATCH Provided buffer for the certificate
element too small.
KEYM_E_KEY_CERT_EMPTY No certificate data available, the certificate slot
is empty.
KEYM_E_KEY_CERT_INVALID Certificate is not valid or not verified
successfully.
Functional Description
Provides the amount of iterable elements.
-
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-33 KeyM_CertificateElementGetCount
4.2.8.16 KeyM_InitCSR
Prototype
Std_ReturnType KeyM_InitCSR (const uint8 *CertNamePtr, uint32 CertNameLength,
const KeyM_CSRInfoType *CsrInfo, uint8 numOfReqObjects, uint8 *ResponseData,
uint32 *ResponseDataLength)
Parameter
CertNamePtr [in] Points to an array that defines the name of the certificate.
CertNameLength [in] Specifies the number of bytes in CertNamePtr.
CsrInfo [in] Points to an array of request data objects.
numOfReqObjects [in] Total number of available request objects.
ResponseData [out] Data returned by the function.
ResponseDataLength In: Max number of bytes available in ResponseData. Out: Actual number.
[in,out]
Return code
Std_ReturnType E_OK CertificationRequestInfo data structure was generated successfully.
E_NOT_OK Due to internal error, the CertificationRequestInfo data structure
could not be generated.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Initializes request data for certificate signing request.
-
Particularities and Limitations
CsrInfo must reference at least numOfReqObject many elements.
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-34 KeyM_InitCSR
4.2.8.17 KeyM_ServiceCertificateById
Prototype
Std_ReturnType KeyM_ServiceCertificateById (KeyM_ServiceCertificateType
Service, KeyM_CertificateIdType CertId, const uint8 *RequestData, uint32
RequestDataLength, uint8 *ResponseData, uint32 ResponseDataLength)
Parameter
Service [in] Provides the type of service the key manager has to perform.
CertId [in] Holds the identifier of the certificate.
RequestData [in] Information that comes along with the request.
Note
The KeyM provides an API with the suffix
• RteAdpt in KeyM_ServiceCertificateByIdRteAdpt
This API is used only by RTE/SWCs. This API function wraps the existing API function
KeyM_ServiceCertificateById and does not add functionality.
4.2.8.18 KeyM_SetCertificateInGroup
Prototype
Std_ReturnType KeyM_SetCertificateInGroup (KeyM_CertificateGroupIdType GroupId,
const uint8 *RequestData, uint32 RequestDataLength, KeyM_CertificateIdType
*CertId)
Parameter
GroupId [in] Holds the identifier of the certificate group.
RequestData [in] Pointer to the certificate data.
RequestDataLength [in] Holds the length of the certificate data.
CertId [out] Holds the certificate identifier of the slot where data has been installed.
Return code
Std_ReturnType E_OK Certificate accepted.
E_NOT_OK Certificate could not be set.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
KEYM_E_BUSY Service cannot be performed yet. KeyM is currently busy with
other jobs.
KEYM_E_KEY_CERT_EMPTY Certificate slot is empty.
KEYM_E_CERT_INVALID_CHAIN_OF_TRUST Invalid chain of trust.
Functional Description
Set group certificate.
This function sets certificate data in a certicate group.
Particularities and Limitations
This function call can trigger a callback notification if an optional service certificate callback
<KeyM_ServiceCertificateCallbackNotification> is configured for the corresponding dynamic certificate slot.
The parsing of a certificate and the verifying of certificate elements is performed synchronously within this
function.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-36 KeyM_SetCertificateInGroup
4.2.8.19 KeyM_GetGroupCertId
Prototype
Std_ReturnType KeyM_GetGroupCertId (KeyM_CertificateGroupIdType GroupId, const
uint8 *SubjectCommonNameData, uint32 SubjectCommonNameDataLength,
KeyM_CertificateIdType *CertId)
Parameter
GroupId [in] Holds the identifier of the certificate group.
SubjectCommonNameData [in] Pointer to the subject common name data.
SubjectCommonNameDataLength Holds the length of the subject common name data.
[in]
CertId [out] Holds the certificate identifier of the slot where data has been installed.
Return code
Std_ReturnType E_OK Certificate identifier was successfully retrieved.
E_NOT_OK Referenced subject common name was not found within
the group.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
Functional Description
Get certificate identifier for previously set group certificates.
-
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-37 KeyM_GetGroupCertId
4.2.8.20 KeyM_VerifyGroup
Prototype
Std_ReturnType KeyM_VerifyGroup (KeyM_CertificateGroupIdType GroupId)
Parameter
GroupId [in] Holds the identifier of the certificate group.
Return code
Std_ReturnType E_OK The verification of the certificate group was triggered successfully.
E_NOT_OK Certificate data is unavailable and no verification could be
triggered.
Functional Description
Verify previously set group certificates.
-
Particularities and Limitations
-
Call context
> TASK
> This function is Non-Reentrant
Table 4-38 KeyM_VerifyGroup
4.2.8.21 KeyM_SetCRE
Prototype
Std_ReturnType KeyM_SetCRE (const uint8 *IssuerNameData, uint16
IssuerNameDataLength, const uint8 *SerialNumberData, uint16
SerialNumberDataLength)
Parameter
IssuerNameData [in] Points to an array that defines the issuer common name of the revoked
certificate.
IssuerNameDataLength [in] Length of issuer common name data.
SerialNumberData [in] Points to an array that defines the serial number of the revoked certificate.
SerialNumberDataLength Length of serial number data.
[in]
Return code
Std_ReturnType E_OK Certificate revocation entry was appended successfully.
E_NOT_OK Due to internal error, the certificate revocation entry could not be
appended.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Set a certificate revocation entry.
Particularities and Limitations
Configuration Variant(s): KEYM_CRE == STD_ON
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-39 KeyM_SetCRE
4.2.8.22 KeyM_CertStructureGet
Prototype
Std_ReturnType KeyM_CertStructureGet (KeyM_CertificateIdType CertId,
KeyM_CertificateStructureType CertStructure, uint8 *CertStructureData, uint32
*CertStructureDataLength)
Parameter
CertId [in] Holds the identifier of the certificate.
4.2.8.23 KeyM_GetIssuerCertId
Prototype
Std_ReturnType KeyM_GetIssuerCertId (KeyM_CertificateIdType CertId,
KeyM_CertificateIdType *IssuerCertId)
Parameter
CertId [in] Holds the certificate identifier.
IssuerCertId [out] Holds the certificate identifier of the issuer this function returns.
Return code
Std_ReturnType E_OK Issuer's certicate identifier was retrieved successfully.
E_NOT_OK Due to internal error, the issuer's certificate identifier could not be
retrieved.
Functional Description
Get certificate identifier of issuer in upper hierarchy.
-
4.2.8.24 KeyM_GetCertHash
Prototype
Std_ReturnType KeyM_GetCertHash (KeyM_CertificateIdType CertId, uint8
*HashData, uint32 *HashDataLength)
Parameter
CertId [in] Holds the identifier of the certificate.
HashData [out] Pointer to a valid buffer which will hold the data returned by the function.
HashDataLength [in,out] In: Max number of bytes available in HashData.
Out: Actual number.
Return code
Std_ReturnType E_OK Certificate hash was retrieved successfully.
E_NOT_OK Due to internal error, the certificate hash could not be retrieved.
KEYM_E_BUSY Service cannot be performed yet. Certificate is locked by
another service request.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
KEYM_E_PARAMETER_MISMATCH Parameter size doesn't match.
KEYM_E_KEY_CERT_INVALID Certificate is not valid.
KEYM_E_KEY_CERT_EMPTY Certificate slot is empty.
Functional Description
Retrieve precomputed hash over certificate data.
-
Particularities and Limitations
The current implementation does not support a certificate locking mechanism. Therefore the
return code KEYM_E_BUSY is added only for future compliance. If a certificate update fails
and the persisted certificate data is re-loaded, the hash needs to be computed again. It is possible
that this function returns the hash of the invalid, updated certificate data if the hash computation
has not finished yet. To ensure the validity of the hash, check the status of the updated
certificate in advance. If after an update, the status is KEYM_CERTIFICATE_VALID, the hash retrieved
by this function is valid.
-
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-42 KeyM_GetCertHash
4.2.8.25 KeyM_CsrElementSet
Prototype
Std_ReturnType KeyM_CsrElementSet (KeyM_CertificateIdType CertId,
KeyM_CertElementIdType CertElementId, KeyM_CsrEncodingType EncodingType, const
uint8 *ElementData, uint32 ElementDataLength)
Parameter
CertId [in] Holds the identifier of the certificate.
ElementId [in] Holds the identifier of the certificate element.
EncodingType [in] Holds the encoding type of the certificate element.
ElementData [in] Points to an array of element data.
ElementDataLength [in] Max number of bytes available in ElementData.
Return code
Std_ReturnType E_OK CSR element was set successfully.
E_NOT_OK Due to internal error, the CSR element could not be set.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Set certificate signing request element data.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-43 KeyM_CsrElementSet
4.2.8.26 KeyM_DispatchRemoteJob
Prototype
Std_ReturnType KeyM_DispatchRemoteJob (const Crypto_JobType *job)
Parameter
job [in] Pointer to the configuration of the job which is owned by the API user.
Contains structures with job and primitive relevant information but also
pointers to result buffers.
Return code
Std_ReturnType E_OK Remote service request was dispatched and processed successfully.
E_NOT_OK Due to an internal error, the remote service request could not be
dispatched or processed.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
KEYM_E_BUSY Service cannot be performed yet. KeyM is currently busy with
other jobs.
KEYM_E_KEY_CERT_EMPTY Certificate slot is empty.
KEYM_E_CERT_INVALID_CHAIN_OF_TRUST Invalid chain of trust.
Functional Description
Dispatches remote Crypto job to KeyM service.
The dispatching functionality shall be only used by a custom Crypto driver on remote side to enable remote
service handling.
Particularities and Limitations
job->jobPrimitiveInputOutput->{input | secondaryInput | tertiaryInput | output}Ptr must be non-NULL, valid
pointers and their respective length fields must be valid.
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-44 KeyM_DispatchRemoteJob
4.2.8.27 KeyM_DispatchRemoteKeyElementSet
Prototype
Std_ReturnType KeyM_DispatchRemoteKeyElementSet (uint32 cryptoKeyId, uint32
keyElementId, const uint8 *keyPtr, uint32 keyLength)
Parameter
cryptoKeyId [in] Holds the identifier of the key whose key element shall be set.
keyElementId [in] Holds the identifier of the key element which shall be set.
keyPtr [in] Holds the pointer to the user-owned key data which shall be set as key
element.
keyLength [in] Contains the length of the key element in bytes.
Return code
Std_ReturnType E_OK Remote service request was dispatched and processed successfully.
E_NOT_OK Due to an internal error, the remote service request could not be
dispatched or processed.
KEYM_E_PARAMETER_MISMATCH Parameter does not match with
expected value.
KEYM_E_KEY_CERT_SIZE_MISMATCH Parameter size doesn't match.
Functional Description
Dispatches remote set key element request to KeyM service.
The dispatching functionality shall be only used by a custom Crypto driver on remote side to enable remote
service handling.
Particularities and Limitations
The length of the buffer passed as keyPtr must be at least keyLength bytes.
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-45 KeyM_DispatchRemoteKeyElementSet
4.2.8.28 KeyM_DispatchRemoteKeyElementGet
Prototype
Std_ReturnType KeyM_DispatchRemoteKeyElementGet (uint32 cryptoKeyId, uint32
keyElementId, uint8 *keyPtr, uint32 *keyLengthPtr)
Parameter
cryptoKeyId [in] Holds the identifier of the key whose key element shall be set.
keyElementId [in] Holds the identifier of the key element which shall be set.
keyPtr [out] Holds the pointer to the user-owned memory location where the key shall be
copied to.
keyLengthPtr [in,out] Holds a pointer to the memory location in which the output buffer length in
bytes is stored. On calling this function, this parameter shall contain the buffer
length in bytes of the keyPtr. When the request has finished, the actual size of
the written input bytes shall be stored.
Return code
Std_ReturnType E_OK Remote service request was dispatched and processed successfully.
E_NOT_OK Due to an internal error, the remote service request could not be
dispatched or processed.
KEYM_E_PARAMETER_MISMATCH Certificate ID invalid.
KEYM_E_KEY_CERT_SIZE_MISMATCH Provided buffer for the certificate too
small.
KEYM_E_KEY_CERT_EMPTY No certificate data available, the certificate slot
is empty.
KEYM_E_KEY_CERT_READ_FAIL Certificate cannot be provided, access
denied.
Functional Description
Dispatches remote get key element request to KeyM service.
The dispatching functionality shall be only used by a custom Crypto driver on remote side to enable remote
service handling.
Particularities and Limitations
The length of the buffer passed as keyPtr must be at least *keyLengthPtr bytes.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-46 KeyM_DispatchRemoteKeyElementGet
4.2.8.29 KeyM_CertElementGetByStructureType
Prototype
Std_ReturnType KeyM_CertElementGetByStructureType (const uint8 *CertData,
uint32 CertDataLength, KeyM_CertificateStructureType CertStructure, uint8
*CertElementData, uint32 *CertElementDataLength)
Parameter
CertData [in] Pointer to the certificate data.
CertDataLength [in] Holds the length of the certificate data.
CertStructure [in] Holds the certificate structure type.
CertElementData [out] Pointer to a valid buffer which will hold the data returned by the function.
CertElementDataLength In: Max number of bytes available in CertElementData. Out: Actual number.
[in,out]
Return code
Std_ReturnType E_OK Element found and data provided in the buffer.
E_NOT_OK Element data not found.
KEYM_E_PARAMETER_MISMATCH Certificate structure type is invalid.
KEYM_E_KEY_CERT_SIZE_MISMATCH Provided buffer for the certificate
element too small.
KEYM_E_KEY_CERT_EMPTY No certificate data available.
Functional Description
Provide certificate element by certificate structure type.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
In order to ensure proper verification, the time reference provided by StbM using the service
StbM_GetCurrentTime must be trusted.
4.4.1 KeyM_CallbackNotificationSignature
Prototype
void KeyM_CallbackNotificationSignature (Crypto_JobType *job, Std_ReturnType
result)
Parameter
job [in] Contains the CSM job.
result [in] Contains the result of the cryptographic operation.
Return code
void none
Functional Description
Callback Notification for finished signature verify CSM job.
Notifies the KeyM that the signature verify job has finished. This function is used by the CSM.
4.4.2 KeyM_NvBlock_ReadFrom_KeyMCertificate_<NvBlock>
Prototype
Std_ReturnType KeyM_NvBlock_ReadFrom_KeyMCertificate_<NvBlock> (const void
*NvMBuffer)
Parameter
NvMBuffer [in] RAM mirror where Ram block data can be read from.
Return code
E_OK Data was copied from buffer.
E_NOT_OK Data was not copied.
Functional Description
Read from Block callback routine.
Block specific callback routine which is called by NvM in order to let the KeyM copy data from NvM RAM
mirror to RAM block.
Particularities and Limitations
certIdx needs to be valid.
NvM storage needs to be preconfigured for referenced certificate.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-50 KeyM_NvBlock_ReadFrom_KeyMCertificate_<NvBlock>
4.4.3 KeyM_NvBlock_WriteTo_KeyMCertificate_<NvBlock>
Prototype
Std_ReturnType KeyM_NvBlock_ WriteToBlock_KeyMCertificate_<NvBlock> (const void
*NvMBuffer)
Parameter
NvMBuffer [in] RAM mirror where Ram block data can be read from.
Return code
E_OK Data was copied from buffer.
E_NOT_OK Data was not copied.
Functional Description
Write to Block callback routine.
Block specific callback routine which is called by NvM in order to let the KeyM copy data from RAM block to
NvM RAM mirror.
Particularities and Limitations
certIdx needs to be valid.
NvM storage needs to be preconfigured for referenced certificate.
The buffer referenced by NvMBuffer must provide at least
KeyM_GetLengthOfNvmBlock(KeyM_GetNvmBlockIdxOfCertificate(certIdx)) byte.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-51 KeyM_NvBlock_WriteToBlock_KeyMCertificate_<NvBlock>
4.4.4 KeyM_NvBlock_Init_KeyMCertificate_<NvBlock>
Prototype
Std_ReturnType KeyM_NvBlock_Init_KeyMCertificate_<NvBlock>(void)
Parameter
void none
Return code
E_OK Data initialized.
E_NOT_OK Any error occurred.
Functional Description
Init Block callback routine.
Block specific callback routine which is called by NvM in order to let the KeyM copy default data to a RAM
block.
Particularities and Limitations
certIdx needs to be valid.
NvM storage needs to be preconfigured for referenced certificate.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-52 KeyM_NvBlock_Init_KeyMCertificate_<NvBlock>
4.4.5 KeyM_NvBlock_Callback_KeyMCertificate_<NvBlock>
Prototype
Std_ReturnType KeyM_NvBlock_Callback_KeyMCertificate_<NvBlock> (const void
*NvMBuffer)
Parameter
NvM_ServiceIdType [in] The service identifier of the completed request.
JobResult[in] Result of the single block job.
Return code
E_OK Callback function has been processed successfully.
E_NOT_OK Callback function has not been processed successfully.
Functional Description
Request finished Block callback routine.
Block specific callback routine which is called by NvM in order to notify the KeyM that an asynchronous
single block request has been finished.
Particularities and Limitations
certIdx needs to be valid.
NvM storage needs to be preconfigured for referenced certificate.
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-53 KeyM_NvBlock_Callback_KeyMCertificate_<NvBlock>
4.4.6 KeyM_NvBlock_ReadFrom_CRE
Prototype
Std_ReturnType KeyM_NvBlock_ReadFrom_CRE (const void *NvMBuffer)
Parameter
NvMBuffer [in] RAM mirror where Ram block data can be read from.
Return code
E_OK Data was copied from buffer.
E_NOT_OK Data was not copied.
Functional Description
Block specific callback routine which is called by NvM in order to let the KeyM copy data from NvM RAM
mirror to KeyM RAM block.
4.4.7 KeyM_NvBlock_WriteTo_CRE
Prototype
Std_ReturnType KeyM_NvBlock_WriteTo_CRE (const void *NvMBuffer)
Parameter
NvMBuffer [in] RAM mirror where Ram block data shall be written to.
Return code
E_OK Data was copied to buffer.
E_NOT_OK Data was not copied.
Functional Description
Block specific callback routine which is called by NvM in order to let the KeyM copy data from RAM block to
NvM RAM mirror.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-55 KeyM_NvBlock_WriteTo_CRE
4.4.8 KeyM_NvBlock_Init_CRE
Prototype
Std_ReturnType KeyM_NvBlock_Init_CRE (void)
Parameter
void none
Return code
E_OK Data initialized.
E_NOT_OK Any error occurred.
Functional Description
Block specific callback routine which is called by NvM in order to let the KeyM copy default data to a RAM
block.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-56 KeyM_NvBlock_Init_CRE
4.4.9 KeyM_NvBlock_Callback_CRE
Prototype
Std_ReturnType KeyM_NvBlock_Callback_CRE (const void
*NvMBuffer)
Parameter
ServiceIdType [in] The service identifier of the completed request.
JobResult[in] Result of the single block job.
Return code
E_OK Callback function has been processed successfully.
E_NOT_OK Callback function has not been processed successfully.
Functional Description
Block specific callback routine which is called by NvM in order to notify the KeyM that an asynchronous
single block request has been finished.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Non-Reentrant
Table 4-57 KeyM_NvBlock_Callback_CRE
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-58 Appl_VerifyCallbackFunc
4.5.1.2 Appl_ServiceCallbackFunc
Prototype
void <Appl_ServiceCallbackFunc> (KeyM_CertificateIdType CertId, KeyM_ResultType
Result, uint16 ResultDataLength, uint8 *ResultDataPtr)
Parameter
CertId [in] Certificate identifier.
Result [in] Contains information about the result of the operation.
ResultDataLength [in] Contains the length of the resulting data of this operation if any.
ResultDataPtr [in] Pointer to the data of the result. Is only guaranteed to be valid if
ResultDataLength > 0.
Return code
void none
Functional Description
Indicate the end of a service operation.
Notifies the application that the certificate service operation has been finished. This function is used by the
certificate submodule. This callback is only provided if KeyMServiceCertificateFunctionEnabled is set to
TRUE. The function name is configurable by KeyMServiceCertificateCallbackNotificationFunc.
Particularities and Limitations
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-59 Appl_ServiceCallbackFunc
4.5.1.3 Appl_VerifyGroupCallbackFunc
Prototype
Std_ReturnType <Appl_VerifyGroupCallbackFunc> (KeyM_CertificateGroupIdType
GroupId, KeyM_CertificateGroupStatusType Result)
Parameter
GroupId [in] Holds the certificate group identifier.
Result [in] Contains information about the result of the operation.
Return code
Std_ReturnType E_OK: Operation successful.
E_NOT_OK: Operation failed.
Functional Description
Indicate result of the certificate group verification operation.
Notifies the application that a certificate group verification has been finished. The function name is
configurable by KeyMCertificateGroupVerifyCallbackNotificationFunc.
Particularities and Limitations
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-60 Appl_VerifyGroupCallbackFunc
4.5.2.1 Appl_CertificateElementVerificationCallout
Prototype
Std_ReturnType <Appl_CertificateElementVerificationCallout>
(KeyM_CertificateIdType CertId, KeyM_CertElementIdType CertElementId, const
uint8 *CertElementData, uint32 CertElementDataLength)
Parameter
CertId [in] Certificate identifier.
CertElementId [in] Certificate element identifier.
CertElementData [in] Pointer to certificate element data.
CertElementDataLength Length of certificate element data.
[in]
Return code
Std_ReturnType E_OK: Operation successful
E_NOT_OK: Operation failed
Functional Description
Verify certificate elements.
Callout to verify that a given certificate fulfills the specified rules and conditions
Particularities and Limitations
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-61 Appl_CertificateElementVerificationCallout
4.5.2.2 Appl_SetKeyCallout
Prototype
Std_ReturnType <Appl_SetKeyCallout> (KeyM_CertificateIdType CertId,
KeyM_CertElementIdType CertElementId, uint32 csmKeyId, const uint8
*CertElementData, uint32 CertElementDataLength)
Parameter
CertId [in] Certificate identifier.
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-62 Appl_SetKeyCallout
4.5.2.3 Appl_CertInitCallout
Prototype
void <Appl_CertInitCallout> (KeyM_CertificateIdType CertId,
KeyM_ConstCertDataType *CertificateDataPtr)
Parameter
CertId [in] Certificate identifier.
CertificateDataPtr [in,out] Provides a pointer to a certificate data structure. The buffer located by the
pointer in the structure shall be provided by the caller of this function. The
length information indicates the maximum length of the buffer when the
function is called. When the function returns, the length information indicates
the actual length of the certificate data in the buffer.
Return code
void none
Functional Description
Provide the certificate data during initialization.
Particularities and Limitations
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
4.5.2.4 Appl_GetCurrentTimeCalloutFunc
Prototype
Std_ReturnType <Appl_GetCurrentTimeCalloutFunc> (KeyM_CertificateIdType CertId,
uint64 *timeStamp)
Parameter
CertId [in] Certificate identifier.
timeStamp [out] Current time in Unix time format.
Return code
Std_ReturnType E_OK Operation successful.
E_NOT_OK Operation failed.
KEYM_E_NO_PERIOD_VALIDITY_CHECK Skip time stamp validation.
Functional Description
Provide current time to verify certificate time stamp.
Particularities and Limitations
-
Call context
> TASK
> This function is Synchronous
> This function is Reentrant
Table 4-64 Appl_GetCurrentTimeCalloutFunc
5 Configuration
In the KeyM the attributes can be configured according to/ with the following methods/ tools:
> Configuration in DaVinci Configurator 5 Pro
Caution
The object type (KeyMCertificateElementObjectType) of a certificate element
needs to be configured. Please note that only the types listed in chapter 3.3.6 are
currently supported.
Caution
The structure type (KeyMCertificateElementOfStructure) of a certificate
element needs to be configured according to the contained element types depending
on the used certificate format. For more details, please refer to the standards of X.509,
CRL [5] and CVC [10].
Caution
If a certificate element is contained in a structure with a given object identifier, this OID
needs to be configured in KeyMCertificateElementObjectId.
5.4 FAQ
• Verification error is caused if the CSM jobs for the signature verification and the
corresponding CSM keys for the public keys are not configured correctly. Please refer
to 3.3.2.
• Verification error is caused if the configured upper hierarchical reference for a
certificate (KeyMCertUpperHierarchicalCertRef) does not correspond to the
actual issuer of the certificate.
• Verification error is caused if no separate CSM jobs and CSM keys are used for each
individual certificate.
• Verification error is caused if the parsed validity period in the certificate data is not
valid.
• Verification error is caused if the CSM operation for setting the public key or verifying
the certificate signature fails due to internal error.
6.1 Glossary
Term Description
BswM BSW Mode Manager
CSM Cryptographic Service Manager
NvM NVRAM Manager
SchM BSW Scheduler Module
StbM Synchronized Time-Base Manager
Table 6-1 Glossary
6.2 Abbreviations
Abbreviation Description
API Application Programming Interface
ASN Abstract Syntax Notation
AUTOSAR Automotive Open System Architecture
BSW Basis Software
CA Certificate Authority
CRE Certificate Revocation Entry
CRL Certificate Revocation List
CSR Certificate Signing Request
DER Distinguished Encoding Rules
DET Development Error Tracer
ECC Elliptic Curve Cryptography
ECU Electronic Control Unit
HSM Hardware security module
OCSP Online Certificate Status Protocol
PKI Public Key Infrastructure
SRS Software Requirement Specification
SWC Software Component
SWS Software Specification
Table 6-2 Abbreviations
7 Contact
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector.com