xref: /titanic_51/usr/src/lib/libkmf/include/kmfapi.h (revision 02744e811b15322c5f109827a116c33bfe3438b5)
199ebb4caSwyllys /*
299ebb4caSwyllys  * CDDL HEADER START
399ebb4caSwyllys  *
499ebb4caSwyllys  * The contents of this file are subject to the terms of the
599ebb4caSwyllys  * Common Development and Distribution License (the "License").
699ebb4caSwyllys  * You may not use this file except in compliance with the License.
799ebb4caSwyllys  *
899ebb4caSwyllys  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
999ebb4caSwyllys  * or http://www.opensolaris.org/os/licensing.
1099ebb4caSwyllys  * See the License for the specific language governing permissions
1199ebb4caSwyllys  * and limitations under the License.
1299ebb4caSwyllys  *
1399ebb4caSwyllys  * When distributing Covered Code, include this CDDL HEADER in each
1499ebb4caSwyllys  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1599ebb4caSwyllys  * If applicable, add the following below this CDDL HEADER, with the
1699ebb4caSwyllys  * fields enclosed by brackets "[]" replaced with your own identifying
1799ebb4caSwyllys  * information: Portions Copyright [yyyy] [name of copyright owner]
1899ebb4caSwyllys  *
1999ebb4caSwyllys  * CDDL HEADER END
2099ebb4caSwyllys  */
2199ebb4caSwyllys /*
2271593db2Swyllys  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2399ebb4caSwyllys  * Use is subject to license terms.
2499ebb4caSwyllys  *
2599ebb4caSwyllys  *
2699ebb4caSwyllys  * Constant definitions and function prototypes for the KMF library.
2799ebb4caSwyllys  * Commonly used data types are defined in "kmftypes.h".
2899ebb4caSwyllys  */
2999ebb4caSwyllys 
3099ebb4caSwyllys #ifndef _KMFAPI_H
3199ebb4caSwyllys #define	_KMFAPI_H
3299ebb4caSwyllys 
3399ebb4caSwyllys #pragma ident	"%Z%%M%	%I%	%E% SMI"
3499ebb4caSwyllys 
3599ebb4caSwyllys #include <kmftypes.h>
3699ebb4caSwyllys #include <security/cryptoki.h>
3799ebb4caSwyllys 
3899ebb4caSwyllys #ifdef __cplusplus
3999ebb4caSwyllys extern "C" {
4099ebb4caSwyllys #endif
4199ebb4caSwyllys 
4299ebb4caSwyllys /*
4399ebb4caSwyllys  * Setup operations.
4499ebb4caSwyllys  */
4599ebb4caSwyllys extern KMF_RETURN KMF_Initialize(KMF_HANDLE_T *, char *, char *);
4699ebb4caSwyllys extern KMF_RETURN KMF_ConfigureKeystore(KMF_HANDLE_T, KMF_CONFIG_PARAMS *);
4799ebb4caSwyllys extern KMF_RETURN KMF_Finalize(KMF_HANDLE_T);
4899ebb4caSwyllys 
4999ebb4caSwyllys /*
5099ebb4caSwyllys  * Key operations.
5199ebb4caSwyllys  */
5299ebb4caSwyllys extern KMF_RETURN KMF_SignDataWithKey(KMF_HANDLE_T,
5399ebb4caSwyllys 	KMF_KEY_HANDLE *, KMF_OID *,
5499ebb4caSwyllys 	KMF_DATA *, KMF_DATA *);
5599ebb4caSwyllys 
5699ebb4caSwyllys extern KMF_RETURN KMF_VerifyDataWithKey(KMF_HANDLE_T,
5799ebb4caSwyllys 	KMF_KEY_HANDLE *, KMF_ALGORITHM_INDEX, KMF_DATA *, KMF_DATA *);
5899ebb4caSwyllys 
5999ebb4caSwyllys extern KMF_RETURN KMF_CreateKeypair(KMF_HANDLE_T,
6099ebb4caSwyllys 	KMF_CREATEKEYPAIR_PARAMS *, KMF_KEY_HANDLE *, KMF_KEY_HANDLE *);
6199ebb4caSwyllys 
6299ebb4caSwyllys extern KMF_RETURN KMF_DeleteKeyFromKeystore(KMF_HANDLE_T,
6399ebb4caSwyllys 	KMF_DELETEKEY_PARAMS *, KMF_KEY_HANDLE *);
6499ebb4caSwyllys 
6599ebb4caSwyllys extern KMF_RETURN KMF_SignCertRecord(KMF_HANDLE_T, KMF_KEY_HANDLE *,
6699ebb4caSwyllys 	KMF_X509_CERTIFICATE *, KMF_DATA *);
6799ebb4caSwyllys 
6899ebb4caSwyllys extern KMF_RETURN KMF_FindKey(KMF_HANDLE_T, KMF_FINDKEY_PARAMS *,
6999ebb4caSwyllys 	KMF_KEY_HANDLE *, uint32_t *);
7099ebb4caSwyllys 
7199ebb4caSwyllys extern KMF_RETURN KMF_StorePrivateKey(KMF_HANDLE_T, KMF_STOREKEY_PARAMS *,
7299ebb4caSwyllys 	KMF_RAW_KEY_DATA *);
7399ebb4caSwyllys 
7499ebb4caSwyllys extern KMF_RETURN KMF_CreateSymKey(KMF_HANDLE_T, KMF_CREATESYMKEY_PARAMS *,
7599ebb4caSwyllys 	KMF_KEY_HANDLE *);
7699ebb4caSwyllys 
7799ebb4caSwyllys extern KMF_RETURN KMF_GetSymKeyValue(KMF_HANDLE_T, KMF_KEY_HANDLE *,
7899ebb4caSwyllys 	KMF_RAW_SYM_KEY *);
7999ebb4caSwyllys 
8099ebb4caSwyllys /*
8199ebb4caSwyllys  * Certificate operations.
8299ebb4caSwyllys  */
8399ebb4caSwyllys extern KMF_RETURN KMF_FindCert(KMF_HANDLE_T, KMF_FINDCERT_PARAMS *,
8499ebb4caSwyllys 	KMF_X509_DER_CERT *, uint32_t *);
8599ebb4caSwyllys 
8699ebb4caSwyllys extern KMF_RETURN KMF_EncodeCertRecord(KMF_X509_CERTIFICATE *,
8799ebb4caSwyllys 	KMF_DATA *);
88*02744e81Swyllys extern KMF_RETURN KMF_DecodeCertData(KMF_DATA *, KMF_X509_CERTIFICATE **);
89*02744e81Swyllys 
9099ebb4caSwyllys extern KMF_RETURN KMF_SignCertWithKey(KMF_HANDLE_T, const KMF_DATA *,
9199ebb4caSwyllys 	KMF_KEY_HANDLE *, KMF_DATA *);
9299ebb4caSwyllys extern KMF_RETURN KMF_SignCertWithCert(KMF_HANDLE_T,
9399ebb4caSwyllys 	KMF_CRYPTOWITHCERT_PARAMS *,
9499ebb4caSwyllys 	const KMF_DATA *, KMF_DATA *, KMF_DATA *);
9599ebb4caSwyllys 
9699ebb4caSwyllys extern KMF_RETURN KMF_SignDataWithCert(KMF_HANDLE_T,
9799ebb4caSwyllys 	KMF_CRYPTOWITHCERT_PARAMS *, KMF_DATA *, KMF_DATA *, KMF_DATA *);
9899ebb4caSwyllys 
9999ebb4caSwyllys extern KMF_RETURN KMF_VerifyCertWithKey(KMF_HANDLE_T, KMF_KEY_HANDLE *,
10099ebb4caSwyllys 	const KMF_DATA *);
10199ebb4caSwyllys extern KMF_RETURN KMF_VerifyCertWithCert(KMF_HANDLE_T, const KMF_DATA *,
10299ebb4caSwyllys 	const KMF_DATA *);
103*02744e81Swyllys extern KMF_RETURN KMF_VerifyDataWithCert(KMF_HANDLE_T,
104*02744e81Swyllys 	KMF_KEYSTORE_TYPE, KMF_ALGORITHM_INDEX, KMF_DATA *, KMF_DATA *,
10599ebb4caSwyllys 	const KMF_DATA *);
10699ebb4caSwyllys 
10799ebb4caSwyllys extern KMF_RETURN KMF_EncryptWithCert(KMF_HANDLE_T, KMF_DATA *,
10899ebb4caSwyllys 	KMF_DATA *, KMF_DATA *);
10999ebb4caSwyllys 
11099ebb4caSwyllys extern KMF_RETURN KMF_DecryptWithCert(KMF_HANDLE_T,
11199ebb4caSwyllys 	KMF_CRYPTOWITHCERT_PARAMS *, KMF_DATA *, KMF_DATA *, KMF_DATA *);
11299ebb4caSwyllys 
11399ebb4caSwyllys extern KMF_RETURN KMF_StoreCert(KMF_HANDLE_T,
11499ebb4caSwyllys 	KMF_STORECERT_PARAMS *, KMF_DATA *);
11599ebb4caSwyllys extern KMF_RETURN KMF_ImportCert(KMF_HANDLE_T, KMF_IMPORTCERT_PARAMS *);
11699ebb4caSwyllys extern KMF_RETURN KMF_DeleteCertFromKeystore(KMF_HANDLE_T,
11799ebb4caSwyllys 	KMF_DELETECERT_PARAMS *);
11899ebb4caSwyllys 
11999ebb4caSwyllys extern KMF_RETURN KMF_ValidateCert(KMF_HANDLE_T,
12099ebb4caSwyllys 	KMF_VALIDATECERT_PARAMS *, int  *);
12199ebb4caSwyllys 
12299ebb4caSwyllys extern KMF_RETURN KMF_CreateCertFile(KMF_DATA *, KMF_ENCODE_FORMAT, char *);
12399ebb4caSwyllys 
12499ebb4caSwyllys extern KMF_RETURN KMF_DownloadCert(KMF_HANDLE_T, char *, char *, int,
12599ebb4caSwyllys 	unsigned int, char *, KMF_ENCODE_FORMAT *);
12699ebb4caSwyllys extern KMF_RETURN KMF_IsCertFile(KMF_HANDLE_T, char *, KMF_ENCODE_FORMAT *);
12799ebb4caSwyllys 
12899ebb4caSwyllys extern KMF_RETURN KMF_CheckCertDate(KMF_HANDLE_T, KMF_DATA *);
12999ebb4caSwyllys 
13099ebb4caSwyllys /*
13199ebb4caSwyllys  * CRL operations.
13299ebb4caSwyllys  */
13399ebb4caSwyllys extern KMF_RETURN KMF_ImportCRL(KMF_HANDLE_T, KMF_IMPORTCRL_PARAMS *);
13499ebb4caSwyllys extern KMF_RETURN KMF_DeleteCRL(KMF_HANDLE_T, KMF_DELETECRL_PARAMS *);
13599ebb4caSwyllys extern KMF_RETURN KMF_ListCRL(KMF_HANDLE_T, KMF_LISTCRL_PARAMS *, char **);
13699ebb4caSwyllys extern KMF_RETURN KMF_FindCRL(KMF_HANDLE_T, KMF_FINDCRL_PARAMS *,
13799ebb4caSwyllys 	char **, int *);
13899ebb4caSwyllys 
13999ebb4caSwyllys extern KMF_RETURN KMF_FindCertInCRL(KMF_HANDLE_T,
14099ebb4caSwyllys 	KMF_FINDCERTINCRL_PARAMS *);
14199ebb4caSwyllys extern KMF_RETURN KMF_VerifyCRLFile(KMF_HANDLE_T,
14299ebb4caSwyllys 	KMF_VERIFYCRL_PARAMS *);
14399ebb4caSwyllys 
14499ebb4caSwyllys extern KMF_RETURN KMF_CheckCRLDate(KMF_HANDLE_T,
14599ebb4caSwyllys 	KMF_CHECKCRLDATE_PARAMS *);
14699ebb4caSwyllys extern KMF_RETURN KMF_DownloadCRL(KMF_HANDLE_T, char *, char *,
14799ebb4caSwyllys 	int, unsigned int, char *, KMF_ENCODE_FORMAT *);
14899ebb4caSwyllys extern KMF_RETURN KMF_IsCRLFile(KMF_HANDLE_T, char *, KMF_ENCODE_FORMAT *);
14999ebb4caSwyllys 
15099ebb4caSwyllys /*
15199ebb4caSwyllys  * CSR operations.
15299ebb4caSwyllys  */
15399ebb4caSwyllys extern KMF_RETURN KMF_SetCSRPubKey(KMF_HANDLE_T,
15499ebb4caSwyllys 	KMF_KEY_HANDLE *, KMF_CSR_DATA *);
15599ebb4caSwyllys extern KMF_RETURN KMF_SetCSRVersion(KMF_CSR_DATA *, uint32_t);
15699ebb4caSwyllys extern KMF_RETURN KMF_SetCSRSubjectName(KMF_CSR_DATA *, KMF_X509_NAME *);
15799ebb4caSwyllys extern KMF_RETURN KMF_CreateCSRFile(KMF_DATA *, KMF_ENCODE_FORMAT, char *);
15899ebb4caSwyllys extern KMF_RETURN KMF_SetCSRExtension(KMF_CSR_DATA *, KMF_X509_EXTENSION *);
15999ebb4caSwyllys extern KMF_RETURN KMF_SetCSRSignatureAlgorithm(KMF_CSR_DATA *,
16099ebb4caSwyllys 	KMF_ALGORITHM_INDEX);
16199ebb4caSwyllys extern KMF_RETURN KMF_SetCSRSubjectAltName(KMF_CSR_DATA *, char *,
16299ebb4caSwyllys 	int, KMF_GENERALNAMECHOICES);
16399ebb4caSwyllys extern KMF_RETURN KMF_SetCSRKeyUsage(KMF_CSR_DATA *, int, uint16_t);
16499ebb4caSwyllys extern KMF_RETURN KMF_SignCSR(KMF_HANDLE_T, const KMF_CSR_DATA *,
16599ebb4caSwyllys 	KMF_KEY_HANDLE *, KMF_DATA *);
16699ebb4caSwyllys 
16799ebb4caSwyllys /*
16899ebb4caSwyllys  * GetCert operations.
16999ebb4caSwyllys  */
17099ebb4caSwyllys extern KMF_RETURN KMF_GetCertExtensionData(const KMF_DATA *, KMF_OID *,
17199ebb4caSwyllys 	KMF_X509_EXTENSION *);
17299ebb4caSwyllys 
17399ebb4caSwyllys extern KMF_RETURN KMF_GetCertCriticalExtensions(const KMF_DATA *,
17499ebb4caSwyllys 	KMF_X509_EXTENSION **, int *);
17599ebb4caSwyllys 
17699ebb4caSwyllys extern KMF_RETURN KMF_GetCertNonCriticalExtensions(const KMF_DATA *,
17799ebb4caSwyllys 	KMF_X509_EXTENSION **, int *);
17899ebb4caSwyllys 
17999ebb4caSwyllys extern KMF_RETURN KMF_GetCertKeyUsageExt(const KMF_DATA *,
18099ebb4caSwyllys 	KMF_X509EXT_KEY_USAGE *);
18199ebb4caSwyllys 
18299ebb4caSwyllys extern KMF_RETURN KMF_GetCertEKU(const KMF_DATA *, KMF_X509EXT_EKU *);
18399ebb4caSwyllys 
18499ebb4caSwyllys extern KMF_RETURN KMF_GetCertBasicConstraintExt(const KMF_DATA *,
18599ebb4caSwyllys 	KMF_BOOL *, KMF_X509EXT_BASICCONSTRAINTS *);
18699ebb4caSwyllys 
18799ebb4caSwyllys extern KMF_RETURN KMF_GetCertPoliciesExt(const KMF_DATA *,
18899ebb4caSwyllys 	KMF_BOOL *, KMF_X509EXT_CERT_POLICIES *);
18999ebb4caSwyllys 
19099ebb4caSwyllys extern KMF_RETURN KMF_GetCertAuthInfoAccessExt(const KMF_DATA *,
19199ebb4caSwyllys 	KMF_X509EXT_AUTHINFOACCESS *);
19299ebb4caSwyllys 
19399ebb4caSwyllys extern KMF_RETURN KMF_GetCertCRLDistributionPointsExt(const KMF_DATA *,
19499ebb4caSwyllys 	KMF_X509EXT_CRLDISTPOINTS *);
19599ebb4caSwyllys 
19699ebb4caSwyllys extern KMF_RETURN KMF_GetCertVersionString(KMF_HANDLE_T,
19799ebb4caSwyllys 	const KMF_DATA *, char **);
19899ebb4caSwyllys 
19999ebb4caSwyllys extern KMF_RETURN KMF_GetCertSubjectNameString(KMF_HANDLE_T, const KMF_DATA *,
20099ebb4caSwyllys 	char **);
20199ebb4caSwyllys 
20299ebb4caSwyllys extern KMF_RETURN KMF_GetCertIssuerNameString(KMF_HANDLE_T,
20399ebb4caSwyllys 	const KMF_DATA *, char **);
20499ebb4caSwyllys 
20599ebb4caSwyllys extern KMF_RETURN KMF_GetCertSerialNumberString(KMF_HANDLE_T, const KMF_DATA *,
20699ebb4caSwyllys 	char **);
20799ebb4caSwyllys 
20899ebb4caSwyllys extern KMF_RETURN KMF_GetCertStartDateString(KMF_HANDLE_T,
20999ebb4caSwyllys 	const KMF_DATA *, char **);
21099ebb4caSwyllys 
21199ebb4caSwyllys extern KMF_RETURN KMF_GetCertEndDateString(KMF_HANDLE_T,
21299ebb4caSwyllys 	const KMF_DATA *, char **);
21399ebb4caSwyllys 
21499ebb4caSwyllys extern KMF_RETURN KMF_GetCertPubKeyAlgString(KMF_HANDLE_T,
21599ebb4caSwyllys 	const KMF_DATA *, char **);
21699ebb4caSwyllys 
21799ebb4caSwyllys extern KMF_RETURN KMF_GetCertSignatureAlgString(KMF_HANDLE_T,
21899ebb4caSwyllys 	const KMF_DATA *, char **);
21999ebb4caSwyllys 
22099ebb4caSwyllys extern KMF_RETURN KMF_GetCertPubKeyDataString(KMF_HANDLE_T,
22199ebb4caSwyllys 	const KMF_DATA *, char **);
22299ebb4caSwyllys 
22399ebb4caSwyllys extern KMF_RETURN KMF_GetCertEmailString(KMF_HANDLE_T,
22499ebb4caSwyllys 	const KMF_DATA *, char **);
22599ebb4caSwyllys 
22699ebb4caSwyllys extern KMF_RETURN KMF_GetCertExtensionString(KMF_HANDLE_T, const KMF_DATA *,
22799ebb4caSwyllys 	KMF_PRINTABLE_ITEM, char **);
22899ebb4caSwyllys 
22999ebb4caSwyllys extern KMF_RETURN KMF_GetCertIDData(const KMF_DATA *, KMF_DATA *);
23099ebb4caSwyllys extern KMF_RETURN KMF_GetCertIDString(const KMF_DATA *, char **);
23199ebb4caSwyllys extern KMF_RETURN KMF_GetCertValidity(const KMF_DATA *, time_t *, time_t *);
23299ebb4caSwyllys 
23399ebb4caSwyllys /*
23499ebb4caSwyllys  * SetCert operations
23599ebb4caSwyllys  */
23699ebb4caSwyllys extern KMF_RETURN KMF_SetCertPubKey(KMF_HANDLE_T, KMF_KEY_HANDLE *,
23799ebb4caSwyllys 	KMF_X509_CERTIFICATE *);
23899ebb4caSwyllys 
23999ebb4caSwyllys extern KMF_RETURN KMF_SetCertSubjectName(KMF_X509_CERTIFICATE *,
24099ebb4caSwyllys 	KMF_X509_NAME *);
24199ebb4caSwyllys 
24299ebb4caSwyllys extern KMF_RETURN KMF_SetCertKeyUsage(KMF_X509_CERTIFICATE *, int, uint16_t);
24399ebb4caSwyllys 
24499ebb4caSwyllys extern KMF_RETURN KMF_SetCertIssuerName(KMF_X509_CERTIFICATE *,
24599ebb4caSwyllys 	KMF_X509_NAME *);
24699ebb4caSwyllys 
24799ebb4caSwyllys extern KMF_RETURN KMF_SetCertSignatureAlgorithm(KMF_X509_CERTIFICATE *,
24899ebb4caSwyllys 	KMF_ALGORITHM_INDEX);
24999ebb4caSwyllys 
25099ebb4caSwyllys extern KMF_RETURN KMF_SetCertValidityTimes(KMF_X509_CERTIFICATE *,
25199ebb4caSwyllys 	time_t, uint32_t);
25299ebb4caSwyllys 
25399ebb4caSwyllys extern KMF_RETURN KMF_SetCertSerialNumber(KMF_X509_CERTIFICATE *,
25499ebb4caSwyllys 	KMF_BIGINT *);
25599ebb4caSwyllys 
25699ebb4caSwyllys extern KMF_RETURN KMF_SetCertVersion(KMF_X509_CERTIFICATE *, uint32_t);
25799ebb4caSwyllys 
25899ebb4caSwyllys extern KMF_RETURN KMF_SetCertIssuerAltName(KMF_X509_CERTIFICATE *,
25999ebb4caSwyllys 	int, KMF_GENERALNAMECHOICES, char *);
26099ebb4caSwyllys 
26199ebb4caSwyllys extern KMF_RETURN KMF_SetCertSubjectAltName(KMF_X509_CERTIFICATE *,
26299ebb4caSwyllys 	int, KMF_GENERALNAMECHOICES, char *);
26399ebb4caSwyllys 
26499ebb4caSwyllys extern KMF_RETURN KMF_AddCertEKU(KMF_X509_CERTIFICATE *, KMF_OID *, int);
26599ebb4caSwyllys 
26699ebb4caSwyllys extern KMF_RETURN KMF_SetCertExtension(KMF_X509_CERTIFICATE *,
26799ebb4caSwyllys 	KMF_X509_EXTENSION *);
26899ebb4caSwyllys 
26999ebb4caSwyllys extern KMF_RETURN KMF_SetCertBasicConstraintExt(KMF_X509_CERTIFICATE *,
27099ebb4caSwyllys 	KMF_BOOL, KMF_X509EXT_BASICCONSTRAINTS *);
27199ebb4caSwyllys 
27299ebb4caSwyllys extern KMF_RETURN KMF_ExportPK12(KMF_HANDLE_T, KMF_EXPORTP12_PARAMS *, char *);
27399ebb4caSwyllys extern KMF_RETURN KMF_ImportPK12(KMF_HANDLE_T, char *, KMF_CREDENTIAL *,
27499ebb4caSwyllys 	KMF_DATA **, int *, KMF_RAW_KEY_DATA **, int *);
27571593db2Swyllys extern KMF_RETURN KMF_ImportKeypair(KMF_HANDLE_T, char *, KMF_CREDENTIAL *,
27671593db2Swyllys 	KMF_DATA **, int *, KMF_RAW_KEY_DATA **, int *);
27799ebb4caSwyllys 
27899ebb4caSwyllys /*
27999ebb4caSwyllys  * Get OCSP response operation.
28099ebb4caSwyllys  */
28199ebb4caSwyllys extern KMF_RETURN KMF_GetOCSPForCert(KMF_HANDLE_T, KMF_DATA *,	KMF_DATA *,
28299ebb4caSwyllys 	KMF_DATA *);
28399ebb4caSwyllys 
28499ebb4caSwyllys extern KMF_RETURN KMF_CreateOCSPRequest(KMF_HANDLE_T, KMF_OCSPREQUEST_PARAMS *,
28599ebb4caSwyllys 	char *);
28699ebb4caSwyllys 
28799ebb4caSwyllys extern KMF_RETURN KMF_GetEncodedOCSPResponse(KMF_HANDLE_T, char *, char *, int,
28899ebb4caSwyllys 	char *, int, char *, unsigned int);
28999ebb4caSwyllys 
29099ebb4caSwyllys extern KMF_RETURN KMF_GetOCSPStatusForCert(KMF_HANDLE_T,
29199ebb4caSwyllys 	KMF_OCSPRESPONSE_PARAMS_INPUT *,
29299ebb4caSwyllys 	KMF_OCSPRESPONSE_PARAMS_OUTPUT *);
29399ebb4caSwyllys 
29499ebb4caSwyllys /*
29599ebb4caSwyllys  * Policy Operations
29699ebb4caSwyllys  */
29799ebb4caSwyllys extern KMF_RETURN KMF_SetPolicy(KMF_HANDLE_T, char *, char *);
29899ebb4caSwyllys 
29999ebb4caSwyllys /*
30099ebb4caSwyllys  * Error handling.
30199ebb4caSwyllys  */
30299ebb4caSwyllys extern KMF_RETURN KMF_GetPluginErrorString(KMF_HANDLE_T, char **);
30399ebb4caSwyllys extern KMF_RETURN KMF_GetKMFErrorString(KMF_RETURN, char **);
30499ebb4caSwyllys 
30599ebb4caSwyllys /*
30699ebb4caSwyllys  * Miscellaneous
30799ebb4caSwyllys  */
30899ebb4caSwyllys extern KMF_RETURN KMF_DNParser(char *, KMF_X509_NAME *);
30999ebb4caSwyllys extern KMF_RETURN KMF_DN2Der(KMF_X509_NAME *, KMF_DATA *);
31099ebb4caSwyllys extern KMF_RETURN KMF_ReadInputFile(KMF_HANDLE_T, char *, KMF_DATA *);
31199ebb4caSwyllys extern KMF_RETURN KMF_Der2Pem(KMF_OBJECT_TYPE, unsigned char *,
31299ebb4caSwyllys 	int, unsigned char **, int *);
31399ebb4caSwyllys extern KMF_RETURN KMF_Pem2Der(unsigned char *, int, unsigned char **, int *);
31499ebb4caSwyllys extern char *KMF_OID2String(KMF_OID *);
31599ebb4caSwyllys extern KMF_RETURN KMF_String2OID(char *, KMF_OID *);
31699ebb4caSwyllys extern int KMF_CompareRDNs(KMF_X509_NAME *, KMF_X509_NAME *);
31799ebb4caSwyllys extern KMF_RETURN KMF_GetFileFormat(char *, KMF_ENCODE_FORMAT *);
31899ebb4caSwyllys extern uint16_t KMF_StringToKeyUsage(char *);
31999ebb4caSwyllys extern KMF_RETURN KMF_SetTokenPin(KMF_HANDLE_T, KMF_SETPIN_PARAMS *,
32099ebb4caSwyllys 	KMF_CREDENTIAL *);
32199ebb4caSwyllys extern KMF_RETURN KMF_HexString2Bytes(unsigned char *, unsigned char **,
32299ebb4caSwyllys 	size_t *);
32399ebb4caSwyllys 
32499ebb4caSwyllys /*
32599ebb4caSwyllys  * Memory cleanup operations
32699ebb4caSwyllys  */
32799ebb4caSwyllys extern void KMF_FreeDN(KMF_X509_NAME *);
32899ebb4caSwyllys extern void KMF_FreeKMFCert(KMF_HANDLE_T, KMF_X509_DER_CERT *);
32999ebb4caSwyllys extern void KMF_FreeData(KMF_DATA *);
33099ebb4caSwyllys extern void KMF_FreeAlgOID(KMF_X509_ALGORITHM_IDENTIFIER *);
33199ebb4caSwyllys extern void KMF_FreeExtension(KMF_X509_EXTENSION *);
33299ebb4caSwyllys extern void KMF_FreeTBSCSR(KMF_TBS_CSR *);
33399ebb4caSwyllys extern void KMF_FreeSignedCSR(KMF_CSR_DATA *);
33499ebb4caSwyllys extern void KMF_FreeTBSCert(KMF_X509_TBS_CERT *);
33599ebb4caSwyllys extern void KMF_FreeSignedCert(KMF_X509_CERTIFICATE *);
33699ebb4caSwyllys extern void KMF_FreeString(char *);
33799ebb4caSwyllys extern void KMF_FreeEKU(KMF_X509EXT_EKU *);
33899ebb4caSwyllys extern void KMF_FreeSPKI(KMF_X509_SPKI *);
33999ebb4caSwyllys extern void KMF_FreeKMFKey(KMF_HANDLE_T, KMF_KEY_HANDLE *);
34099ebb4caSwyllys extern void KMF_FreeBigint(KMF_BIGINT *);
34199ebb4caSwyllys extern void KMF_FreeRawKey(KMF_RAW_KEY_DATA *);
34299ebb4caSwyllys extern void KMF_FreeRawSymKey(KMF_RAW_SYM_KEY *);
34399ebb4caSwyllys extern void KMF_FreeCRLDistributionPoints(KMF_X509EXT_CRLDISTPOINTS *);
34499ebb4caSwyllys 
34599ebb4caSwyllys /* APIs for PKCS#11 token */
34699ebb4caSwyllys extern KMF_RETURN KMF_PK11TokenLookup(KMF_HANDLE_T, char *, CK_SLOT_ID *);
34771593db2Swyllys extern CK_SESSION_HANDLE KMF_GetPK11Handle(KMF_HANDLE_T);
34899ebb4caSwyllys 
34999ebb4caSwyllys #ifdef __cplusplus
35099ebb4caSwyllys }
35199ebb4caSwyllys #endif
35299ebb4caSwyllys #endif /* _KMFAPI_H */
353