Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
a2424a04
Commit
a2424a04
authored
Dec 01, 2014
by
Manuel Pégourié-Gonnard
Browse files
PKCS8 encrypted key depend on PKCS5 or PKCS12
parent
92471fb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
library/pkparse.c
library/pkparse.c
+6
-0
No files found.
library/pkparse.c
View file @
a2424a04
...
...
@@ -924,6 +924,7 @@ static int pk_parse_key_pkcs8_unencrypted_der(
/*
* Parse an encrypted PKCS#8 encoded private key
*/
#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C)
static
int
pk_parse_key_pkcs8_encrypted_der
(
pk_context
*
pk
,
const
unsigned
char
*
key
,
size_t
keylen
,
...
...
@@ -1041,6 +1042,7 @@ static int pk_parse_key_pkcs8_encrypted_der(
return
(
pk_parse_key_pkcs8_unencrypted_der
(
pk
,
buf
,
len
)
);
}
#endif
/* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */
/*
* Parse a private key
...
...
@@ -1132,6 +1134,7 @@ int pk_parse_key( pk_context *pk,
else
if
(
ret
!=
POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT
)
return
(
ret
);
#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C)
ret
=
pem_read_buffer
(
&
pem
,
"-----BEGIN ENCRYPTED PRIVATE KEY-----"
,
"-----END ENCRYPTED PRIVATE KEY-----"
,
...
...
@@ -1150,6 +1153,7 @@ int pk_parse_key( pk_context *pk,
}
else
if
(
ret
!=
POLARSSL_ERR_PEM_NO_HEADER_FOOTER_PRESENT
)
return
(
ret
);
#endif
/* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */
#else
((
void
)
pwd
);
((
void
)
pwdlen
);
...
...
@@ -1162,6 +1166,7 @@ int pk_parse_key( pk_context *pk,
* We try the different DER format parsers to see if one passes without
* error
*/
#if defined(POLARSSL_PKCS12_C) || defined(POLARSSL_PKCS5_C)
if
(
(
ret
=
pk_parse_key_pkcs8_encrypted_der
(
pk
,
key
,
keylen
,
pwd
,
pwdlen
)
)
==
0
)
{
...
...
@@ -1174,6 +1179,7 @@ int pk_parse_key( pk_context *pk,
{
return
(
ret
);
}
#endif
/* POLARSSL_PKCS12_C || POLARSSL_PKCS5_C */
if
(
(
ret
=
pk_parse_key_pkcs8_unencrypted_der
(
pk
,
key
,
keylen
)
)
==
0
)
return
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment