Class: LightJWT::JWA::JWS::ECDSAHandler
Instance Attribute Summary
Attributes inherited from BaseHandler
#alg, #digest
Instance Method Summary
collapse
Methods inherited from BaseHandler
#initialize, #secure_compare
Instance Method Details
#sign(private_key, token) ⇒ Object
135
136
137
138
139
|
# File 'lib/light_jwt/jwa/jws.rb', line 135
def sign(private_key, token)
ec_private_key = OpenSSL::PKey::EC.new(private_key)
asn1_to_raw(ec_private_key.sign(digest, token), ec_private_key)
end
|
#verify(public_key, token, signature) ⇒ Object
141
142
143
144
145
146
|
# File 'lib/light_jwt/jwa/jws.rb', line 141
def verify(public_key, token, signature)
ec_public_key = OpenSSL::PKey::EC.new(public_key)
raw_signature = raw_to_asn1(signature, ec_public_key)
ec_public_key.verify(digest, raw_signature, token)
end
|