Class: Net::HTTP::MessageSignatures::SignatureAlgorithm

Inherits:
Object
  • Object
show all
Defined in:
lib/net/http/message_signatures/signature_algorithm.rb

Overview

Abstract representation of HTTP Signature Algorithms.

To instantiate this class, you must pass the key material. With that instance, both of HTTP_SIGN and HTTP_VERIFY method can be used without passing key material.

Direct Known Subclasses

RSAPSSSHA512

Defined Under Namespace

Classes: InvalidAlgorithm

Instance Method Summary collapse

Instance Method Details

#sign(message) ⇒ String

HTTP_SIGN method which can be used without signing key material

Parameters:

  • message (String)

    the signature base in binary

Returns:

  • (String)

    the signature in binary

Raises:

  • (NotImplementedError)


19
20
21
22
23
# File 'lib/net/http/message_signatures/signature_algorithm.rb', line 19

def sign(message)
  # :nocov:
  raise NotImplementedError, 'signature algorithm must implement #sign'
  # :nocov:
end

#verify(message, signature) ⇒ Boolean

HTTP_VERIFY method which can be used without verification key material

Parameters:

  • message (String)

    the signature base in binary

  • signature (String)

    the signature in binary

Returns:

  • (Boolean)

    whether signature is valid or not

Raises:

  • (NotImplementedError)


30
31
32
33
34
# File 'lib/net/http/message_signatures/signature_algorithm.rb', line 30

def verify(message, signature)
  # :nocov:
  raise NotImplementedError, 'signature algorithm must implement #verify'
  # :nocov:
end