X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilcpkcs.h;h=eeaa240586c1a6878d280ba68fca094b2c778c68;hb=40f8443d8d3a6577336ee66d18e04d9ac4d956bb;hp=e1ed9fc7284b41a1d3a5b5e10e0e37d66a99db27;hpb=fe64e3c36398fa08a8fc08cda4dafbd652c213ad;p=silc.git diff --git a/lib/silccrypt/silcpkcs.h b/lib/silccrypt/silcpkcs.h index e1ed9fc7..eeaa2405 100644 --- a/lib/silccrypt/silcpkcs.h +++ b/lib/silccrypt/silcpkcs.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2003 Pekka Riikonen + Copyright (C) 1997 - 2005 Pekka Riikonen 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 @@ -53,10 +53,33 @@ ***/ typedef struct SilcPKCSStruct *SilcPKCS; +/****d* silccrypt/SilcPKCSAPI/SilcPKCSType + * + * NAME + * + * typedef enum { ... } SilcPKCSType + * + * DESCRIPTION + * + * Public key cryptosystem types. These are defined by the SILC + * Key Exchange protocol. + * + * SOURCE + */ +typedef enum { + SILC_PKCS_SILC = 1, /* SILC PKCS (mandatory) */ + SILC_PKCS_SSH2 = 2, /* SSH2 PKCS (not supported) */ + SILC_PKCS_X509V3 = 3, /* X.509v3 PKCS (not supported) */ + SILC_PKCS_OPENPGP = 4, /* OpenPGP PKCS (not supported) */ + SILC_PKCS_SPKI = 5, /* SPKI PKCS (not supported) */ +} SilcPKCSType; +/***/ + /* The default SILC PKCS (Public Key Cryptosystem) object to represent any PKCS in SILC. */ typedef struct SilcPKCSObjectStruct { char *name; + SilcPKCSType type; int (*init)(void *, SilcUInt32, SilcRng); void (*clear_keys)(void *); unsigned char *(*get_public_key)(void *, SilcUInt32 *); @@ -303,7 +326,8 @@ SilcBool silc_pkcs_unregister_all(void); * * SYNOPSIS * - * SilcBool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs); + * SilcBool silc_pkcs_alloc(const unsigned char *name, + * SilcPKCSType type, SilcPKCS *new_pkcs); * * DESCRIPTION * @@ -311,7 +335,8 @@ SilcBool silc_pkcs_unregister_all(void); * to the 'new_pkcs' argument. Returns FALSE on error. * ***/ -SilcBool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs); +SilcBool silc_pkcs_alloc(const unsigned char *name, + SilcPKCSType type, SilcPKCS *new_pkcs); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_free * @@ -366,7 +391,7 @@ char *silc_pkcs_get_supported(void); * ***/ SilcBool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len, - SilcRng rng); + SilcRng rng); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_key_len * @@ -501,8 +526,9 @@ SilcUInt32 silc_pkcs_private_key_data_set(SilcPKCS pkcs, unsigned char *prv, * Encrypts. Returns FALSE on error. * ***/ -SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len, - unsigned char *dst, SilcUInt32 *dst_len); +SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, + SilcUInt32 src_len, + unsigned char *dst, SilcUInt32 *dst_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_decrypt * @@ -517,8 +543,9 @@ SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len * Decrypts. Returns FALSE on error. * ***/ -SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len, - unsigned char *dst, SilcUInt32 *dst_len); +SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, + SilcUInt32 src_len, + unsigned char *dst, SilcUInt32 *dst_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_sign * @@ -534,7 +561,7 @@ SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len * ***/ SilcBool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len, - unsigned char *dst, SilcUInt32 *dst_len); + unsigned char *dst, SilcUInt32 *dst_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_verify * @@ -551,8 +578,8 @@ SilcBool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len, * ***/ SilcBool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature, - SilcUInt32 signature_len, unsigned char *data, - SilcUInt32 data_len); + SilcUInt32 signature_len, unsigned char *data, + SilcUInt32 data_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_sign_with_hash * @@ -569,8 +596,8 @@ SilcBool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature, * ***/ SilcBool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash, - unsigned char *src, SilcUInt32 src_len, - unsigned char *dst, SilcUInt32 *dst_len); + unsigned char *src, SilcUInt32 src_len, + unsigned char *dst, SilcUInt32 *dst_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_verify_with_hash * @@ -589,10 +616,10 @@ SilcBool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash, * ***/ SilcBool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash, - unsigned char *signature, - SilcUInt32 signature_len, - unsigned char *data, - SilcUInt32 data_len); + unsigned char *signature, + SilcUInt32 signature_len, + unsigned char *data, + SilcUInt32 data_len); /****f* silccrypt/SilcPKCSAPI/silc_pkcs_encode_identifier *