need to serialize key to bson

This commit is contained in:
ilya 2010-08-04 21:08:25 -07:00
parent f11e973602
commit 4a3f6b2986
4 changed files with 5 additions and 6 deletions

View file

@ -7,7 +7,6 @@ gem 'rails', '3.0.0.beta4'
gem 'bundler', '0.9.26'
#Security
gem 'openssl'
gem 'gpgme'
gem 'devise', :git => 'http://github.com/BadMinus/devise.git'

View file

@ -5,7 +5,7 @@ class Person
xml_accessor :_id
xml_accessor :email
xml_accessor :url
xml_accessor :key_fingerprint
#xml_accessor :key_fingerprint
xml_accessor :profile, :as => Profile
@ -21,7 +21,7 @@ class Person
timestamps!
before_validation :clean_url
validates_presence_of :email, :url, :key_fingerprint
validates_presence_of :email, :url, :key
validates_format_of :url, :with =>
/^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix
@ -38,7 +38,7 @@ class Person
end
def export_key
key.public_key
key.public_key.to_s
end
protected

View file

@ -130,7 +130,7 @@ class User < Person
def generate_key
puts "Generating key"
self.rsa_key = OpenSSL::PKey::RSA::generate 1024
self.key = OpenSSL::PKey::RSA::generate 1024
end

View file

@ -7,7 +7,7 @@
end
def verify_signature(signature, person)
return false unless signature && person.key_fingerprint
return false unless signature && person.key
validity = nil
Rails.logger.info("Verifying sig on #{signable_string} from person #{person.real_name}")
person.key.verify "SHA", signature, signable_string