scoop:scoop.crypto:0.1.0
scoop.crypto
API
-
enum
AeadAlgorithm
The supported AES-GCM key sizes. Both variants require a 12-byte nonce and produce a 16-byte authentication tag.
-
struct
AeadCiphertext
Ciphertext and its separate 16-byte GCM authentication tag; the nonce and associated data are supplied separately.
-
class
CryptoException
Reports a native cryptographic operation failure, retaining its code and diagnostic detail.
-
class
Digest
An incremental native digest context. Feed data with update, finish once, and close the context. Finished or failed contexts reject further updates.
-
enum
DigestAlgorithm
Digest choices provided by the native backend. MD5 and SHA-1 are available for protocol compatibility, not collision-resistant signatures.
-
enum
KeyAlgorithm
The recognized asymmetric key family; Other represents an imported family outside these supported operations.
-
class
PrivateKey
An owned native asymmetric private key. Operations require a live key; close it when finished.
-
class
PublicKey
An independently owned native asymmetric public key. Close it after use.
-
class
SecretKey
Owned native storage for symmetric key bytes. Close it after use; exporting creates a separate managed byte copy.
-
enum
SignatureAlgorithm
Signature schemes with explicit digest and wire encoding; the key family must match the selected scheme.
-
function
decryptOrNone
Authenticates before returning plaintext. Only authentication mismatch returns None; invalid sizes and backend failures throw.
-
function
digest
Computes a complete digest and closes the temporary context.
-
function
encrypt
Encrypts and authenticates plaintext and associated data with AES-GCM. The caller must use a fresh nonce for each encryption under the same key. Key size and 12-byte nonce length are checked.
-
function
hmac
Computes HMAC with SHA-256, SHA-384, or SHA-512. Other digest selections are rejected.
-
function
secureRandomBytes
Returns the requested nonnegative number of bytes from the backend's cryptographic random generator; backend failures propagate.
-
function
sign
Signs the message using a matching live private key and returns the scheme's signature encoding.
-
function
verify
Verifies a signature with a matching live public key. A signature mismatch returns false; invalid configuration and backend errors throw.
-
function
verifyHmac
Computes the expected MAC and compares equal-length bytes using the native constant-time comparison. A length mismatch returns false.