2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file vcore_api_extension.h
18 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
20 * @brief This is C api for ValidationCore.
22 #ifndef _CERTSVC_C_API_EXTENDED_H_
23 #define _CERTSVC_C_API_EXTENDED_H_
25 #include <openssl/evp.h>
26 #include <openssl/x509.h>
28 #include <cert-svc/ccert.h>
29 #include <cert-svc/cstring.h>
36 * This will return pointer to X509 base openssl struct. This struct must be release by function
37 * certsvc_certificate_free_x509.
39 * vcore_instance_free or vcore_instance_reset will not free memory allocated by this function!
41 * @param[in] certificate Pointer to certificate.
42 * @param[out] cert Duplicate of certificate.
43 * @return CERTSVC_SUCCESS, CERTSVC_WRONG_ARGUMENT, CERTSVC_FAIL
45 int certsvc_certificate_dup_x509(CertSvcCertificate certificate, X509** cert);
48 * Release X509 struct allocated by certsvc_certificate_new_x509_copy function.
50 * @param[in] x509_copy Pointer to openssl struct.
52 void certsvc_certificate_free_x509(X509 *x509_copy);
55 * This will return pointer to EVP_PKEY base openssl struct. This struct must
56 * be release with function certsvc_pkcs12_free_evp_pkey
59 * @param[in] storeType Refers to VPN_STORE / WIFI_STORE / EMAIL_STORE / SYSTEM_STORE / ALL_STORE.
60 * @param[in] gname Pkcs12 identificator.
61 * @param[out] pkey Duplicate of private key.
62 * @return CERTSVC_SUCCESS, CERT_FAIL
65 int certsvc_pkcs12_dup_evp_pkey_from_store(CertSvcInstance instance,
66 CertStoreType storeType,
70 void certsvc_pkcs12_free_evp_pkey(EVP_PKEY* pkey);