Class: Acme::Client::JWK::HMAC
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(key) ⇒ HMAC
constructor
Instantiate a new HMAC JWS.
-
#jwa_alg ⇒ Object
The name of the algorithm as needed for the ‘alg` member of a JWS object.
-
#sign(message) ⇒ Object
Sign a message with the private key.
Methods inherited from Base
#jws, #jws_header, #thumbprint, #to_h, #to_json
Constructor Details
#initialize(key) ⇒ HMAC
Instantiate a new HMAC JWS.
key - A string.
Returns nothing.
9 10 11 |
# File 'lib/acme/client/jwk/hmac.rb', line 9 def initialize(key) @key = key end |
Instance Method Details
#jwa_alg ⇒ Object
The name of the algorithm as needed for the ‘alg` member of a JWS object.
Returns a String.
25 26 27 28 29 |
# File 'lib/acme/client/jwk/hmac.rb', line 25 def jwa_alg # https://tools.ietf.org/html/rfc7518#section-3.1 # HMAC using SHA-256 'HS256' end |
#sign(message) ⇒ Object
Sign a message with the private key.
message - A String message to sign.
Returns a String signature.
18 19 20 |
# File 'lib/acme/client/jwk/hmac.rb', line 18 def sign() OpenSSL::HMAC.digest('SHA256', @key, ) end |