<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#333333" bgcolor="#FFFFFF">
Hi all,<br>
<br>
I've been trying to read an EC password protected private key in pem
format into Erlang but I've been getting this error:<br>
<br>
{ok, M} = <a class="moz-txt-link-freetext" href="file:read_file(">file:read_file(</a>"m.key"),<br>
[Pem] = public_key:pem_decode(M),<br>
exception error: no function clause matching<br>
pubkey_pbe:cipher({'PBES2-params_encryptionScheme',<br>
{2,16,840,1,101,3,4,1,42},<br>
{asn1_OPENTYPE,<br>
<<4,16,255,71,145,188,80,110,6,134,174,<br>
100,0,176,46,76,243,205>>}}) (pubkey_pbe.erl, line 271)<br>
in function pubkey_pbe:decrypt_parameters/2 (pubkey_pbe.erl, line
185)<br>
in call from pubkey_pem:decode_encrypted_private_keyinfo/1
(pubkey_pem.erl, line 146)<br>
in call from pubkey_pem:decode_pem_entries/2 (pubkey_pem.erl, line
121)<br>
<br>
This is in Erlang 18.0.2, both on MacOS 10.10.4 and Ubuntu 14.04.
OpenSSL is 1.0.1f.<br>
<br>
A sample key in the format that causes the issue is:<br>
<br>
-----BEGIN ENCRYPTED PRIVATE KEY-----<br>
MIHeMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAhIMXJLXX+miQICCAAw<br>
HQYJYIZIAWUDBAEqBBD/R5G8UG4Ghq5kALAuTPPNBIGQSk3UlBws+Y/BiJg5KIyV<br>
IuqsCngm+l10zFNFVrFQNlFQ8+nQHuHYOMXk5UCoqMPkAVD+xSJ1pj00wQiQ85Y5<br>
XS3B9YObYN5iSzFOyTe4S9+qJtW2OI5VQ5gW7xq9LMUKBwJzkpsd9w5lyOgN9/Gt<br>
Meq24+3LkqP8DjB7L5fc9U+1F9+BMoUuE+HiLBy6Sww3<br>
-----END ENCRYPTED PRIVATE KEY-----<br>
<br>
<div class="moz-signature">-- <br>
Panagiotis Papadomitsos<br>
</div>
</body>
</html>