aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/src/public_key.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-10-13 09:21:02 +0200
committerHans Nilsson <[email protected]>2015-10-16 12:38:25 +0200
commit01d1e4dc9a6e7ea958683ab419dea38bf576a39f (patch)
treee61b19cd3e59a2f71f8060fd23b569d1f0480eaa /lib/public_key/src/public_key.erl
parentba49561cf3e2167acd5457de93b05e772f2fb16a (diff)
downloadotp-01d1e4dc9a6e7ea958683ab419dea38bf576a39f.tar.gz
otp-01d1e4dc9a6e7ea958683ab419dea38bf576a39f.tar.bz2
otp-01d1e4dc9a6e7ea958683ab419dea38bf576a39f.zip
ssh, public_key: Change EC Public Key representation to what was intended
Diffstat (limited to 'lib/public_key/src/public_key.erl')
-rw-r--r--lib/public_key/src/public_key.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index 2f4cc64c2a..2b04b3f79b 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -47,6 +47,7 @@
pkix_normalize_name/1,
pkix_path_validation/3,
ssh_decode/2, ssh_encode/2,
+ ssh_curvename2oid/1, oid2ssh_curvename/1,
pkix_crls_validate/3,
pkix_dist_point/1,
pkix_dist_points/1,
@@ -742,6 +743,21 @@ ssh_encode(Entries, Type) when is_list(Entries),
pubkey_ssh:encode(Entries, Type).
%%--------------------------------------------------------------------
+%% Description: Converts from the ssh name of elliptic curves to
+%% the OIDs.
+%%--------------------------------------------------------------------
+ssh_curvename2oid(<<"nistp256">>) -> ?'secp256r1';
+ssh_curvename2oid(<<"nistp384">>) -> ?'secp384r1';
+ssh_curvename2oid(<<"nistp521">>) -> ?'secp521r1'.
+
+%%--------------------------------------------------------------------
+%% Description: Converts from elliptic curve OIDs to the ssh name.
+%%--------------------------------------------------------------------
+oid2ssh_curvename(?'secp256r1') -> <<"nistp256">>;
+oid2ssh_curvename(?'secp384r1') -> <<"nistp384">>;
+oid2ssh_curvename(?'secp521r1') -> <<"nistp521">>.
+
+%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
do_verify(DigestOrPlainText, DigestType, Signature,