Signature
class in package klyn.cryptography

    public abstract class Signature extends Object:

Object
└ Signature

Abstract base class for digital signatures.

The concrete RSA APIs are exposed through `RSAPSSSignature` and `RSAPKCS1Signature`, parameterized by a concrete digest such as `SHA256()` or `SHA512()`.

    import klyn.cryptography

    keys = RSAKeyPairGenerator().generateKeyPair()
    signer as Signature = RSAPSSSignature(SHA256())
    signer.initSign(keys.privateKeyPem)
    token = signer.sign("hello")
    verifier as Signature = RSAPSSSignature(SHA256())
    verifier.initVerify(keys.publicKeyPem)
    print(verifier.verify(token, "hello"))

Fields

Modifier and Type | Member | Description
--- | --- | ---
public readonly | algorithm `algorithm as String` | Canonical signature algorithm name.
public readonly | hashAlgorithm `hashAlgorithm as String` | Canonical digest algorithm name used by the signature.
public readonly | padding `padding as String` | RSA padding mode used by the signature.

Properties inherited from Object: type
Methods

Modifier and Type | Member | Description
--- | --- | ---
public static | getInstance `getInstance(algorithm as String) as Signature throws CryptoException:` | Compatibility factory for dynamic algorithm selection.
public | initSign `initSign(privateKeyPem as String) as Void:` | Initializes the instance for signing with a private key.
public | initVerify `initVerify(publicKeyPem as String) as Void:` | Initializes the instance for verification with a public key.
public | reset `reset() as Void:` | Clears the buffered text accumulated with `update`.
public | sign `sign(text as String = null, outputEncoding as String = "base64") as String throws CryptoException:` | Signs the buffered text and an optional final chunk.
public override | toString `toString() as String:` | No summary.
public | update `update(text as String) as Signature:` | Appends text to the in-memory signature buffer.
public | verify `verify(signature as String, text as String = null, inputEncoding as String = "base64") as Boolean throws CryptoException:` | Verifies a signature against the buffered text and an optional final chunk.

Methods inherited from Object: fromJson, toDict, toJson, toString, toXml