Sha256: 44d42747ee0b872f1b35cff1893f52d136ba7650c57607c7ceeef12e8908ab23
Contents?: true
Size: 576 Bytes
Versions: 1
Compression:
Stored size: 576 Bytes
Contents
module Nuntius class Key def initialize(key_data) @key = OpenSSL::PKey::RSA.new(key_data) end def private? @key.private? end def sign(string) digest = OpenSSL::Digest::SHA512.new.digest(string) @key.private_encrypt(digest) end def validate(message,signature) digest = OpenSSL::Digest::SHA512.new.digest(message) digest == @key.public_decrypt(signature) end def encrypt(string) @key.public_encrypt(string) end def decrypt(string) @key.private_decrypt(string) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nuntius-0.1.0 | lib/nuntius/key.rb |