SILC Crypto Toolkit 1.2 Beta1
[crypto.git] / lib / silccrypt / silcpk.h
index 49b64001fcdd59e985da4a81e6b14d900a2a59c7..2622aef16721a26ae1eeff03dba588efca509c97 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2008 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
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC Public Key Interface
+/****h* silccrypt/SILC Interface
  *
  * DESCRIPTION
  *
@@ -29,7 +29,7 @@
 #ifndef SILCPK_H
 #define SILCPK_H
 
-/****s* silccrypt/SilcPubkeyAPI/SilcPublicKeyIdentifier
+/****s* silccrypt/SilcPublicKeyIdentifier
  *
  * NAME
  *
@@ -43,7 +43,7 @@
  *
  * SOURCE
  */
-typedef struct {
+typedef struct SilcPublicKeyIdentifierObject {
   char *username;
   char *host;
   char *realname;
@@ -54,7 +54,7 @@ typedef struct {
 } *SilcPublicKeyIdentifier, SilcPublicKeyIdentifierStruct;
 /***/
 
-/****s* silccrypt/SilcPubkeyAPI/SilcSILCPublicKey
+/****s* silccrypt/SilcSILCPublicKey
  *
  * NAME
  *
@@ -64,19 +64,19 @@ 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;               /* PKCS algorithm specific public key */
 } *SilcSILCPublicKey;
 /***/
 
-/****s* silccrypt/SilcPubkeyAPI/SilcSILCPrivateKey
+/****s* silccrypt/SilcSILCPrivateKey
  *
  * NAME
  *
@@ -89,13 +89,13 @@ typedef struct {
  *
  * SOURCE
  */
-typedef struct {
+typedef struct SilcSILCPrivateKeyStruct {
   const SilcPKCSAlgorithm *pkcs;   /* PKCS algorithm */
   void *private_key;              /* PKCS algorithm specific private key */
 } *SilcSILCPrivateKey;
 /***/
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_generate_key
+/****f* silccrypt/silc_pkcs_silc_generate_key
  *
  * SYNOPSIS
  *
@@ -109,14 +109,14 @@ typedef struct {
  * DESCRIPTION
  *
  *    Generate a new SILC key pair of the algorithm type `algorithm' with
- *    the key length in bits of `bits_key_len'.  The `scheme' may be NULL.
- *    Returns FALSE if key generation failed.
+ *    the key length in bits of `bits_key_len'.  Returns FALSE if key
+ *    generation failed.
  *
  * EXAMPLE
  *
- *    // Generate RSA key pair with 2048 bit key length, using PKCS #1
- *    // no OID scheme.
- *    silc_pkcs_silc_generate_key("rsa", 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,
@@ -126,7 +126,7 @@ SilcBool silc_pkcs_silc_generate_key(const char *algorithm,
                                     SilcPublicKey *ret_public_key,
                                     SilcPrivateKey *ret_private_key);
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_encode_identifier
+/****f* silccrypt/silc_pkcs_silc_encode_identifier
  *
  * SYNOPSIS
  *
@@ -142,13 +142,16 @@ 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 *version);
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_decode_identifier
+/****f* silccrypt/silc_pkcs_silc_decode_identifier
  *
  * SYNOPSIS
  *
@@ -165,7 +168,7 @@ 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
+/****f* silccrypt/silc_pkcs_silc_public_key_version
  *
  * SYNOPSIS
  *