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 ******************************************************************/
23 #ifndef INCLUDE_ISSUER_ISSUER_H_
24 #define INCLUDE_ISSUER_ISSUER_H_
26 #include "Certificate.h" // Certificate ASN.1 type
28 #include "pki_errors.h"
39 * Encodes X.509 certificate with specified parameters.
41 * @param[in] subjectName pointer to serial subject's common name
42 * @param[in] issuerName pointer to issuer's common name
43 * @param[in] notBefore pointer to certificate validity limit
44 * @param[in] notAfter pointer to certificate validity limit
45 * @param[in] subjectPublicKey pointer to subject's public key to be signed
46 * @param[in] issuerPrivateKey pointer to issuer's private key to sign certificate
47 * @param[out] encodedCertificate pointer to allocated memory for DER encoded certificate
48 * (ISSUER_MAX_CERT_SIZE bytes should be allocated)
49 * @return PKI_SUCCESS if success, error code otherwise
51 PKIError GenerateCertificate (const UTF8String_t *subjectName, const UTF8String_t *issuerName,
52 const UTCTime_t *notBefore, const UTCTime_t *notAfter,
53 const BIT_STRING_t *subjectPublicKey, const BIT_STRING_t *issuerPrivateKey,
54 ByteArray *encodedCertificate);
60 #endif /* INCLUDE_ISSUER_ISSUER_H_ */