File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Expand file tree Collapse file tree 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+
171.4.2 / 2020-10-20
28==================
39
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def initialize(options = {})
5959
6060 if options . has_key? ( :encryption_master_key_base64 )
6161 @encryption_master_key =
62- Base64 . decode64 ( options [ :encryption_master_key_base64 ] )
62+ Base64 . strict_decode64 ( options [ :encryption_master_key_base64 ] )
6363 end
6464
6565 @http_proxy = nil
@@ -148,7 +148,7 @@ def timeout=(value)
148148 # Set an encryption_master_key to use with private-encrypted channels from
149149 # a base64 encoded string.
150150 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
152152 end
153153
154154 ## INTERACT WITH THE API ##
@@ -483,8 +483,8 @@ def encrypt(channel_name, encoded_data)
483483 ciphertext = secret_box . encrypt ( nonce , encoded_data )
484484
485485 MultiJson . encode ( {
486- "nonce" => Base64 ::encode64 ( nonce ) ,
487- "ciphertext" => Base64 ::encode64 ( ciphertext ) ,
486+ "nonce" => Base64 ::strict_encode64 ( nonce ) ,
487+ "ciphertext" => Base64 ::strict_encode64 ( ciphertext ) ,
488488 } )
489489 end
490490
Original file line number Diff line number Diff line change 385385 )
386386
387387 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" ] ) ,
390390 ) ) ) . to eq ( { 'some' => 'data' } )
391391 }
392392 end
461461 )
462462
463463 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" ] ) ,
466466 ) ) ) . to eq ( { 'some' => 'data' } )
467467
468468 expect ( batch [ 1 ] [ "channel" ] ) . to eq ( "mychannel" )
You can’t perform that action at this time.
0 commit comments