aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/src
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2012-11-13 16:19:18 +0100
committerIngela Anderton Andin <[email protected]>2012-11-15 14:02:00 +0100
commit689b6c5bacf0d7f89c7f3de028627753ad5a1438 (patch)
treeb2d639311e8a1036340fab2dc9a3fdd747fb07ce /lib/public_key/src
parent067aef311309ad751ddeb9c40169b25c0dd1b72c (diff)
downloadotp-689b6c5bacf0d7f89c7f3de028627753ad5a1438.tar.gz
otp-689b6c5bacf0d7f89c7f3de028627753ad5a1438.tar.bz2
otp-689b6c5bacf0d7f89c7f3de028627753ad5a1438.zip
public_key: Added PKCS-10
Diffstat (limited to 'lib/public_key/src')
-rw-r--r--lib/public_key/src/pubkey_pem.erl8
-rw-r--r--lib/public_key/src/public_key.erl4
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/public_key/src/pubkey_pem.erl b/lib/public_key/src/pubkey_pem.erl
index f51d59a789..15290387ff 100644
--- a/lib/public_key/src/pubkey_pem.erl
+++ b/lib/public_key/src/pubkey_pem.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -195,6 +195,8 @@ pem_start('DSAPrivateKey') ->
<<"-----BEGIN DSA PRIVATE KEY-----">>;
pem_start('DHParameter') ->
<<"-----BEGIN DH PARAMETERS-----">>;
+pem_start('CertificationRequest') ->
+ <<"-----BEGIN CERTIFICATE REQUEST-----">>;
pem_start('ContentInfo') ->
<<"-----BEGIN PKCS7-----">>.
@@ -214,6 +216,8 @@ pem_end(<<"-----BEGIN PRIVATE KEY-----">>) ->
<<"-----END PRIVATE KEY-----">>;
pem_end(<<"-----BEGIN ENCRYPTED PRIVATE KEY-----">>) ->
<<"-----END ENCRYPTED PRIVATE KEY-----">>;
+pem_end(<<"-----BEGIN CERTIFICATE REQUEST-----">>) ->
+ <<"-----END CERTIFICATE REQUEST-----">>;
pem_end(<<"-----BEGIN PKCS7-----">>) ->
<<"-----END PKCS7-----">>.
@@ -233,6 +237,8 @@ asn1_type(<<"-----BEGIN PRIVATE KEY-----">>) ->
'PrivateKeyInfo';
asn1_type(<<"-----BEGIN ENCRYPTED PRIVATE KEY-----">>) ->
'EncryptedPrivateKeyInfo';
+asn1_type(<<"-----BEGIN CERTIFICATE REQUEST-----">>) ->
+ 'CertificationRequest';
asn1_type(<<"-----BEGIN PKCS7-----">>) ->
'ContentInfo'.
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index d5df53e848..f7252d18a6 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -176,7 +176,9 @@ der_decode(Asn1Type, Der) when is_atom(Asn1Type), is_binary(Der) ->
%% Description: Encodes a public key entity with asn1 DER encoding.
%%--------------------------------------------------------------------
der_encode(Asn1Type, Entity) when (Asn1Type == 'PrivateKeyInfo') or
- (Asn1Type == 'EncryptedPrivateKeyInfo') ->
+ (Asn1Type == 'EncryptedPrivateKeyInfo') or
+ (Asn1Type == 'CertificationRequest')
+ ->
try
{ok, Encoded} = 'PKCS-FRAME':encode(Asn1Type, Entity),
iolist_to_binary(Encoded)