Author: Pekka Riikonen <priikone@silcnet.org>
- 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
***/
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 *);
*
* 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
*
* 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
*
*
***/
SilcBool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
- SilcRng rng);
+ SilcRng rng);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_key_len
*
* 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
*
* 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
*
*
***/
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
*
*
***/
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
*
*
***/
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
*
*
***/
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
*