Annotation of embedaddon/strongswan/src/libstrongswan/credentials/containers/pkcs12.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2013 Tobias Brunner
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup pkcs12 pkcs12
18: * @{ @ingroup containers
19: */
20:
21: #ifndef PKCS12_H_
22: #define PKCS12_H_
23:
24: #include <credentials/containers/container.h>
25: #include <crypto/hashers/hasher.h>
26:
27: typedef enum pkcs12_key_type_t pkcs12_key_type_t;
28: typedef struct pkcs12_t pkcs12_t;
29:
30: /**
31: * The types of password based keys used by PKCS#12.
32: */
33: enum pkcs12_key_type_t {
34: PKCS12_KEY_ENCRYPTION = 1,
35: PKCS12_KEY_IV = 2,
36: PKCS12_KEY_MAC = 3,
37: };
38:
39: /**
40: * PKCS#12/PFX container type.
41: */
42: struct pkcs12_t {
43:
44: /**
45: * Implements container_t.
46: */
47: container_t container;
48:
49: /**
50: * Create an enumerator over extracted certificates.
51: *
52: * @return enumerator over certificate_t
53: */
54: enumerator_t* (*create_cert_enumerator)(pkcs12_t *this);
55:
56: /**
57: * Create an enumerator over extracted private keys.
58: *
59: * @return enumerator over private_key_t
60: */
61: enumerator_t* (*create_key_enumerator)(pkcs12_t *this);
62: };
63:
64: /**
65: * Derive the keys used in PKCS#12 for password integrity/privacy mode.
66: *
67: * @param hash hash algorithm to use for key derivation
68: * @param password password (ASCII)
69: * @param salt salt value
70: * @param iterations number of iterations
71: * @param type type of key to derive
72: * @param key the returned key, must be allocated of desired length
73: * @return TRUE on success
74: */
75: bool pkcs12_derive_key(hash_algorithm_t hash, chunk_t password, chunk_t salt,
76: uint64_t iterations, pkcs12_key_type_t type, chunk_t key);
77:
78: #endif /** PKCS12_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>