class WebPackage::Signer
Performs signing of a message with ECDSA.
Attributes
cert[R]
cert_url[R]
Public Class Methods
new(path_to_cert, path_to_key)
click to toggle source
# File lib/web_package/signer.rb, line 16 def initialize(path_to_cert, path_to_key) @alg = OpenSSL::PKey::EC.new(File.read(path_to_key)) @cert = OpenSSL::X509::Certificate.new(File.read(path_to_cert)) end
take()
click to toggle source
# File lib/web_package/signer.rb, line 12 def self.take @@instance ||= new(Settings.cert_path, Settings.priv_path) end
Public Instance Methods
cert_sha256()
click to toggle source
# File lib/web_package/signer.rb, line 25 def cert_sha256 @cert_sha256 ||= digest(@cert.to_der) end
sign(message)
click to toggle source
# File lib/web_package/signer.rb, line 21 def sign(message) @alg.dsa_sign_asn1 digest(message) end