X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilcpk.h;h=93a4bc66aa0bd60afda8bc0420de1d66a589ddc0;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=3db2cf2f14d321a69402da71d9c963f0100adadb;hpb=410642a14d4185abd75715cee3f5177cd55b1ceb;p=silc.git diff --git a/lib/silccrypt/silcpk.h b/lib/silccrypt/silcpk.h index 3db2cf2f..93a4bc66 100644 --- a/lib/silccrypt/silcpk.h +++ b/lib/silccrypt/silcpk.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2005 Pekka Riikonen + Copyright (C) 1997 - 2007 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 @@ -43,13 +43,14 @@ * * SOURCE */ -typedef struct { +typedef struct SilcPublicKeyIdentifierObject { char *username; char *host; char *realname; char *email; char *org; char *country; + char *version; } *SilcPublicKeyIdentifier, SilcPublicKeyIdentifierStruct; /***/ @@ -63,15 +64,15 @@ typedef struct { * * This structure defines the SILC protocol style public key. User * doesn't have to access this structure usually, except when access to - * the identifier is required. The silc_pkcs_get_context for the + * the identifier is required. The silc_pkcs_public_key_get_pkcs for the * PKCS type SILC_PKCS_SILC returns this context. * * SOURCE */ -typedef struct { +typedef struct SilcSILCPublicKeyStruct { SilcPublicKeyIdentifierStruct identifier; const SilcPKCSAlgorithm *pkcs; /* PKCS algorithm */ - void *public_key; /* MPKCS algorithm specific public key */ + void *public_key; /* PKCS algorithm specific public key */ } *SilcSILCPublicKey; /***/ @@ -88,7 +89,7 @@ typedef struct { * * SOURCE */ -typedef struct { +typedef struct SilcSILCPrivateKeyStruct { const SilcPKCSAlgorithm *pkcs; /* PKCS algorithm */ void *private_key; /* PKCS algorithm specific private key */ } *SilcSILCPrivateKey; @@ -99,8 +100,8 @@ typedef struct { * SYNOPSIS * * SilcBool silc_pkcs_silc_generate_key(const char *algorithm, - * const char *scheme, * SilcUInt32 bits_key_len, + * const char *identifier, * SilcRng rng, * SilcPublicKey *ret_public_key, * SilcPrivateKey *ret_private_key) @@ -113,27 +114,26 @@ typedef struct { * * EXAMPLE * - * // Generate RSA key pair with 2048 bit key length, using PKCS #1 - * // no OID scheme. - * silc_pkcs_silc_generate_key("rsa", "pkcs1-no-oid", 2048, - * rng, &public_key, &private_key); + * // Generate RSA key pair with 2048 bit key length + * silc_pkcs_silc_generate_key("rsa", 2048, ident_string, rng, + * &public_key, &private_key); * ***/ SilcBool silc_pkcs_silc_generate_key(const char *algorithm, - const char *scheme, SilcUInt32 bits_key_len, const char *identifier, SilcRng rng, SilcPublicKey *ret_public_key, SilcPrivateKey *ret_private_key); -/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_decode_identifier +/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_encode_identifier * * SYNOPSIS * * char *silc_pkcs_silc_encode_identifier(char *username, char *host, * char *realname, char *email, - * char *org, char *country) + * char *org, char *country, + * char *version); * * DESCRIPTION * @@ -142,10 +142,14 @@ SilcBool silc_pkcs_silc_generate_key(const char *algorithm, * Protocol says that at least username and host must be provided. * Caller must free the returned identifier string. * + * If `stack' is non-NULL the returned string is allocated from `stack'. + * ***/ -char *silc_pkcs_silc_encode_identifier(char *username, char *host, +char *silc_pkcs_silc_encode_identifier(SilcStack stack, + char *username, char *host, char *realname, char *email, - char *org, char *country); + char *org, char *country, + char *version); /****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_decode_identifier * @@ -164,4 +168,19 @@ char *silc_pkcs_silc_encode_identifier(char *username, char *host, SilcBool silc_pkcs_silc_decode_identifier(const char *identifier, SilcPublicKeyIdentifier ident); +/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_public_key_version + * + * SYNOPSIS + * + * int silc_pkcs_silc_public_key_version(SilcPublicKey public_key); + * + * DESCRIPTION + * + * Returns the verison of the SILC Public Key indicated by `public_key'. + * Returns -1 if the `public_key' is not a SILC Public Key and the + * version number otherwise. + * + ***/ +int silc_pkcs_silc_public_key_version(SilcPublicKey public_key); + #endif /* SILCPK_H */