support of encrypted private key files

This commit is contained in:
Andreas Steffen
2006-09-20 05:48:54 +00:00
parent 833a7cbc50
commit 490d267ac3
7 changed files with 61 additions and 28 deletions
+1 -1
View File
@@ -518,7 +518,7 @@ crl_t *crl_create_from_file(const char *filename)
chunk_t chunk = CHUNK_INITIALIZER;
crl_t *crl = NULL;
if (!pem_asn1_load_file(filename, "", "crl", &chunk, &pgp))
if (!pem_asn1_load_file(filename, NULL, "crl", &chunk, &pgp))
return NULL;
crl = crl_create_from_chunk(chunk);
@@ -759,7 +759,7 @@ rsa_private_key_t *rsa_private_key_create_from_chunk(chunk_t blob)
/*
* see header
*/
rsa_private_key_t *rsa_private_key_create_from_file(char *filename, char *passphrase)
rsa_private_key_t *rsa_private_key_create_from_file(char *filename, chunk_t *passphrase)
{
bool pgp = FALSE;
chunk_t chunk = CHUNK_INITIALIZER;
@@ -173,7 +173,7 @@ rsa_private_key_t *rsa_private_key_create_from_chunk(chunk_t chunk);
* passphrase is used to decrypt an ecrypted key.
*
* @param filename filename which holds the key
* @param passphrase optional passphase for decryption
* @param passphrase optional passphase for decryption, can be NULL
* @return loaded rsa_private_key_t, or NULL
*
* @todo Implement PEM file loading
@@ -181,6 +181,6 @@ rsa_private_key_t *rsa_private_key_create_from_chunk(chunk_t chunk);
*
* @ingroup rsa
*/
rsa_private_key_t *rsa_private_key_create_from_file(char *filename, char *passphrase);
rsa_private_key_t *rsa_private_key_create_from_file(char *filename, chunk_t *passphrase);
#endif /*RSA_PRIVATE_KEY_H_*/
@@ -488,7 +488,7 @@ rsa_public_key_t *rsa_public_key_create_from_file(char *filename)
chunk_t chunk = CHUNK_INITIALIZER;
rsa_public_key_t *pubkey = NULL;
if (!pem_asn1_load_file(filename, "", "public key", &chunk, &pgp))
if (!pem_asn1_load_file(filename, NULL, "public key", &chunk, &pgp))
return NULL;
pubkey = rsa_public_key_create_from_chunk(chunk);
+1 -1
View File
@@ -1268,7 +1268,7 @@ x509_t *x509_create_from_file(const char *filename, const char *label)
chunk_t chunk = CHUNK_INITIALIZER;
x509_t *cert = NULL;
if (!pem_asn1_load_file(filename, "", label, &chunk, &pgp))
if (!pem_asn1_load_file(filename, NULL, label, &chunk, &pgp))
return NULL;
cert = x509_create_from_chunk(chunk);