aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2011-02-17 11:45:43 +0100
committerIngela Anderton Andin <[email protected]>2011-02-17 11:45:43 +0100
commit783569035cbb5ed848a930435d99c4a3167a70aa (patch)
treeb7cbff76427abb9954b077d5559a9396bb0ef748
parent1ec3f9518d94989a0596e5e8aa62d3ce48d89101 (diff)
parent397d9f598aaa1f84706f45565b0f347eea502820 (diff)
downloadotp-783569035cbb5ed848a930435d99c4a3167a70aa.tar.gz
otp-783569035cbb5ed848a930435d99c4a3167a70aa.tar.bz2
otp-783569035cbb5ed848a930435d99c4a3167a70aa.zip
Merge branch 'ia/public_key/test-suite-error' into dev
* ia/public_key/test-suite-error: Strip new lines at end of PEM entry when comparing as it may be more than one
-rw-r--r--lib/public_key/test/public_key_SUITE.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl
index e74ff8051d..185618e58e 100644
--- a/lib/public_key/test/public_key_SUITE.erl
+++ b/lib/public_key/test/public_key_SUITE.erl
@@ -146,7 +146,8 @@ pk_decode_encode(Config) when is_list(Config) ->
DSAPubKey = public_key:pem_entry_decode(PubEntry0),
true = check_entry_type(DSAPubKey, 'DSAPublicKey'),
PubEntry0 = public_key:pem_entry_encode('SubjectPublicKeyInfo', DSAPubKey),
- DSAPubPem = public_key:pem_encode([PubEntry0]),
+ DSAPubPemNoEndNewLines = strip_ending_newlines(DSAPubPem),
+ DSAPubPemEndNoNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry0])),
[{'RSAPrivateKey', DerRSAKey, not_encrypted} = Entry1 ] =
erl_make_certs:pem_to_der(filename:join(Datadir, "client_key.pem")),
@@ -167,13 +168,15 @@ pk_decode_encode(Config) when is_list(Config) ->
RSAPubKey = public_key:pem_entry_decode(PubEntry1),
true = check_entry_type(RSAPubKey, 'RSAPublicKey'),
PubEntry1 = public_key:pem_entry_encode('SubjectPublicKeyInfo', RSAPubKey),
- RSAPubPem = public_key:pem_encode([PubEntry1]),
+ RSAPubPemNoEndNewLines = strip_ending_newlines(RSAPubPem),
+ RSAPubPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry1])),
{ok, RSARawPem} = file:read_file(filename:join(Datadir, "rsa_pub_key.pem")),
[{'RSAPublicKey', _, _} = PubEntry2] =
public_key:pem_decode(RSARawPem),
RSAPubKey = public_key:pem_entry_decode(PubEntry2),
- RSARawPem = public_key:pem_encode([PubEntry2]),
+ RSARawPemNoEndNewLines = strip_ending_newlines(RSARawPem),
+ RSARawPemNoEndNewLines = strip_ending_newlines(public_key:pem_encode([PubEntry2])),
Salt0 = crypto:rand_bytes(8),
Entry3 = public_key:pem_entry_encode('RSAPrivateKey', RSAKey0,
@@ -464,3 +467,6 @@ check_entry_type(#'Certificate'{}, 'Certificate') ->
true;
check_entry_type(_,_) ->
false.
+
+strip_ending_newlines(Bin) ->
+ string:strip(binary_to_list(Bin), right, 10).