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 * 21*269e59f9SJan Pechanec * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 2299ebb4caSwyllys * 2399ebb4caSwyllys * Constant definitions and function prototypes for the KMF library. 2499ebb4caSwyllys * Commonly used data types are defined in "kmftypes.h". 2599ebb4caSwyllys */ 2699ebb4caSwyllys 2799ebb4caSwyllys #ifndef _KMFAPI_H 2899ebb4caSwyllys #define _KMFAPI_H 2999ebb4caSwyllys 3099ebb4caSwyllys #include <kmftypes.h> 3199ebb4caSwyllys #include <security/cryptoki.h> 3299ebb4caSwyllys 3399ebb4caSwyllys #ifdef __cplusplus 3499ebb4caSwyllys extern "C" { 3599ebb4caSwyllys #endif 3699ebb4caSwyllys 3799ebb4caSwyllys /* 3899ebb4caSwyllys * Setup operations. 3999ebb4caSwyllys */ 4030a5e8faSwyllys extern KMF_RETURN kmf_initialize(KMF_HANDLE_T *, char *, char *); 4130a5e8faSwyllys extern KMF_RETURN kmf_configure_keystore(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 4230a5e8faSwyllys extern KMF_RETURN kmf_finalize(KMF_HANDLE_T); 4399ebb4caSwyllys 4499ebb4caSwyllys /* 4599ebb4caSwyllys * Key operations. 4699ebb4caSwyllys */ 4730a5e8faSwyllys extern KMF_RETURN kmf_create_keypair(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 4899ebb4caSwyllys 4930a5e8faSwyllys extern KMF_RETURN kmf_delete_key_from_keystore(KMF_HANDLE_T, int, 5030a5e8faSwyllys KMF_ATTRIBUTE *); 5199ebb4caSwyllys 5230a5e8faSwyllys extern KMF_RETURN kmf_find_key(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 5399ebb4caSwyllys 5430a5e8faSwyllys extern KMF_RETURN kmf_find_prikey_by_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 5599ebb4caSwyllys 5630a5e8faSwyllys extern KMF_RETURN kmf_store_key(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 5799ebb4caSwyllys 5830a5e8faSwyllys extern KMF_RETURN kmf_create_sym_key(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 5999ebb4caSwyllys 6030a5e8faSwyllys extern KMF_RETURN kmf_get_sym_key_value(KMF_HANDLE_T, KMF_KEY_HANDLE *, 6199ebb4caSwyllys KMF_RAW_SYM_KEY *); 6299ebb4caSwyllys 6399ebb4caSwyllys /* 6499ebb4caSwyllys * Certificate operations. 6599ebb4caSwyllys */ 6630a5e8faSwyllys extern KMF_RETURN kmf_find_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 6799ebb4caSwyllys 6830a5e8faSwyllys extern KMF_RETURN kmf_encode_cert_record(KMF_X509_CERTIFICATE *, KMF_DATA *); 6902744e81Swyllys 7030a5e8faSwyllys extern KMF_RETURN kmf_import_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 7199ebb4caSwyllys 7230a5e8faSwyllys extern KMF_RETURN kmf_store_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 7399ebb4caSwyllys 7430a5e8faSwyllys extern KMF_RETURN kmf_delete_cert_from_keystore(KMF_HANDLE_T, int, 7530a5e8faSwyllys KMF_ATTRIBUTE *); 7699ebb4caSwyllys 7730a5e8faSwyllys extern KMF_RETURN kmf_validate_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 7899ebb4caSwyllys 7930a5e8faSwyllys extern KMF_RETURN kmf_create_cert_file(const KMF_DATA *, KMF_ENCODE_FORMAT, 8030a5e8faSwyllys char *); 8199ebb4caSwyllys 8230a5e8faSwyllys extern KMF_RETURN kmf_download_cert(KMF_HANDLE_T, char *, char *, int, 8399ebb4caSwyllys unsigned int, char *, KMF_ENCODE_FORMAT *); 8499ebb4caSwyllys 85d00756ccSwyllys extern KMF_RETURN kmf_is_cert_data(KMF_DATA *, KMF_ENCODE_FORMAT *); 8630a5e8faSwyllys extern KMF_RETURN kmf_is_cert_file(KMF_HANDLE_T, char *, KMF_ENCODE_FORMAT *); 8730a5e8faSwyllys 8830a5e8faSwyllys extern KMF_RETURN kmf_check_cert_date(KMF_HANDLE_T, const KMF_DATA *); 8930a5e8faSwyllys 9030a5e8faSwyllys /* 9130a5e8faSwyllys * Crypto operations with key or cert. 9230a5e8faSwyllys */ 9330a5e8faSwyllys extern KMF_RETURN kmf_encrypt(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9430a5e8faSwyllys extern KMF_RETURN kmf_decrypt(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9530a5e8faSwyllys extern KMF_RETURN kmf_sign_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9630a5e8faSwyllys extern KMF_RETURN kmf_sign_data(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9730a5e8faSwyllys extern KMF_RETURN kmf_verify_cert(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9830a5e8faSwyllys extern KMF_RETURN kmf_verify_data(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 9999ebb4caSwyllys 10099ebb4caSwyllys /* 10199ebb4caSwyllys * CRL operations. 10299ebb4caSwyllys */ 10330a5e8faSwyllys extern KMF_RETURN kmf_import_crl(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 10430a5e8faSwyllys extern KMF_RETURN kmf_delete_crl(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 10530a5e8faSwyllys extern KMF_RETURN kmf_list_crl(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 10630a5e8faSwyllys extern KMF_RETURN kmf_find_crl(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 10730a5e8faSwyllys extern KMF_RETURN kmf_find_cert_in_crl(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 10830a5e8faSwyllys extern KMF_RETURN kmf_verify_crl_file(KMF_HANDLE_T, char *, KMF_DATA *); 10930a5e8faSwyllys extern KMF_RETURN kmf_check_crl_date(KMF_HANDLE_T, char *); 11030a5e8faSwyllys extern KMF_RETURN kmf_download_crl(KMF_HANDLE_T, char *, char *, 11199ebb4caSwyllys int, unsigned int, char *, KMF_ENCODE_FORMAT *); 11230a5e8faSwyllys extern KMF_RETURN kmf_is_crl_file(KMF_HANDLE_T, char *, KMF_ENCODE_FORMAT *); 11399ebb4caSwyllys 11499ebb4caSwyllys /* 11599ebb4caSwyllys * CSR operations. 11699ebb4caSwyllys */ 11730a5e8faSwyllys extern KMF_RETURN kmf_create_csr_file(KMF_DATA *, KMF_ENCODE_FORMAT, char *); 11830a5e8faSwyllys extern KMF_RETURN kmf_set_csr_pubkey(KMF_HANDLE_T, 11999ebb4caSwyllys KMF_KEY_HANDLE *, KMF_CSR_DATA *); 12030a5e8faSwyllys extern KMF_RETURN kmf_set_csr_version(KMF_CSR_DATA *, uint32_t); 12130a5e8faSwyllys extern KMF_RETURN kmf_set_csr_subject(KMF_CSR_DATA *, KMF_X509_NAME *); 12230a5e8faSwyllys extern KMF_RETURN kmf_set_csr_extn(KMF_CSR_DATA *, KMF_X509_EXTENSION *); 12330a5e8faSwyllys extern KMF_RETURN kmf_set_csr_sig_alg(KMF_CSR_DATA *, KMF_ALGORITHM_INDEX); 12430a5e8faSwyllys extern KMF_RETURN kmf_set_csr_subject_altname(KMF_CSR_DATA *, char *, 12599ebb4caSwyllys int, KMF_GENERALNAMECHOICES); 12630a5e8faSwyllys extern KMF_RETURN kmf_set_csr_ku(KMF_CSR_DATA *, int, uint16_t); 127d00756ccSwyllys extern KMF_RETURN kmf_decode_csr(KMF_HANDLE_T, KMF_DATA *, KMF_CSR_DATA *); 128d00756ccSwyllys extern KMF_RETURN kmf_verify_csr(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 12930a5e8faSwyllys extern KMF_RETURN kmf_sign_csr(KMF_HANDLE_T, const KMF_CSR_DATA *, 13099ebb4caSwyllys KMF_KEY_HANDLE *, KMF_DATA *); 131d00756ccSwyllys extern KMF_RETURN kmf_add_csr_eku(KMF_CSR_DATA *, KMF_OID *, int); 13299ebb4caSwyllys 13399ebb4caSwyllys /* 13499ebb4caSwyllys * GetCert operations. 13599ebb4caSwyllys */ 13630a5e8faSwyllys extern KMF_RETURN kmf_get_cert_extn(const KMF_DATA *, KMF_OID *, 13799ebb4caSwyllys KMF_X509_EXTENSION *); 13899ebb4caSwyllys 13930a5e8faSwyllys extern KMF_RETURN kmf_get_cert_extns(const KMF_DATA *, KMF_FLAG_CERT_EXTN, 14099ebb4caSwyllys KMF_X509_EXTENSION **, int *); 14199ebb4caSwyllys 14230a5e8faSwyllys extern KMF_RETURN kmf_get_cert_ku(const KMF_DATA *, KMF_X509EXT_KEY_USAGE *); 14399ebb4caSwyllys 14430a5e8faSwyllys extern KMF_RETURN kmf_get_cert_eku(const KMF_DATA *, KMF_X509EXT_EKU *); 14599ebb4caSwyllys 14630a5e8faSwyllys extern KMF_RETURN kmf_get_cert_basic_constraint(const KMF_DATA *, 14799ebb4caSwyllys KMF_BOOL *, KMF_X509EXT_BASICCONSTRAINTS *); 14899ebb4caSwyllys 14930a5e8faSwyllys extern KMF_RETURN kmf_get_cert_policies(const KMF_DATA *, 15099ebb4caSwyllys KMF_BOOL *, KMF_X509EXT_CERT_POLICIES *); 15199ebb4caSwyllys 15230a5e8faSwyllys extern KMF_RETURN kmf_get_cert_auth_info_access(const KMF_DATA *, 15399ebb4caSwyllys KMF_X509EXT_AUTHINFOACCESS *); 15499ebb4caSwyllys 15530a5e8faSwyllys extern KMF_RETURN kmf_get_cert_crl_dist_pts(const KMF_DATA *, 15699ebb4caSwyllys KMF_X509EXT_CRLDISTPOINTS *); 15799ebb4caSwyllys 15830a5e8faSwyllys extern KMF_RETURN kmf_get_cert_version_str(KMF_HANDLE_T, const KMF_DATA *, 15999ebb4caSwyllys char **); 16099ebb4caSwyllys 16130a5e8faSwyllys extern KMF_RETURN kmf_get_cert_subject_str(KMF_HANDLE_T, const KMF_DATA *, 16299ebb4caSwyllys char **); 16399ebb4caSwyllys 16430a5e8faSwyllys extern KMF_RETURN kmf_get_cert_issuer_str(KMF_HANDLE_T, const KMF_DATA *, 16530a5e8faSwyllys char **); 16699ebb4caSwyllys 16730a5e8faSwyllys extern KMF_RETURN kmf_get_cert_serial_str(KMF_HANDLE_T, const KMF_DATA *, 16830a5e8faSwyllys char **); 16999ebb4caSwyllys 17030a5e8faSwyllys extern KMF_RETURN kmf_get_cert_start_date_str(KMF_HANDLE_T, const KMF_DATA *, 17130a5e8faSwyllys char **); 17299ebb4caSwyllys 17330a5e8faSwyllys extern KMF_RETURN kmf_get_cert_end_date_str(KMF_HANDLE_T, const KMF_DATA *, 17430a5e8faSwyllys char **); 17599ebb4caSwyllys 17630a5e8faSwyllys extern KMF_RETURN kmf_get_cert_pubkey_alg_str(KMF_HANDLE_T, const KMF_DATA *, 17730a5e8faSwyllys char **); 17899ebb4caSwyllys 17930a5e8faSwyllys extern KMF_RETURN kmf_get_cert_sig_alg_str(KMF_HANDLE_T, const KMF_DATA *, 18030a5e8faSwyllys char **); 18199ebb4caSwyllys 18230a5e8faSwyllys extern KMF_RETURN kmf_get_cert_pubkey_str(KMF_HANDLE_T, const KMF_DATA *, 18330a5e8faSwyllys char **); 18430a5e8faSwyllys 18530a5e8faSwyllys extern KMF_RETURN kmf_get_cert_email_str(KMF_HANDLE_T, const KMF_DATA *, 18630a5e8faSwyllys char **); 18730a5e8faSwyllys 18830a5e8faSwyllys extern KMF_RETURN kmf_get_cert_extn_str(KMF_HANDLE_T, const KMF_DATA *, 18999ebb4caSwyllys KMF_PRINTABLE_ITEM, char **); 19099ebb4caSwyllys 19130a5e8faSwyllys extern KMF_RETURN kmf_get_cert_id_data(const KMF_DATA *, KMF_DATA *); 19230a5e8faSwyllys 19330a5e8faSwyllys extern KMF_RETURN kmf_get_cert_id_str(const KMF_DATA *, char **); 19430a5e8faSwyllys 19530a5e8faSwyllys extern KMF_RETURN kmf_get_cert_validity(const KMF_DATA *, time_t *, time_t *); 19630a5e8faSwyllys 19799ebb4caSwyllys 19899ebb4caSwyllys /* 19999ebb4caSwyllys * SetCert operations 20099ebb4caSwyllys */ 20130a5e8faSwyllys extern KMF_RETURN kmf_set_cert_pubkey(KMF_HANDLE_T, KMF_KEY_HANDLE *, 20299ebb4caSwyllys KMF_X509_CERTIFICATE *); 20399ebb4caSwyllys 20430a5e8faSwyllys extern KMF_RETURN kmf_set_cert_subject(KMF_X509_CERTIFICATE *, 20599ebb4caSwyllys KMF_X509_NAME *); 20699ebb4caSwyllys 20730a5e8faSwyllys extern KMF_RETURN kmf_set_cert_ku(KMF_X509_CERTIFICATE *, int, uint16_t); 20899ebb4caSwyllys 20930a5e8faSwyllys extern KMF_RETURN kmf_set_cert_issuer(KMF_X509_CERTIFICATE *, 21099ebb4caSwyllys KMF_X509_NAME *); 21199ebb4caSwyllys 21230a5e8faSwyllys extern KMF_RETURN kmf_set_cert_sig_alg(KMF_X509_CERTIFICATE *, 21399ebb4caSwyllys KMF_ALGORITHM_INDEX); 21499ebb4caSwyllys 21530a5e8faSwyllys extern KMF_RETURN kmf_set_cert_validity(KMF_X509_CERTIFICATE *, 21699ebb4caSwyllys time_t, uint32_t); 21799ebb4caSwyllys 21830a5e8faSwyllys extern KMF_RETURN kmf_set_cert_serial(KMF_X509_CERTIFICATE *, 21999ebb4caSwyllys KMF_BIGINT *); 22099ebb4caSwyllys 22130a5e8faSwyllys extern KMF_RETURN kmf_set_cert_version(KMF_X509_CERTIFICATE *, uint32_t); 22299ebb4caSwyllys 22330a5e8faSwyllys extern KMF_RETURN kmf_set_cert_issuer_altname(KMF_X509_CERTIFICATE *, 22499ebb4caSwyllys int, KMF_GENERALNAMECHOICES, char *); 22599ebb4caSwyllys 22630a5e8faSwyllys extern KMF_RETURN kmf_set_cert_subject_altname(KMF_X509_CERTIFICATE *, 22799ebb4caSwyllys int, KMF_GENERALNAMECHOICES, char *); 22899ebb4caSwyllys 22930a5e8faSwyllys extern KMF_RETURN kmf_add_cert_eku(KMF_X509_CERTIFICATE *, KMF_OID *, int); 23099ebb4caSwyllys 23130a5e8faSwyllys extern KMF_RETURN kmf_set_cert_extn(KMF_X509_CERTIFICATE *, 23299ebb4caSwyllys KMF_X509_EXTENSION *); 23399ebb4caSwyllys 23430a5e8faSwyllys extern KMF_RETURN kmf_set_cert_basic_constraint(KMF_X509_CERTIFICATE *, 23599ebb4caSwyllys KMF_BOOL, KMF_X509EXT_BASICCONSTRAINTS *); 23699ebb4caSwyllys 23730a5e8faSwyllys 23830a5e8faSwyllys /* 23930a5e8faSwyllys * PK12 operations 24030a5e8faSwyllys */ 24130a5e8faSwyllys extern KMF_RETURN kmf_export_pk12(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 24230a5e8faSwyllys 24330a5e8faSwyllys extern KMF_RETURN kmf_build_pk12(KMF_HANDLE_T, int, KMF_X509_DER_CERT *, 24430a5e8faSwyllys int, KMF_KEY_HANDLE *, KMF_CREDENTIAL *, char *); 24530a5e8faSwyllys 24630a5e8faSwyllys extern KMF_RETURN kmf_import_objects(KMF_HANDLE_T, char *, KMF_CREDENTIAL *, 2475b3e1433Swyllys KMF_X509_DER_CERT **, int *, KMF_RAW_KEY_DATA **, int *); 24899ebb4caSwyllys 24999ebb4caSwyllys /* 25030a5e8faSwyllys * OCSP operations 25199ebb4caSwyllys */ 25230a5e8faSwyllys extern KMF_RETURN kmf_get_ocsp_for_cert(KMF_HANDLE_T, KMF_DATA *, KMF_DATA *, 25399ebb4caSwyllys KMF_DATA *); 25499ebb4caSwyllys 25530a5e8faSwyllys extern KMF_RETURN kmf_create_ocsp_request(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 25699ebb4caSwyllys 25730a5e8faSwyllys extern KMF_RETURN kmf_get_encoded_ocsp_response(KMF_HANDLE_T, char *, 25830a5e8faSwyllys char *, int, char *, int, char *, unsigned int); 25999ebb4caSwyllys 26030a5e8faSwyllys extern KMF_RETURN kmf_get_ocsp_status_for_cert(KMF_HANDLE_T, int, 26130a5e8faSwyllys KMF_ATTRIBUTE *); 26299ebb4caSwyllys 26399ebb4caSwyllys /* 26499ebb4caSwyllys * Policy Operations 26599ebb4caSwyllys */ 26630a5e8faSwyllys extern KMF_RETURN kmf_set_policy(KMF_HANDLE_T, char *, char *); 26799ebb4caSwyllys 26899ebb4caSwyllys /* 26999ebb4caSwyllys * Error handling. 27099ebb4caSwyllys */ 27130a5e8faSwyllys extern KMF_RETURN kmf_get_plugin_error_str(KMF_HANDLE_T, char **); 27230a5e8faSwyllys extern KMF_RETURN kmf_get_kmf_error_str(KMF_RETURN, char **); 27399ebb4caSwyllys 27499ebb4caSwyllys /* 27599ebb4caSwyllys * Miscellaneous 27699ebb4caSwyllys */ 27730a5e8faSwyllys extern KMF_RETURN kmf_dn_parser(char *, KMF_X509_NAME *); 27830a5e8faSwyllys extern KMF_RETURN kmf_read_input_file(KMF_HANDLE_T, char *, KMF_DATA *); 27930a5e8faSwyllys extern KMF_RETURN kmf_der_to_pem(KMF_OBJECT_TYPE, unsigned char *, 28099ebb4caSwyllys int, unsigned char **, int *); 28130a5e8faSwyllys extern KMF_RETURN kmf_pem_to_der(unsigned char *, int, unsigned char **, int *); 28230a5e8faSwyllys extern char *kmf_oid_to_string(KMF_OID *); 28330a5e8faSwyllys extern KMF_RETURN kmf_string_to_oid(char *, KMF_OID *); 28430a5e8faSwyllys extern int kmf_compare_rdns(KMF_X509_NAME *, KMF_X509_NAME *); 285d00756ccSwyllys extern KMF_RETURN kmf_get_data_format(KMF_DATA *, KMF_ENCODE_FORMAT *); 28630a5e8faSwyllys extern KMF_RETURN kmf_get_file_format(char *, KMF_ENCODE_FORMAT *); 28730a5e8faSwyllys extern uint32_t kmf_string_to_ku(char *); 28830a5e8faSwyllys extern char *kmf_ku_to_string(uint32_t); 28930a5e8faSwyllys extern KMF_RETURN kmf_hexstr_to_bytes(unsigned char *, unsigned char **, 29099ebb4caSwyllys size_t *); 29199ebb4caSwyllys 292431deaa0Shylee extern KMF_RETURN kmf_get_plugin_info(KMF_HANDLE_T, char *, 293431deaa0Shylee KMF_KEYSTORE_TYPE *, char **); 294431deaa0Shylee 295d00756ccSwyllys extern KMF_OID *kmf_ekuname_to_oid(char *); 296d00756ccSwyllys extern char *kmf_oid_to_ekuname(KMF_OID *); 297d00756ccSwyllys 29830a5e8faSwyllys #define KMF_CompareRDNs kmf_compare_rdns 29930a5e8faSwyllys 30099ebb4caSwyllys /* 30199ebb4caSwyllys * Memory cleanup operations 30299ebb4caSwyllys */ 30330a5e8faSwyllys extern void kmf_free_dn(KMF_X509_NAME *); 30430a5e8faSwyllys extern void kmf_free_kmf_cert(KMF_HANDLE_T, KMF_X509_DER_CERT *); 30530a5e8faSwyllys extern void kmf_free_data(KMF_DATA *); 30630a5e8faSwyllys extern void kmf_free_algoid(KMF_X509_ALGORITHM_IDENTIFIER *); 30730a5e8faSwyllys extern void kmf_free_extn(KMF_X509_EXTENSION *); 30830a5e8faSwyllys extern void kmf_free_tbs_csr(KMF_TBS_CSR *); 30930a5e8faSwyllys extern void kmf_free_signed_csr(KMF_CSR_DATA *); 31030a5e8faSwyllys extern void kmf_free_tbs_cert(KMF_X509_TBS_CERT *); 31130a5e8faSwyllys extern void kmf_free_signed_cert(KMF_X509_CERTIFICATE *); 31230a5e8faSwyllys extern void kmf_free_str(char *); 31330a5e8faSwyllys extern void kmf_free_eku(KMF_X509EXT_EKU *); 31430a5e8faSwyllys extern void kmf_free_spki(KMF_X509_SPKI *); 31530a5e8faSwyllys extern void kmf_free_kmf_key(KMF_HANDLE_T, KMF_KEY_HANDLE *); 31630a5e8faSwyllys extern void kmf_free_bigint(KMF_BIGINT *); 31730a5e8faSwyllys extern void kmf_free_raw_key(KMF_RAW_KEY_DATA *); 31830a5e8faSwyllys extern void kmf_free_raw_sym_key(KMF_RAW_SYM_KEY *); 31930a5e8faSwyllys extern void kmf_free_crl_dist_pts(KMF_X509EXT_CRLDISTPOINTS *); 32099ebb4caSwyllys 32199ebb4caSwyllys /* APIs for PKCS#11 token */ 32230a5e8faSwyllys extern KMF_RETURN kmf_pk11_token_lookup(KMF_HANDLE_T, char *, CK_SLOT_ID *); 32347e946e7SWyllys Ingersoll extern KMF_RETURN kmf_pk11_init_token(KMF_HANDLE_T, 32447e946e7SWyllys Ingersoll char *, char *, CK_UTF8CHAR_PTR, CK_ULONG); 32530a5e8faSwyllys extern KMF_RETURN kmf_set_token_pin(KMF_HANDLE_T, int, KMF_ATTRIBUTE *); 32630a5e8faSwyllys extern CK_SESSION_HANDLE kmf_get_pk11_handle(KMF_HANDLE_T); 32730a5e8faSwyllys 32830a5e8faSwyllys /* 32930a5e8faSwyllys * Attribute management routines. 33030a5e8faSwyllys */ 33130a5e8faSwyllys int kmf_find_attr(KMF_ATTR_TYPE, KMF_ATTRIBUTE *, int); 33230a5e8faSwyllys void *kmf_get_attr_ptr(KMF_ATTR_TYPE, KMF_ATTRIBUTE *, int); 33330a5e8faSwyllys KMF_RETURN kmf_get_attr(KMF_ATTR_TYPE, KMF_ATTRIBUTE *, int, void *, 33430a5e8faSwyllys uint32_t *); 33530a5e8faSwyllys KMF_RETURN kmf_get_string_attr(KMF_ATTR_TYPE, KMF_ATTRIBUTE *, int, char **); 33630a5e8faSwyllys KMF_RETURN kmf_set_attr(KMF_ATTRIBUTE *, int, KMF_ATTR_TYPE, void *, uint32_t); 33730a5e8faSwyllys void kmf_set_attr_at_index(KMF_ATTRIBUTE *, int, KMF_ATTR_TYPE, 33830a5e8faSwyllys void *, uint32_t); 33930a5e8faSwyllys 340*269e59f9SJan Pechanec /* 341*269e59f9SJan Pechanec * Certificate to name mapping functions. 342*269e59f9SJan Pechanec */ 343*269e59f9SJan Pechanec KMF_RETURN kmf_cert_to_name_mapping_initialize(KMF_HANDLE_T, int, 344*269e59f9SJan Pechanec KMF_ATTRIBUTE *); 345*269e59f9SJan Pechanec KMF_RETURN kmf_cert_to_name_mapping_finalize(KMF_HANDLE_T); 346*269e59f9SJan Pechanec KMF_RETURN kmf_map_cert_to_name(KMF_HANDLE_T, KMF_DATA *, KMF_DATA *); 347*269e59f9SJan Pechanec KMF_RETURN kmf_match_cert_to_name(KMF_HANDLE_T, KMF_DATA *, KMF_DATA *, 348*269e59f9SJan Pechanec KMF_DATA *); 349*269e59f9SJan Pechanec KMF_RETURN kmf_get_mapper_error_str(KMF_HANDLE_T, char **); 350*269e59f9SJan Pechanec /* 351*269e59f9SJan Pechanec * Helper functions for handling the mapper internal state. They are part of the 352*269e59f9SJan Pechanec * public interface, too. 353*269e59f9SJan Pechanec */ 354*269e59f9SJan Pechanec void kmf_set_mapper_lasterror(KMF_HANDLE_T, uint32_t); 355*269e59f9SJan Pechanec uint32_t kmf_get_mapper_lasterror(KMF_HANDLE_T); 356*269e59f9SJan Pechanec void kmf_set_mapper_options(KMF_HANDLE_T, void *); 357*269e59f9SJan Pechanec void *kmf_get_mapper_options(KMF_HANDLE_T); 358*269e59f9SJan Pechanec 35999ebb4caSwyllys #ifdef __cplusplus 36099ebb4caSwyllys } 36199ebb4caSwyllys #endif 36299ebb4caSwyllys #endif /* _KMFAPI_H */ 363