aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/src/pubkey_cert_records.erl
diff options
context:
space:
mode:
authorSeth Falcon <[email protected]>2011-01-18 17:34:41 -0800
committerNiclas Axelsson <[email protected]>2011-02-14 17:28:14 +0100
commitc730d2fb0342523fa9014373b234b426bd9ca6f2 (patch)
treeaf8ff4145b1e9b2bd081bb5258cc611302e8c80c /lib/public_key/src/pubkey_cert_records.erl
parent62dad961329a603110ce0e1d3f62554cc5228152 (diff)
downloadotp-c730d2fb0342523fa9014373b234b426bd9ca6f2.tar.gz
otp-c730d2fb0342523fa9014373b234b426bd9ca6f2.tar.bz2
otp-c730d2fb0342523fa9014373b234b426bd9ca6f2.zip
Improved support for RSA and DSA public keys
This patch allows the public_key module to decode and encode RSA and DSA keys encoded using the SubjectPublicKeyInfo format. When pem_entry_encode is called on an RSA or DSA public key type, the key is wrapped in the SubjectPublicKeyInfo format.
Diffstat (limited to 'lib/public_key/src/pubkey_cert_records.erl')
-rw-r--r--lib/public_key/src/pubkey_cert_records.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/public_key/src/pubkey_cert_records.erl b/lib/public_key/src/pubkey_cert_records.erl
index 20b322b4a4..7a387e487c 100644
--- a/lib/public_key/src/pubkey_cert_records.erl
+++ b/lib/public_key/src/pubkey_cert_records.erl
@@ -23,7 +23,7 @@
-include("public_key.hrl").
--export([decode_cert/1, transform/2]).
+-export([decode_cert/1, transform/2, supportedPublicKeyAlgorithms/1]).
%%====================================================================
%% Internal application API
@@ -80,16 +80,24 @@ transform(Other,_) ->
Other.
%%--------------------------------------------------------------------
-%%% Internal functions
+-spec supportedPublicKeyAlgorithms(Oid::tuple()) -> asn1_type().
+%%
+%% Description: Returns the public key type for an algorithm
+%% identifier tuple as found in SubjectPublicKeyInfo.
+%%
%%--------------------------------------------------------------------
-
-%%% SubjectPublicKey
supportedPublicKeyAlgorithms(?'rsaEncryption') -> 'RSAPublicKey';
supportedPublicKeyAlgorithms(?'id-dsa') -> 'DSAPublicKey';
supportedPublicKeyAlgorithms(?'dhpublicnumber') -> 'DHPublicKey';
supportedPublicKeyAlgorithms(?'id-keyExchangeAlgorithm') -> 'KEA-PublicKey';
supportedPublicKeyAlgorithms(?'id-ecPublicKey') -> 'ECPoint'.
+%%--------------------------------------------------------------------
+%%% Internal functions
+%%--------------------------------------------------------------------
+
+%%% SubjectPublicKey
+
decode_supportedPublicKey(#'OTPSubjectPublicKeyInfo'{algorithm= PA =
#'PublicKeyAlgorithm'{algorithm=Algo},
subjectPublicKey = {0,SPK0}}) ->