2015-01-22 03:40:55 +00:00
|
|
|
/*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2001-07-26 22:34:45 +00:00
|
|
|
*
|
2016-05-17 18:52:22 +00:00
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2001-07-26 22:34:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-05-14 14:56:48 +00:00
|
|
|
#include "internal/cryptlib.h"
|
2001-07-26 22:34:45 +00:00
|
|
|
#include <openssl/pkcs12.h>
|
|
|
|
|
2015-01-22 03:40:55 +00:00
|
|
|
PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass,
|
|
|
|
int passlen)
|
2001-07-26 22:34:45 +00:00
|
|
|
{
|
2016-03-10 15:04:46 +00:00
|
|
|
X509_ALGOR *dalg;
|
|
|
|
ASN1_OCTET_STRING *doct;
|
|
|
|
X509_SIG_get0(&dalg, &doct, p8);
|
|
|
|
return PKCS12_item_decrypt_d2i(dalg,
|
2015-01-22 03:40:55 +00:00
|
|
|
ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO), pass,
|
2016-03-10 15:04:46 +00:00
|
|
|
passlen, doct, 1);
|
2001-07-26 22:34:45 +00:00
|
|
|
}
|