2 * Copyright (C) 2014 Andreas Steffen
4 * Copyright (C) secunet Security Networks AG
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>.
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
18 * @defgroup bliss_public_key bliss_public_key
22 #ifndef BLISS_PUBLIC_KEY_H_
23 #define BLISS_PUBLIC_KEY_H_
25 #include "bliss_param_set.h"
27 #include <credentials/builder.h>
28 #include <credentials/cred_encoding.h>
29 #include <credentials/keys/public_key.h>
31 typedef struct bliss_public_key_t bliss_public_key_t
;
34 * public_key_t implementation of BLISS signature algorithm
36 struct bliss_public_key_t
{
39 * Implements the public_key_t interface
45 * Load a BLISS public key.
47 * Accepts BUILD_BLISS_* components.
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
53 bliss_public_key_t
*bliss_public_key_load(key_type_t type
, va_list args
);
55 /* The following functions are shared with the bliss_private_key class */
58 * Parse an ASN.1 BIT STRING into an array of public key coefficients
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
65 bool bliss_public_key_from_asn1(chunk_t object
, const bliss_param_set_t
*set
,
69 * Encode a raw BLISS subjectPublicKey in ASN.1 DER format
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
75 chunk_t
bliss_public_key_encode(uint32_t *pubkey
, const bliss_param_set_t
*set
);
78 * Encode a BLISS subjectPublicKeyInfo record in ASN.1 DER format
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
85 chunk_t
bliss_public_key_info_encode(int oid
, uint32_t *pubkey
,
86 const bliss_param_set_t
*set
);
89 * Generate a BLISS public key fingerprint
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
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
);
102 #endif /** BLISS_PUBLIC_KEY_H_ @}*/