Annotation of embedaddon/strongswan/src/libstrongswan/plugins/bliss/bliss_public_key.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2014 Andreas Steffen
                      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 bliss_public_key bliss_public_key
                     18:  * @{ @ingroup bliss_p
                     19:  */
                     20: 
                     21: #ifndef BLISS_PUBLIC_KEY_H_
                     22: #define BLISS_PUBLIC_KEY_H_
                     23: 
                     24: #include "bliss_param_set.h"
                     25: 
                     26: #include <credentials/builder.h>
                     27: #include <credentials/cred_encoding.h>
                     28: #include <credentials/keys/public_key.h>
                     29: 
                     30: typedef struct bliss_public_key_t bliss_public_key_t;
                     31: 
                     32: /**
                     33:  * public_key_t implementation of BLISS signature algorithm
                     34:  */
                     35: struct bliss_public_key_t {
                     36: 
                     37:        /**
                     38:         * Implements the public_key_t interface
                     39:         */
                     40:        public_key_t key;
                     41: };
                     42: 
                     43: /**
                     44:  * Load a BLISS public key.
                     45:  *
                     46:  * Accepts BUILD_BLISS_* components.
                     47:  *
                     48:  * @param type         type of the key, must be KEY_BLISS
                     49:  * @param args         builder_part_t argument list
                     50:  * @return                     loaded key, NULL on failure
                     51:  */
                     52: bliss_public_key_t *bliss_public_key_load(key_type_t type, va_list args);
                     53: 
                     54: /* The following functions are shared with the bliss_private_key class */
                     55: 
                     56: /**
                     57:  * Parse an ASN.1 BIT STRING into an array of public key coefficients
                     58:  *
                     59:  * @param object       packed subjectPublicKey
                     60:  * @param set          BLISS parameter set for public key vector
                     61:  * @param pubkey       coefficients of public key vector
                     62:  * @return                     TRUE if parsing successful
                     63:  */
                     64: bool bliss_public_key_from_asn1(chunk_t object, const bliss_param_set_t *set,
                     65:                                                                uint32_t **pubkey);
                     66: 
                     67: /**
                     68:  * Encode a raw BLISS subjectPublicKey in ASN.1 DER format
                     69:  *
                     70:  * @param pubkey       coefficients of public key vector
                     71:  * @param set          BLISS parameter set for the public key vector
                     72:  * @result                     ASN.1 encoded subjectPublicKey
                     73:  */
                     74: chunk_t bliss_public_key_encode(uint32_t *pubkey, const bliss_param_set_t *set);
                     75: 
                     76: /**
                     77:  * Encode a BLISS subjectPublicKeyInfo record in ASN.1 DER format
                     78:  *
                     79:  * @param oid          BLISS public key type OID
                     80:  * @param pubkey       coefficients of public key vector
                     81:  * @param set          BLISS parameter set for the public key vector
                     82:  * @result                     ASN.1 encoded subjectPublicKeyInfo record
                     83:  */
                     84: chunk_t bliss_public_key_info_encode(int oid, uint32_t *pubkey,
                     85:                                                                         const bliss_param_set_t *set);
                     86: 
                     87: /**
                     88:  * Generate a BLISS public key fingerprint
                     89:  *
                     90:  * @param oid          BLISS public key type OID
                     91:  * @param pubkey       coefficients of public key vector
                     92:  * @param set          BLISS parameter set for the public key vector
                     93:  * @param type         type of fingerprint to be generated
                     94:  * @param fp           generated fingerprint (must be freed by caller)
                     95:  * @result                     TRUE if generation was successful
                     96:  */
                     97: bool bliss_public_key_fingerprint(int oid, uint32_t *pubkey,
                     98:                                                                  const bliss_param_set_t *set,
                     99:                                                                  cred_encoding_type_t type, chunk_t *fp);
                    100: 
                    101: #endif /** BLISS_PUBLIC_KEY_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>