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