aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test/ssl_test_lib.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-10-19 10:08:25 +0200
committerIngela Anderton Andin <[email protected]>2011-11-01 16:54:41 +0100
commit1564b5853f286c97a7c9e1d6715d3c6f10bea50f (patch)
treeb28f6c1ba414a4747f8c8d52d80783e266fa9d5a /lib/ssl/test/ssl_test_lib.erl
parentb211df3a0cca478822d57836dac3dd6452aab32a (diff)
downloadotp-1564b5853f286c97a7c9e1d6715d3c6f10bea50f.tar.gz
otp-1564b5853f286c97a7c9e1d6715d3c6f10bea50f.tar.bz2
otp-1564b5853f286c97a7c9e1d6715d3c6f10bea50f.zip
Added PKCS-8 support in ssl
Diffstat (limited to 'lib/ssl/test/ssl_test_lib.erl')
-rw-r--r--lib/ssl/test/ssl_test_lib.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index b7916b96eb..46a8112a41 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -22,6 +22,7 @@
-include("test_server.hrl").
-include("test_server_line.hrl").
+-include_lib("public_key/include/public_key.hrl").
%% Note: This directive should only be used in test suites.
-compile(export_all).
@@ -673,3 +674,16 @@ cipher_result(Socket, Result) ->
session_info_result(Socket) ->
ssl:session_info(Socket).
+
+
+public_key(#'PrivateKeyInfo'{privateKeyAlgorithm =
+ #'PrivateKeyInfo_privateKeyAlgorithm'{algorithm = ?rsaEncryption},
+ privateKey = Key}) ->
+ public_key:der_decode('RSAPrivateKey', iolist_to_binary(Key));
+
+public_key(#'PrivateKeyInfo'{privateKeyAlgorithm =
+ #'PrivateKeyInfo_privateKeyAlgorithm'{algorithm = ?'id-dsa'},
+ privateKey = Key}) ->
+ public_key:der_decode('DSAPrivateKey', iolist_to_binary(Key));
+public_key(Key) ->
+ Key.