support of encrypted private key files
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user