Module: Acme::Client::Util
Constant Summary collapse
- LINK_MATCH =
/<(.*?)>\s?;\s?rel="([\w-]+)"/
Instance Method Summary collapse
-
#decode_link_headers(link_header) ⇒ Object
See RFC 8288 - tools.ietf.org/html/rfc8288#section-3.
-
#set_public_key(obj, priv) ⇒ Object
Sets public key on CSR or cert.
- #urlsafe_base64(data) ⇒ Object
Instance Method Details
#decode_link_headers(link_header) ⇒ Object
See RFC 8288 - tools.ietf.org/html/rfc8288#section-3
9 10 11 12 13 14 15 |
# File 'lib/acme/client/util.rb', line 9 def decode_link_headers(link_header) link_header.split(',').each_with_object({}) { |entry, hash| _, link, name = *entry.match(LINK_MATCH) hash[name] ||= [] hash[name].push(link) } end |
#set_public_key(obj, priv) ⇒ Object
Sets public key on CSR or cert.
obj - An OpenSSL::X509::Certificate or OpenSSL::X509::Request instance. priv - An OpenSSL::PKey::EC or OpenSSL::PKey::RSA instance.
Returns nothing.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/acme/client/util.rb', line 23 def set_public_key(obj, priv) case priv when OpenSSL::PKey::EC obj.public_key = priv when OpenSSL::PKey::RSA obj.public_key = priv.public_key else raise ArgumentError, 'priv must be EC or RSA' end end |
#urlsafe_base64(data) ⇒ Object
2 3 4 |
# File 'lib/acme/client/util.rb', line 2 def urlsafe_base64(data) Base64.urlsafe_encode64(data).sub(/[\s=]*\z/, '') end |