Parsing of PKCS#8 encrypted private key files added and PKCS#12 basis
PKCS#8 encrypted key file support has been added to x509parse_key() with
support for some PCKS#12 PBE functions (pbeWithSHAAnd128BitRC4,
pbeWithSHAAnd3-KeyTripleDES-CBC and pbeWithSHAAnd2-KeyTripleDES-CBC)
(cherry picked from commit cf6e95d9a81c7b22271beb58a09b5c756148e62a)
Conflicts:
scripts/generate_errors.pl
diff --git a/library/error.c b/library/error.c
index fe2be91..fec8152 100644
--- a/library/error.c
+++ b/library/error.c
@@ -113,6 +113,10 @@
#include "polarssl/pem.h"
#endif
+#if defined(POLARSSL_PKCS12_C)
+#include "polarssl/pkcs12.h"
+#endif
+
#if defined(POLARSSL_RSA_C)
#include "polarssl/rsa.h"
#endif
@@ -233,6 +237,15 @@
snprintf( buf, buflen, "PEM - Bad input parameters to function" );
#endif /* POLARSSL_PEM_C */
+#if defined(POLARSSL_PKCS12_C)
+ if( use_ret == -(POLARSSL_ERR_PKCS12_BAD_INPUT_DATA) )
+ snprintf( buf, buflen, "PKCS12 - Bad input parameters to function" );
+ if( use_ret == -(POLARSSL_ERR_PKCS12_FEATURE_UNAVAILABLE) )
+ snprintf( buf, buflen, "PKCS12 - Feature not available, e.g. unsupported encryption scheme" );
+ if( use_ret == -(POLARSSL_ERR_PKCS12_PBE_INVALID_FORMAT) )
+ snprintf( buf, buflen, "PKCS12 - PBE ASN.1 data not as expected" );
+#endif /* POLARSSL_PKCS12_C */
+
#if defined(POLARSSL_RSA_C)
if( use_ret == -(POLARSSL_ERR_RSA_BAD_INPUT_DATA) )
snprintf( buf, buflen, "RSA - Bad input parameters to function" );