aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-10-15 10:25:19 +0200
committerHans Nilsson <[email protected]>2015-10-16 12:38:26 +0200
commit255f36937752404038f32ca67f438f13ef8ce4fb (patch)
tree128252118da785bc31b613e676bad0cd541775aa /lib/public_key
parent19eec0552c6b4e5024e307d2376c061665007e4f (diff)
downloadotp-255f36937752404038f32ca67f438f13ef8ce4fb.tar.gz
otp-255f36937752404038f32ca67f438f13ef8ce4fb.tar.bz2
otp-255f36937752404038f32ca67f438f13ef8ce4fb.zip
public_key: add/update -spec for ssh functions
Diffstat (limited to 'lib/public_key')
-rw-r--r--lib/public_key/src/pubkey_ssh.erl8
-rw-r--r--lib/public_key/src/public_key.erl14
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/public_key/src/pubkey_ssh.erl b/lib/public_key/src/pubkey_ssh.erl
index ba67abb4eb..82042550a0 100644
--- a/lib/public_key/src/pubkey_ssh.erl
+++ b/lib/public_key/src/pubkey_ssh.erl
@@ -41,7 +41,9 @@
%%--------------------------------------------------------------------
-spec decode(binary(), public_key | public_key:ssh_file()) ->
- [{public_key:public_key(), Attributes::list()}].
+ [{public_key:public_key(), Attributes::list()}]
+ ; (binary(), ssh2_pubkey) -> public_key:public_key()
+ .
%%
%% Description: Decodes a ssh file-binary.
%%--------------------------------------------------------------------
@@ -61,7 +63,9 @@ decode(Bin, Type) ->
%%--------------------------------------------------------------------
-spec encode([{public_key:public_key(), Attributes::list()}], public_key:ssh_file()) ->
- binary().
+ binary()
+ ; (public_key:public_key(), ssh2_pubkey) -> binary()
+ .
%%
%% Description: Encodes a list of ssh file entries.
%%--------------------------------------------------------------------
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index 941ade3dd7..8288f68f7f 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -712,7 +712,9 @@ pkix_crls_validate(OtpCert, DPAndCRLs0, Options) ->
%%--------------------------------------------------------------------
--spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}].
+-spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}]
+ ; (binary(), ssh2_pubkey) -> public_key()
+ .
%%
%% Description: Decodes a ssh file-binary. In the case of know_hosts
%% or auth_keys the binary may include one or more lines of the
@@ -730,8 +732,10 @@ ssh_decode(SshBin, Type) when is_binary(SshBin),
pubkey_ssh:decode(SshBin, Type).
%%--------------------------------------------------------------------
--spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) ->
- binary().
+-spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) -> binary()
+ ; (public_key(), ssh2_pubkey) -> binary()
+ .
+%%
%% Description: Encodes a list of ssh file entries (public keys and
%% attributes) to a binary. Possible attributes depends on the file
%% type.
@@ -745,6 +749,8 @@ ssh_encode(Entries, Type) when is_list(Entries),
pubkey_ssh:encode(Entries, Type).
%%--------------------------------------------------------------------
+-spec ssh_curvename2oid(binary()) -> oid().
+
%% Description: Converts from the ssh name of elliptic curves to
%% the OIDs.
%%--------------------------------------------------------------------
@@ -753,6 +759,8 @@ ssh_curvename2oid(<<"nistp384">>) -> ?'secp384r1';
ssh_curvename2oid(<<"nistp521">>) -> ?'secp521r1'.
%%--------------------------------------------------------------------
+-spec oid2ssh_curvename(oid()) -> binary().
+
%% Description: Converts from elliptic curve OIDs to the ssh name.
%%--------------------------------------------------------------------
oid2ssh_curvename(?'secp256r1') -> <<"nistp256">>;