Return to curve25519_public_key.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / plugins / curve25519 |
1.1 misho 1: /* 2: * Copyright (C) 2016 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 curve25519_public_key curve25519_public_key 18: * @{ @ingroup curve25519_p 19: */ 20: 21: #ifndef CURVE25519_PUBLIC_KEY_H_ 22: #define CURVE25519_PUBLIC_KEY_H_ 23: 24: #include <credentials/builder.h> 25: #include <credentials/cred_encoding.h> 26: #include <credentials/keys/public_key.h> 27: 28: typedef struct curve25519_public_key_t curve25519_public_key_t; 29: 30: #define ED25519_KEY_LEN 32 31: 32: /** 33: * public_key_t implementation of Ed25519 signature algorithm 34: */ 35: struct curve25519_public_key_t { 36: 37: /** 38: * Implements the public_key_t interface 39: */ 40: public_key_t key; 41: }; 42: 43: /** 44: * Load an Ed25519 public key. 45: * 46: * @param type type of the key, must be KEY_ED25519 47: * @param args builder_part_t argument list 48: * @return loaded key, NULL on failure 49: */ 50: curve25519_public_key_t *curve25519_public_key_load(key_type_t type, 51: va_list args); 52: 53: /* The following functions are shared with the curve25519_private_key class */ 54: 55: /** 56: * Encode a Ed25519 subjectPublicKeyInfo record in ASN.1 DER format 57: * 58: * @param pubkey Ed25519 public key 59: * @result ASN.1 encoded subjectPublicKeyInfo record 60: */ 61: chunk_t curve25519_public_key_info_encode(chunk_t pubkey); 62: 63: /** 64: * Generate a Ed25519 public key fingerprint 65: * 66: * @param pubkey Ed25519 public key 67: * @param type type of fingerprint to be generated 68: * @param fp generated fingerprint (must be freed by caller) 69: * @result TRUE if generation was successful 70: */ 71: bool curve25519_public_key_fingerprint(chunk_t pubkey, 72: cred_encoding_type_t type, chunk_t *fp); 73: 74: #endif /** CURVE25519_PUBLIC_KEY_H_ @}*/