change Base64.encode64 to Base64.encode64s (encode without newlines)
This commit is contained in:
parent
58abbcc058
commit
36f5e45c25
5 changed files with 8 additions and 7 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue