]> git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libstrongswan/plugins/bliss/bliss_public_key.h
Update copyright headers after acquisition by secunet
[thirdparty/strongswan.git] / src / libstrongswan / plugins / bliss / bliss_public_key.h
1 /*
2 * Copyright (C) 2014 Andreas Steffen
3 *
4 * Copyright (C) secunet Security Networks AG
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup bliss_public_key bliss_public_key
19 * @{ @ingroup bliss_p
20 */
21
22 #ifndef BLISS_PUBLIC_KEY_H_
23 #define BLISS_PUBLIC_KEY_H_
24
25 #include "bliss_param_set.h"
26
27 #include <credentials/builder.h>
28 #include <credentials/cred_encoding.h>
29 #include <credentials/keys/public_key.h>
30
31 typedef struct bliss_public_key_t bliss_public_key_t;
32
33 /**
34 * public_key_t implementation of BLISS signature algorithm
35 */
36 struct bliss_public_key_t {
37
38 /**
39 * Implements the public_key_t interface
40 */
41 public_key_t key;
42 };
43
44 /**
45 * Load a BLISS public key.
46 *
47 * Accepts BUILD_BLISS_* components.
48 *
49 * @param type type of the key, must be KEY_BLISS
50 * @param args builder_part_t argument list
51 * @return loaded key, NULL on failure
52 */
53 bliss_public_key_t *bliss_public_key_load(key_type_t type, va_list args);
54
55 /* The following functions are shared with the bliss_private_key class */
56
57 /**
58 * Parse an ASN.1 BIT STRING into an array of public key coefficients
59 *
60 * @param object packed subjectPublicKey
61 * @param set BLISS parameter set for public key vector
62 * @param pubkey coefficients of public key vector
63 * @return TRUE if parsing successful
64 */
65 bool bliss_public_key_from_asn1(chunk_t object, const bliss_param_set_t *set,
66 uint32_t **pubkey);
67
68 /**
69 * Encode a raw BLISS subjectPublicKey in ASN.1 DER format
70 *
71 * @param pubkey coefficients of public key vector
72 * @param set BLISS parameter set for the public key vector
73 * @result ASN.1 encoded subjectPublicKey
74 */
75 chunk_t bliss_public_key_encode(uint32_t *pubkey, const bliss_param_set_t *set);
76
77 /**
78 * Encode a BLISS subjectPublicKeyInfo record in ASN.1 DER format
79 *
80 * @param oid BLISS public key type OID
81 * @param pubkey coefficients of public key vector
82 * @param set BLISS parameter set for the public key vector
83 * @result ASN.1 encoded subjectPublicKeyInfo record
84 */
85 chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
86 const bliss_param_set_t *set);
87
88 /**
89 * Generate a BLISS public key fingerprint
90 *
91 * @param oid BLISS public key type OID
92 * @param pubkey coefficients of public key vector
93 * @param set BLISS parameter set for the public key vector
94 * @param type type of fingerprint to be generated
95 * @param fp generated fingerprint (must be freed by caller)
96 * @result TRUE if generation was successful
97 */
98 bool bliss_public_key_fingerprint(int oid, uint32_t *pubkey,
99 const bliss_param_set_t *set,
100 cred_encoding_type_t type, chunk_t *fp);
101
102 #endif /** BLISS_PUBLIC_KEY_H_ @}*/