silc_pkcs_get_* functions to work with both public and private key. silc_pkcs_get_...
authorPekka Riikonen <priikone@silcnet.org>
Wed, 5 Jul 2006 10:51:04 +0000 (10:51 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 5 Jul 2006 10:51:04 +0000 (10:51 +0000)
lib/silccrypt/silcpk.h
lib/silccrypt/silcpkcs.c
lib/silccrypt/silcpkcs.h

index 3db2cf2f14d321a69402da71d9c963f0100adadb..d704b7ddf3aae6bbac343166f8f14c96553136c3 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2006 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
@@ -71,7 +71,7 @@ typedef struct {
 typedef struct {
   SilcPublicKeyIdentifierStruct identifier;
   const SilcPKCSAlgorithm *pkcs;   /* PKCS algorithm */
-  void *public_key;               /* MPKCS algorithm specific public key */
+  void *public_key;               /* PKCS algorithm specific public key */
 } *SilcSILCPublicKey;
 /***/
 
@@ -101,6 +101,7 @@ typedef struct {
  *    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)
index baf042be51372bd5fc78749e49e597f771ec4123..ebf8bbda6c52d0c6c48fbf1f72c691e013a20939 100644 (file)
@@ -419,30 +419,33 @@ const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
 
 /* Returns PKCS context */
 
-const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPublicKey public_key)
+const SilcPKCSObject *silc_pkcs_get_pkcs(void *key)
 {
+  SilcPublicKey public_key = key;
   return public_key->pkcs;
 }
 
 /* Returns PKCS algorithm context */
 
-const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(SilcPublicKey public_key)
+const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key)
 {
+  SilcPublicKey public_key = key;
   return public_key->pkcs->get_algorithm(public_key->public_key);
 }
 
 /* Return algorithm name */
 
-const char *silc_pkcs_get_name(SilcPublicKey public_key)
+const char *silc_pkcs_get_name(void *key)
 {
-  const SilcPKCSAlgorithm *pkcs = silc_pkcs_get_algorithm(public_key);
+  const SilcPKCSAlgorithm *pkcs = silc_pkcs_get_algorithm(key);
   return pkcs->name;
 }
 
 /* Returns PKCS type */
 
-SilcPKCSType silc_pkcs_get_type(SilcPublicKey public_key)
+SilcPKCSType silc_pkcs_get_type(void *key)
 {
+  SilcPublicKey public_key = key;
   return public_key->pkcs->type;
 }
 
index b18747fbd1c28892e47d08d8ed485a988743901b..c6a915c9a812607397bebdca5481dc2d15f54fcb 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 Pekka Riikonen
+  Copyright (C) 1997 - 2006 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
@@ -429,53 +429,57 @@ const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
  *
  * SYNOPSIS
  *
- *    const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPublicKey public_key);
+ *    const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
  *
  * DESCRIPTION
  *
- *    Returns the PKCS object from `public_key'.
+ *    Returns the PKCS object from `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
  *
  ***/
-const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPublicKey public_key);
+const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_algorithm
  *
  * SYNOPSIS
  *
- *    const SilcPKCSObject *silc_pkcs_get_algorithm(SilcPublicKey public_key);
+ *    const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
  *
  * DESCRIPTION
  *
- *    Returns the PKCS algorithm object from `public_key'.
+ *    Returns the PKCS algorithm object from `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
  *
  ***/
-const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(SilcPublicKey public_key);
+const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_name
  *
  * SYNOPSIS
  *
- *    const char *silc_pkcs_get_name(SilcPublicKey public_key)
+ *    const char *silc_pkcs_get_name(void *key);
  *
  * DESCRIPTION
  *
- *    Returns PKCS algorithm name from the public key.
+ *    Returns PKCS algorithm name from the `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
  *
  ***/
-const char *silc_pkcs_get_name(SilcPublicKey public_key);
+const char *silc_pkcs_get_name(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_type
  *
  * SYNOPSIS
  *
- *    SilcPKCSType silc_pkcs_get_type(SilcPublicKey public_key);
+ *    SilcPKCSType silc_pkcs_get_type(void *key);
  *
  * DESCRIPTION
  *
- *    Returns PKCS type from the public key.
+ *    Returns PKCS type from the `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
  *
  ***/
-SilcPKCSType silc_pkcs_get_type(SilcPublicKey public_key);
+SilcPKCSType silc_pkcs_get_type(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_context
  *