Signer
Shared interface of all objects that can sign data. Signatures are created using the signatureAlgorithm, and can be verified using publicKey, potentially with a verifierFor this object.
Signers for your platform can be accessed using your platform's SigningProvider.
Ephemeral signers can be obtained using
Signer.Ephemeral {
/* optional key configuration */
}
This will generate a throwaway EphemeralKey and return a Signer for it.
Any actual instantiation will have an AlgTrait, which will be either ECDSA or RSA. Instantiations may also be WithAlias, usually because they come from a SigningProvider. They may also be Attestable.
Some signers mayRequireUserUnlock. If needed, they will ask for user interaction when you try to sign data. You can try to authenticate a signer ahead of time using trySetupUninterruptedSigning; but it might do nothing for some Signers. There is never a guarantee that signing is uninterrupted if mayRequireUserUnlock is true.
Inheritors
Types
Properties
The underlying JCA PrivateKey object.
The underlying JCA PrivateKey object.
Whether the signer may ask for user interaction when sign is called
The underlying SecKeyRef referencing the signer's private key. ⚠️ If returned from a keychain signer, must be used immediately. Do not store long term. ⚠️
Functions
Gets a platform verifier for signatures generated by this Signer.
Get a verifier for signatures generated by this Signer.
Signs data. Might ask for user confirmation first if this Signer.
Shorthand helper to create an X509Certificate by signing tbsCertificate
Shorthand helper to create a Pkcs10CertificationRequest by signing tbsCsr
Try to ensure that the Signer is ready to immediately sign data, on a best-effort basis. For example, if user authorization allows signing for a given timeframe, this will prompts for authorization now.