Interface Signer
-
- All Implemented Interfaces:
public interface SignerAn interface defining the contract for signing and verifying signatures on payloads.
Signerprovides a generic approach to:Implementers of this interface should ensure mechanisms provided for signing and verifying respect the cryptographic standards necessary for secure and valid operations.
class MySigner : Signer { override fun sign(privateKey: Jwk , payload: Payload, options: SignOptions?): String { // Implementation-specific signing logic. } override fun verify(publicKey: Jwk , jws: String, options: VerifyOptions?) { // Implementation-specific verification logic. } }Implementers may utilize SignOptions and VerifyOptions to allow consumers to pass in additional, implementation-specific options to influence the signing and verification processes respectively.
-
-
Method Summary
Modifier and Type Method Description abstract ByteArraysign(Jwk privateKey, ByteArray payload, SignOptions options)Sign a given payload using a private key. abstract Unitverify(Jwk publicKey, ByteArray signedPayload, ByteArray signature, VerifyOptions options)Verify the signature of a given payload using a public key. -
-
Method Detail
-
sign
abstract ByteArray sign(Jwk privateKey, ByteArray payload, SignOptions options)
Sign a given payload using a private key.
This function takes a payload and a private key in Jwk (JSON Web Key) format, and returns a signature as a byte array. Additional options for the signing process can be provided via the
optionsparameter.- Parameters:
privateKey- The private key in Jwk format to be used for signing.payload- The payload/data to be signed.options- Optional parameter containing additional options to control the signing process.- Returns:
A ByteArray representing the signature.
-
verify
abstract Unit verify(Jwk publicKey, ByteArray signedPayload, ByteArray signature, VerifyOptions options)
Verify the signature of a given payload using a public key.
This function attempts to verify the signature of a provided payload using a public key, supplied in Jwk (JSON Web Key) format, and a signature. The verification process checks the validity of the signature against the provided payload, respecting any optional verification options provided via VerifyOptions.
- Parameters:
publicKey- The public key in Jwk format used for verifying the signature.signedPayload- The original payload/data that was signed, to be verified against its signature.signature- The signature to be verified against the payload and public key.options- Optional parameter containing additional options to control the verification process.
-
-
-
-