5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2002 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
23 /****h* silccrypt/SILC PKCS Interface
27 * This is the interface for public key cryptosystems, and various
28 * utility functions related to public keys and private keys. This
29 * interface also defines the actual PKCS objects, public keys and
30 * private keys. The interface is generic PKCS interface, which has
31 * capability of supporting any kind of public key algorithm. This
32 * interface also implements the SILC Public Key and routines for
33 * encoding and decoding SILC Public Key (as defined by the SILC
34 * protocol specification). Interface or encrypting, decrypting,
35 * producing digital signatures and verifying digital signatures are
36 * also defined in this header.
40 /****s* silccrypt/SilcPKCSAPI/SilcPKCS
44 * typedef struct SilcPKCSStruct *SilcPKCS;
48 * This context is the actual PKCS context and is allocated
49 * by silc_pkcs_alloc and given as argument usually to all
50 * silc_pkcs _* functions. It is freed by the silc_pkcs_free
54 typedef struct SilcPKCSStruct *SilcPKCS;
56 /* The default SILC PKCS (Public Key Cryptosystem) object to represent
58 typedef struct SilcPKCSObjectStruct {
60 int (*init)(void *, SilcUInt32, SilcRng);
61 void (*clear_keys)(void *);
62 unsigned char *(*get_public_key)(void *, SilcUInt32 *);
63 unsigned char *(*get_private_key)(void *, SilcUInt32 *);
64 SilcUInt32 (*set_public_key)(void *, unsigned char *, SilcUInt32);
65 SilcUInt32 (*set_private_key)(void *, unsigned char *, SilcUInt32);
66 SilcUInt32 (*context_len)();
67 int (*encrypt)(void *, unsigned char *, SilcUInt32,
68 unsigned char *, SilcUInt32 *);
69 int (*decrypt)(void *, unsigned char *, SilcUInt32,
70 unsigned char *, SilcUInt32 *);
71 int (*sign)(void *, unsigned char *, SilcUInt32,
72 unsigned char *, SilcUInt32 *);
73 int (*verify)(void *, unsigned char *, SilcUInt32,
74 unsigned char *, SilcUInt32);
77 /****s* silccrypt/SilcPKCSAPI/SilcPublicKey
81 * typedef struct { ... } *SilcPublicKey;
85 * SILC style public key object. Public key is read from file to this
86 * object. Public keys received from network must be in this format as
87 * well. The format is defined by the SILC protocol specification.
88 * This object is allocated by silc_pkcs_public_key_alloc and freed
89 * by silc_pkcs_public_key_free. The object is given as argument to
90 * all silc_pkcs_public_key_* functions.
103 /****s* silccrypt/SilcPKCSAPI/SilcPublicKeyIdentifier
107 * typedef struct { ... } *SilcPublicKeyIdentifier;
111 * Decoded SILC Public Key identifier. Note that some of the fields
112 * may be NULL. This context is allcated by the function
113 * silc_pkcs_decode_identifier and freed by silc_pkcs_free_identifier.
114 * The identifier in SilcPublicKey is the 'identifier' field, which
115 * can be given as argument to silc_pkcs_decode_identifier.
126 } *SilcPublicKeyIdentifier;
129 /****s* silccrypt/SilcPKCSAPI/SilcPrivateKey
133 * typedef struct { ... } *SilcPrivateKey;
137 * SILC style private key object. Public key is read from file to this
138 * object. This object is allocated by silc_pkcs_private_key_alloc and
139 * freed by silc_pkcs_private_key_free. The object is given as argument
140 * to all silc_pkcs_private_key_* functions.
149 /* Public and private key file headers */
150 #define SILC_PKCS_PUBLIC_KEYFILE_BEGIN "-----BEGIN SILC PUBLIC KEY-----\n"
151 #define SILC_PKCS_PUBLIC_KEYFILE_END "\n-----END SILC PUBLIC KEY-----\n"
152 #define SILC_PKCS_PRIVATE_KEYFILE_BEGIN "-----BEGIN SILC PRIVATE KEY-----\n"
153 #define SILC_PKCS_PRIVATE_KEYFILE_END "\n-----END SILC PRIVATE KEY-----\n"
155 /* Public and private key file encoding types */
156 #define SILC_PKCS_FILE_BIN 0
157 #define SILC_PKCS_FILE_PEM 1
159 /* Marks for all PKCS in silc. This can be used in silc_pkcs_unregister
160 to unregister all PKCS at once. */
161 #define SILC_ALL_PKCS ((SilcPKCSObject *)1)
163 /* Static list of PKCS for silc_pkcs_register_default(). */
164 extern DLLAPI const SilcPKCSObject silc_default_pkcs[];
166 /* Default PKXS in the SILC protocol */
167 #define SILC_DEFAULT_PKCS "rsa"
171 /* Macros used to implement the SILC PKCS API */
173 /* XXX: This needs slight redesigning. These needs to be made even
174 more generic. I don't like that the actual prime generation is done
175 in PKCS_API_INIT. The primes used in key generation should be sent
176 as argument to the init function. By doing this we would achieve
177 that PKCS could be used as SIM's. The only requirement would be
178 that they are compiled against GMP (well, actually even that would
179 not be a requirement, but the most generic case anyway). The new init
180 would look something like this:
182 #define SILC_PKCS_API_INIT(pkcs) \
183 inline int silc_##pkcs##_init(void *context, SilcUInt32 keylen, \
186 Now we wouldn't have to send the SilcRng object since the primes are
187 provided as arguments. To send them as void * they could actually be
188 used as in anyway for real (MP_INT (SilcMPInt) or even something else
189 (the pointer could be kludged to be something else in the module))
190 (Plus, the SilcRng object management in prime generation would be
191 simpler and better what it is now (in silcprimegen.c, that is)).
194 #define SILC_PKCS_API_INIT(pkcs) \
195 int silc_##pkcs##_init(void *context, SilcUInt32 keylen, \
197 #define SILC_PKCS_API_CLEAR_KEYS(pkcs) \
198 void silc_##pkcs##_clear_keys(void *context)
199 #define SILC_PKCS_API_GET_PUBLIC_KEY(pkcs) \
200 unsigned char *silc_##pkcs##_get_public_key(void *context, \
202 #define SILC_PKCS_API_GET_PRIVATE_KEY(pkcs) \
203 unsigned char *silc_##pkcs##_get_private_key(void *context, \
205 #define SILC_PKCS_API_SET_PUBLIC_KEY(pkcs) \
206 SilcUInt32 silc_##pkcs##_set_public_key(void *context, unsigned char *key_data, \
208 #define SILC_PKCS_API_SET_PRIVATE_KEY(pkcs) \
209 SilcUInt32 silc_##pkcs##_set_private_key(void *context, unsigned char *key_data, \
211 #define SILC_PKCS_API_CONTEXT_LEN(pkcs) \
212 SilcUInt32 silc_##pkcs##_context_len()
213 #define SILC_PKCS_API_ENCRYPT(pkcs) \
214 int silc_##pkcs##_encrypt(void *context, \
215 unsigned char *src, \
216 SilcUInt32 src_len, \
217 unsigned char *dst, \
219 #define SILC_PKCS_API_DECRYPT(pkcs) \
220 int silc_##pkcs##_decrypt(void *context, \
221 unsigned char *src, \
222 SilcUInt32 src_len, \
223 unsigned char *dst, \
225 #define SILC_PKCS_API_SIGN(pkcs) \
226 int silc_##pkcs##_sign(void *context, \
227 unsigned char *src, \
228 SilcUInt32 src_len, \
229 unsigned char *dst, \
231 #define SILC_PKCS_API_VERIFY(pkcs) \
232 int silc_##pkcs##_verify(void *context, \
233 unsigned char *signature, \
234 SilcUInt32 signature_len, \
235 unsigned char *data, \
240 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_register
244 * bool silc_pkcs_register(const SilcPKCSObject *pkcs);
248 * Registers a new PKCS into the SILC. This function is used
249 * at the initialization of the SILC. All registered PKCSs
250 * should be unregistered with silc_pkcs_unregister. The `pkcs' includes
251 * the name of the PKCS and member functions for the algorithm. Usually
252 * this function is not called directly. Instead, application can call
253 * the silc_pkcs_register_default to register all PKCSs that are
254 * builtin the sources. Returns FALSE on error.
257 bool silc_pkcs_register(const SilcPKCSObject *pkcs);
259 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_unregister
263 * bool silc_pkcs_unregister(SilcPKCSObject *pkcs);
267 * Unregister a PKCS from the SILC. Returns FALSE on error.
270 bool silc_pkcs_unregister(SilcPKCSObject *pkcs);
272 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_register_default
276 * bool silc_pkcs_register_default(void);
280 * Registers all the default PKCS (all builtin PKCS). The application may
281 * use this to register the default PKCS if specific PKCS in any specific
282 * order is not wanted. Returns FALSE on error.
285 bool silc_pkcs_register_default(void);
287 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_unregister_all
291 * bool silc_pkcs_unregister_all(void);
295 * Returns FALSE on error.
298 bool silc_pkcs_unregister_all(void);
300 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_alloc
304 * bool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
308 * Allocates a new SilcPKCS object. The new allocated object is returned
309 * to the 'new_pkcs' argument. Returns FALSE on error.
312 bool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
314 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_free
318 * void silc_pkcs_free(SilcPKCS pkcs);
322 * Frees the PKCS object.
325 void silc_pkcs_free(SilcPKCS pkcs);
327 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_is_supported
331 * bool silc_pkcs_is_supported(const unsigned char *name);
335 * Returns TRUE if PKCS algorithm `name' is supported.
338 bool silc_pkcs_is_supported(const unsigned char *name);
340 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_supported
344 * char *silc_pkcs_get_supported(void);
348 * Returns comma separated list of supported PKCS algorithms.
351 char *silc_pkcs_get_supported(void);
353 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_generate_key
357 * bool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
362 * Generate new key pair into the `pkcs' context. Returns FALSE on error.
365 bool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
368 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_key_len
372 * SilcUInt32 silc_pkcs_get_key_len(SilcPKCS self);
376 * Returns the length of the key.
379 SilcUInt32 silc_pkcs_get_key_len(SilcPKCS self);
381 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_name
385 * const char *silc_pkcs_get_name(SilcPKCS pkcs);
392 const char *silc_pkcs_get_name(SilcPKCS pkcs);
394 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_public_key
398 * unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, SilcUInt32 *len);
402 * Returns SILC style public key. The caller must free the returned
406 unsigned char *silc_pkcs_get_public_key(SilcPKCS pkcs, SilcUInt32 *len);
408 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_private_key
412 * unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs,
417 * Returns SILC style private key. The caller must free the returned
418 * data and SHOULD zero the memory area before freeing.
421 unsigned char *silc_pkcs_get_private_key(SilcPKCS pkcs, SilcUInt32 *len);
423 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_set
427 * SilcUInt32 silc_pkcs_public_key_set(SilcPKCS pkcs,
428 * SilcPublicKey public_key);
432 * Sets public key from SilcPublicKey. Returns the length of the key.
435 SilcUInt32 silc_pkcs_public_key_set(SilcPKCS pkcs, SilcPublicKey public_key);
437 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_data_set
441 * SilcUInt32 silc_pkcs_public_key_data_set(SilcPKCS pkcs,
443 * SilcUInt32 pk_len);
447 * Sets public key from data. Returns the length of the key.
450 SilcUInt32 silc_pkcs_public_key_data_set(SilcPKCS pkcs, unsigned char *pk,
453 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_set
457 * SilcUInt32 silc_pkcs_private_key_set(SilcPKCS pkcs,
458 * SilcPrivateKey private_key);
462 * Sets private key from SilcPrivateKey. Returns the length of the key.
465 SilcUInt32 silc_pkcs_private_key_set(SilcPKCS pkcs, SilcPrivateKey private_key);
467 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_data_set
471 * SilcUInt32 silc_pkcs_private_key_data_set(SilcPKCS pkcs,
472 * unsigned char *prv,
473 * SilcUInt32 prv_len);
477 * Sets private key from data. Returns the length of the key.
480 SilcUInt32 silc_pkcs_private_key_data_set(SilcPKCS pkcs, unsigned char *prv,
483 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_encrypt
487 * bool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src,
488 * SilcUInt32 src_len, unsigned char *dst,
489 * SilcUInt32 *dst_len);
493 * Encrypts. Returns FALSE on error.
496 bool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
497 unsigned char *dst, SilcUInt32 *dst_len);
499 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_decrypt
503 * bool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src,
504 * SilcUInt32 src_len, unsigned char *dst,
505 * SilcUInt32 *dst_len);
509 * Decrypts. Returns FALSE on error.
512 bool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
513 unsigned char *dst, SilcUInt32 *dst_len);
515 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_sign
519 * bool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src,
520 * SilcUInt32 src_len, unsigned char *dst,
521 * SilcUInt32 *dst_len);
525 * Generates signature. Returns FALSE on error.
528 bool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
529 unsigned char *dst, SilcUInt32 *dst_len);
531 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_verify
535 * bool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
536 * SilcUInt32 signature_len, unsigned char *data,
537 * SilcUInt32 data_len);
541 * Verifies signature. Returns FALSE on error.
544 bool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
545 SilcUInt32 signature_len, unsigned char *data,
546 SilcUInt32 data_len);
548 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_sign_with_hash
552 * bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
553 * unsigned char *src, SilcUInt32 src_len,
554 * unsigned char *dst, SilcUInt32 *dst_len);
558 * Generates signature with hash. The hash is signed. Returns FALSE on
562 bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
563 unsigned char *src, SilcUInt32 src_len,
564 unsigned char *dst, SilcUInt32 *dst_len);
566 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_verify_with_hash
570 * bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
571 * unsigned char *signature,
572 * SilcUInt32 signature_len,
573 * unsigned char *data,
574 * SilcUInt32 data_len);
578 * Verifies signature with hash. The `data' is hashed and verified against
579 * the `signature'. Returns FALSE on error.
582 bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
583 unsigned char *signature,
584 SilcUInt32 signature_len,
586 SilcUInt32 data_len);
588 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_encode_identifier
592 * char *silc_pkcs_encode_identifier(char *username, char *host,
593 * char *realname, char *email,
594 * char *org, char *country);
598 * Encodes and returns SILC public key identifier. If some of the
599 * arguments is NULL those are not encoded into the identifier string.
600 * Protocol says that at least username and host must be provided.
603 char *silc_pkcs_encode_identifier(char *username, char *host, char *realname,
604 char *email, char *org, char *country);
606 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_decode_identifier
610 * SilcPublicKeyIdentifier silc_pkcs_decode_identifier(char *identifier);
614 * Decodes the provided `identifier' and returns allocated context for
618 SilcPublicKeyIdentifier silc_pkcs_decode_identifier(char *identifier);
620 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_free_identifier
624 * void silc_pkcs_free_identifier(SilcPublicKeyIdentifier identifier);
628 * Frees decoded public key identifier context. Call this to free the
629 * context returned by the silc_pkcs_decode_identifier.
632 void silc_pkcs_free_identifier(SilcPublicKeyIdentifier identifier);
634 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_alloc
638 * SilcPublicKey silc_pkcs_public_key_alloc(const char *name,
639 * const char *identifier,
640 * const unsigned char *pk,
641 * SilcUInt32 pk_len);
645 * Allocates SILC style public key formed from sent arguments. All data
649 SilcPublicKey silc_pkcs_public_key_alloc(const char *name,
650 const char *identifier,
651 const unsigned char *pk,
654 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_free
658 * void silc_pkcs_public_key_free(SilcPublicKey public_key);
665 void silc_pkcs_public_key_free(SilcPublicKey public_key);
667 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_alloc
671 * SilcPrivateKey silc_pkcs_private_key_alloc(const char *name,
672 * const unsigned char *prv,
673 * SilcUInt32 prv_len);
677 * Allocates SILC private key formed from sent arguments. All data is
681 SilcPrivateKey silc_pkcs_private_key_alloc(const char *name,
682 const unsigned char *prv,
685 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_free
689 * void silc_pkcs_private_key_free(SilcPrivateKey private_key);
696 void silc_pkcs_private_key_free(SilcPrivateKey private_key);
698 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_encode
703 * silc_pkcs_public_key_encode(SilcPublicKey public_key, SilcUInt32 *len);
707 * Encodes SILC style public key from SilcPublicKey. Returns the encoded
712 silc_pkcs_public_key_encode(SilcPublicKey public_key, SilcUInt32 *len);
714 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_data_encode
719 * silc_pkcs_public_key_data_encode(unsigned char *pk, SilcUInt32 pk_len,
720 * char *pkcs, char *identifier,
725 * Encodes SILC style public key. Returns the encoded data.
729 silc_pkcs_public_key_data_encode(unsigned char *pk, SilcUInt32 pk_len,
730 char *pkcs, char *identifier,
733 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_decode
737 * bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
738 * SilcPublicKey *public_key);
742 * Decodes SILC style public key. Returns TRUE if the decoding was
743 * successful. Allocates new public key as well.
746 bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
747 SilcPublicKey *public_key);
749 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_compare
753 * bool silc_pkcs_public_key_compare(SilcPublicKey key1,
754 * SilcPublicKey key2);
758 * Compares two public keys and returns TRUE if they are same key, and
759 * FALSE if they are not same.
762 bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2);
764 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_copy
768 * SilcPublicKey silc_pkcs_public_key_copy(SilcPublicKey public_key);
772 * Copies the public key indicated by `public_key' and returns new allocated
773 * public key which is indentical to the `public_key'.
776 SilcPublicKey silc_pkcs_public_key_copy(SilcPublicKey public_key);
778 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_encode
783 * silc_pkcs_private_key_encode(SilcPrivateKey private_key,
788 * Encodes SILC private key from SilcPrivateKey. Returns the encoded data.
792 silc_pkcs_private_key_encode(SilcPrivateKey private_key, SilcUInt32 *len);
794 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_data_encode
799 * silc_pkcs_private_key_data_encode(unsigned char *prv, SilcUInt32 prv_len,
800 * char *pkcs, SilcUInt32 *len);
804 * Encodes SILC private key. Returns the encoded data.
808 silc_pkcs_private_key_data_encode(unsigned char *prv, SilcUInt32 prv_len,
809 char *pkcs, SilcUInt32 *len);
811 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_private_key_decode
815 * bool silc_pkcs_private_key_decode(unsigned char *data,
816 * SilcUInt32 data_len,
817 * SilcPrivateKey *private_key);
821 * Decodes SILC style private key. Returns TRUE if the decoding was
822 * successful. Allocates new private key as well.
825 bool silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
826 SilcPrivateKey *private_key);
828 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_public_key
832 * bool silc_pkcs_save_public_key(char *filename, SilcPublicKey public_key,
833 * SilcUInt32 encoding);
837 * Saves public key into file. Returns FALSE on error.
840 bool silc_pkcs_save_public_key(char *filename, SilcPublicKey public_key,
841 SilcUInt32 encoding);
843 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_public_key_data
847 * bool silc_pkcs_save_public_key_data(char *filename, unsigned char *data,
848 * SilcUInt32 data_len,
849 * SilcUInt32 encoding);
853 * Saves public key into file. Returns FALSE on error.
856 bool silc_pkcs_save_public_key_data(char *filename, unsigned char *data,
858 SilcUInt32 encoding);
860 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_private_key
864 * bool silc_pkcs_save_private_key(char *filename,
865 * SilcPrivateKey private_key,
866 * unsigned char *passphrase,
867 * SilcUInt32 encoding);
871 * Saves private key into file. Returns FALSE on error.
874 bool silc_pkcs_save_private_key(char *filename, SilcPrivateKey private_key,
875 unsigned char *passphrase,
876 SilcUInt32 encoding);
878 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_private_key_data
882 * bool silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
883 * SilcUInt32 data_len,
884 * unsigned char *passphrase,
885 * SilcUInt32 encoding);
889 * Saves private key into file. Returns FALSE on error.
892 bool silc_pkcs_save_private_key_data(char *filename, unsigned char *data,
894 unsigned char *passphrase,
895 SilcUInt32 encoding);
897 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_load_public_key
901 * bool silc_pkcs_load_public_key(char *filename, SilcPublicKey *public_key,
902 * SilcUInt32 encoding);
906 * Loads public key from file and allocates new public key. Returns TRUE
907 * if loading was successful.
910 bool silc_pkcs_load_public_key(char *filename, SilcPublicKey *public_key,
911 SilcUInt32 encoding);
913 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_load_private_key
917 * bool silc_pkcs_load_private_key(char *filename,
918 * SilcPrivateKey *private_key,
919 * SilcUInt32 encoding);
923 * Load private key from file and allocates new private key. Returns TRUE
924 * if loading was successful.
927 bool silc_pkcs_load_private_key(char *filename, SilcPrivateKey *private_key,
928 SilcUInt32 encoding);
930 #endif /* SILCPKCS_H */