klyn.cryptography.Signature.sign
method

    public sign(text as String = null, outputEncoding as String = "base64") as String throws CryptoException:

Description

Signs the buffered text and an optional final chunk.

Parameters

Parameter | Description
--- | ---
`text` | Optional final UTF-8 chunk.
`outputEncoding` | Signature encoding: `base64`, `base64url` or `hex`.

Returns

Encoded signature.

Throws

- CryptoException when the instance is not initialized for signing.

Example

    import klyn.cryptography

    keys = RSAKeyPairGenerator().generateKeyPair()
    signature = RSAPSSSignature(SHA256())
    signature.initSign(keys.privateKeyPem)
    token = signature.sign("hello")
    print(token)