1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * LICENSE-2.0" target="_blank">http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 ******************************************************************/
30 #include "byte_array.h"
31 #include "pki_errors.h"
33 /// Maximal number of revoked certificates in list
35 #define CRL_MAX_LEN (256)
37 #define CRL_MAX_LEN (1024)
38 #endif // WITH_ARDUINO
40 * @struct CertificateList
44 * Structure fields contain byte arrays pointed to relative DER certificate positions.
48 ByteArray tbs; /**< TBS sequence of CRL.*/
49 ByteArray issuer; /**< Issuer name.*/
50 ByteArray date; /**< The issue-date for CRL.*/
51 ByteArray signR; /**< Signature r value.*/
52 ByteArray signS; /**< Signature s value.*/
55 /**@def CRL_INITIALIZER
57 * Initializes of existing CRL fields to {NULL, 0}.
59 #undef CRL_INITIALIZER
60 #define CRL_INITIALIZER {BYTE_ARRAY_INITIALIZER,\
61 BYTE_ARRAY_INITIALIZER,\
62 BYTE_ARRAY_INITIALIZER,\
63 BYTE_ARRAY_INITIALIZER,\
64 BYTE_ARRAY_INITIALIZER}
68 * Prints Certificate List to console.
70 * @param crl - pointer to certificate list structure
71 * @return PKI_SUCCESS if success, error code otherwise
73 PKIError PrintCRL(const CertificateList *const crl);
77 * Decodes and checks Certificate List.
79 * @param code - certificate list structure in DER format
80 * @param crl - pointer to certificate list structure
81 * @param caPubKey - ByteArray structure contains CA public key
82 * @return PKI_SUCCESS if success, error code otherwise
84 PKIError DecodeCertificateList(ByteArray code, CertificateList *crl, ByteArray caPubKey);