File tree 3 files changed +14
-8
lines changed
3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change
1
+ Unreleased
2
+ ==========
3
+
4
+ * Remove newline from end of base64 encoded strings, some decoders don't like
5
+ them.
6
+
1
7
1.4.2 / 2020-10-20
2
8
==================
3
9
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def initialize(options = {})
59
59
60
60
if options . has_key? ( :encryption_master_key_base64 )
61
61
@encryption_master_key =
62
- Base64 . decode64 ( options [ :encryption_master_key_base64 ] )
62
+ Base64 . strict_decode64 ( options [ :encryption_master_key_base64 ] )
63
63
end
64
64
65
65
@http_proxy = nil
@@ -148,7 +148,7 @@ def timeout=(value)
148
148
# Set an encryption_master_key to use with private-encrypted channels from
149
149
# a base64 encoded string.
150
150
def encryption_master_key_base64 = ( s )
151
- @encryption_master_key = s ? Base64 . decode64 ( s ) : nil
151
+ @encryption_master_key = s ? Base64 . strict_decode64 ( s ) : nil
152
152
end
153
153
154
154
## INTERACT WITH THE API ##
@@ -483,8 +483,8 @@ def encrypt(channel_name, encoded_data)
483
483
ciphertext = secret_box . encrypt ( nonce , encoded_data )
484
484
485
485
MultiJson . encode ( {
486
- "nonce" => Base64 ::encode64 ( nonce ) ,
487
- "ciphertext" => Base64 ::encode64 ( ciphertext ) ,
486
+ "nonce" => Base64 ::strict_encode64 ( nonce ) ,
487
+ "ciphertext" => Base64 ::strict_encode64 ( ciphertext ) ,
488
488
} )
489
489
end
490
490
Original file line number Diff line number Diff line change 385
385
)
386
386
387
387
expect ( MultiJson . decode ( RbNaCl ::SecretBox . new ( key ) . decrypt (
388
- Base64 . decode64 ( data [ "nonce" ] ) ,
389
- Base64 . decode64 ( data [ "ciphertext" ] ) ,
388
+ Base64 . strict_decode64 ( data [ "nonce" ] ) ,
389
+ Base64 . strict_decode64 ( data [ "ciphertext" ] ) ,
390
390
) ) ) . to eq ( { 'some' => 'data' } )
391
391
}
392
392
end
461
461
)
462
462
463
463
expect ( MultiJson . decode ( RbNaCl ::SecretBox . new ( key ) . decrypt (
464
- Base64 . decode64 ( data [ "nonce" ] ) ,
465
- Base64 . decode64 ( data [ "ciphertext" ] ) ,
464
+ Base64 . strict_decode64 ( data [ "nonce" ] ) ,
465
+ Base64 . strict_decode64 ( data [ "ciphertext" ] ) ,
466
466
) ) ) . to eq ( { 'some' => 'data' } )
467
467
468
468
expect ( batch [ 1 ] [ "channel" ] ) . to eq ( "mychannel" )
You can’t perform that action at this time.
0 commit comments