Module: Eet::Utils
- Defined in:
- lib/eet/utils.rb
Class Method Summary collapse
Class Method Details
.create_bkp(pkp_value) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/eet/utils.rb', line 9 def self.create_bkp(pkp_value) decoded = Base64.decode64(pkp_value) digest = Digest::SHA1.digest(decoded) ret = '' encoded = digest.each_char do |c| ch = c.ord.to_s(16) ch = '0' + ch if ch.size == 1 ret += ch end # '9356D566-A3E48838-FB403790-D201244E-95DCBD92' ret.upcase.chars.each_slice(8).map(&:join).join('-') end |
.create_pkp(data, certificate) ⇒ Object
3 4 5 6 7 |
# File 'lib/eet/utils.rb', line 3 def self.create_pkp(data, certificate) digest = OpenSSL::Digest::SHA256.new signature = certificate.key.sign(digest, serialize_pkp_data(data)) Base64.encode64(signature).delete("\n") end |