diff --git a/app/views/publics/webfinger.erb b/app/views/publics/webfinger.erb index cc6c64b369c585e972f3f56b74d3052a5fcd1d10..c462a13fe15e30e46c9462752b408c236d3f1bcd 100644 --- a/app/views/publics/webfinger.erb +++ b/app/views/publics/webfinger.erb @@ -9,5 +9,5 @@ <Link rel='http://webfinger.net/rel/profile-page' type='text/html' <%="#{person_href(@person, :absolute => true)}"%>/> <Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.public_url%>.atom"/> - <Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/> + <Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64s(@person.exported_key)%>"/> </XRD> diff --git a/lib/diaspora/encryptable.rb b/lib/diaspora/encryptable.rb index a950e38f56f69048b87b337c857891b150a9ed1d..75bcca4e2c07334535c65bff0833bb2544c7f1f2 100644 --- a/lib/diaspora/encryptable.rb +++ b/lib/diaspora/encryptable.rb @@ -26,7 +26,7 @@ module Diaspora # @param [OpenSSL::PKey::RSA] key An RSA key # @return [String] A Base64 encoded signature of #signable_string with key def sign_with_key(key) - sig = Base64.encode64(key.sign "SHA", signable_string) + sig = Base64.encode64s(key.sign "SHA", signable_string) log_hash = {:event => :sign_with_key, :status => :complete} log_hash.merge(:model_id => self.id) if self.respond_to?(:persisted?) Rails.logger.info(log_hash) diff --git a/lib/encryptor.rb b/lib/encryptor.rb index a75dc7ba626874d50194349dd398549282d49876..0ade6d1b1851685f3d54bd167cf92fa72787fe8c 100644 --- a/lib/encryptor.rb +++ b/lib/encryptor.rb @@ -9,14 +9,14 @@ module Encryptor ciphertext = aes_encrypt(cleartext, aes_key) encrypted_key = encrypt_aes_key aes_key cipher_hash = {:aes_key => encrypted_key, :ciphertext => ciphertext} - Base64.encode64( cipher_hash.to_json ) + Base64.encode64s( cipher_hash.to_json ) end def gen_aes_key cipher = OpenSSL::Cipher.new('AES-256-CBC') key = cipher.random_key iv = cipher.random_iv - {'key' => Base64.encode64(key), 'iv' => Base64.encode64(iv)} + {'key' => Base64.encode64s(key), 'iv' => Base64.encode64(iv)} end def aes_encrypt(txt, key) @@ -27,11 +27,11 @@ module Encryptor ciphertext = '' ciphertext << cipher.update(txt) ciphertext << cipher.final - Base64.encode64 ciphertext + Base64.encode64s(ciphertext) end def encrypt_aes_key key - Base64.encode64 public_key.public_encrypt( key.to_json ) + Base64.encode64s(public_key.public_encrypt( key.to_json )) end end diff --git a/lib/postzord/dispatcher.rb b/lib/postzord/dispatcher.rb index 8d5e5b0fa65801839b41fc3d28f9157a145b372f..01649d87bc01d27067cd60b98e6f5ee23bce1739 100644 --- a/lib/postzord/dispatcher.rb +++ b/lib/postzord/dispatcher.rb @@ -152,7 +152,7 @@ class Postzord::Dispatcher # @param remote_people [Array<Person>] Recipients of the post on other pods # @return [void] def queue_remote_delivery_job(remote_people) - Resque.enqueue(Jobs::HttpMulti, @sender.id, Base64.encode64(@object.to_diaspora_xml), remote_people.map{|p| p.id}, self.class.to_s) + Resque.enqueue(Jobs::HttpMulti, @sender.id, Base64.encode64s(@object.to_diaspora_xml), remote_people.map{|p| p.id}, self.class.to_s) end end diff --git a/lib/salmon/salmon.rb b/lib/salmon/salmon.rb index 20c7c750b37415f9d54489ade02d75e180ad4046..aa0dd4b1de7861030d76f8aad7c766467fa3674c 100644 --- a/lib/salmon/salmon.rb +++ b/lib/salmon/salmon.rb @@ -17,6 +17,7 @@ module Base64 # ArgumentError is raised if +str+ is incorrectly padded or contains # non-alphabet characters. Note that CR or LF are also rejected. def strict_decode64(str) + Rails.logger.info("trying to decode string: " + str) str.unpack("m0").first end