aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-11-01 17:25:19 +0100
committerHans Nilsson <[email protected]>2017-11-10 12:20:31 +0100
commit218ad10d42af1e2b61fc63dd8c7523972e87ad99 (patch)
tree36790a75f837383e1a1fa8a139f570fac5503d63 /lib
parentf5c169e343c62e57c2a640186b1ff77ce7ce8620 (diff)
downloadotp-218ad10d42af1e2b61fc63dd8c7523972e87ad99.tar.gz
otp-218ad10d42af1e2b61fc63dd8c7523972e87ad99.tar.bz2
otp-218ad10d42af1e2b61fc63dd8c7523972e87ad99.zip
crypto: Define and export some types for engine
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/src/crypto.erl21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 90efbc9e9c..7510babdde 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -53,6 +53,11 @@
engine_list/0
]).
+-export_type([engine_ref/0,
+ key_id/0,
+ password/0
+ ]).
+
%% Private. For tests.
-export([packed_openssl_version/4, engine_methods_convert_to_bitmask/2, get_test_engine/0]).
@@ -429,8 +434,18 @@ sign(Algorithm, Type, Data, Key, Options) ->
end.
+
+-type key_id() :: string() | binary() .
+-type password() :: string() | binary() .
+
+-type engine_key_ref() :: #{engine := engine_ref(),
+ key_id := key_id(),
+ password => password(),
+ term() => term()
+ }.
+
-type pk_algs() :: rsa | ecdsa | dss .
--type pk_key() :: map() | [integer() | binary()] .
+-type pk_key() :: engine_key_ref() | [integer() | binary()] .
-type pk_opt() :: list() | rsa_padding() .
-spec public_encrypt(pk_algs(), binary(), pk_key(), pk_opt()) -> binary().
@@ -589,6 +604,8 @@ compute_key(ecdh, Others, My, Curve) ->
engine_method_pkey_meths | engine_method_pkey_asn1_meths |
engine_method_ec.
+-type engine_ref() :: term().
+
-spec engine_get_all_methods() ->
[engine_method_type()].
engine_get_all_methods() ->
@@ -600,7 +617,7 @@ engine_get_all_methods() ->
-spec engine_load(EngineId::unicode:chardata(),
PreCmds::[{unicode:chardata(), unicode:chardata()}],
PostCmds::[{unicode:chardata(), unicode:chardata()}]) ->
- {ok, Engine::term()} | {error, Reason::term()}.
+ {ok, Engine::engine_ref()} | {error, Reason::term()}.
engine_load(EngineId, PreCmds, PostCmds) when is_list(PreCmds), is_list(PostCmds) ->
engine_load(EngineId, PreCmds, PostCmds, engine_get_all_methods()).