[][src]Module devolutions_crypto::ffi

FFI interface for use with other languages. Mostly used for C and C#.

Safety

Note that this API is unsafe by nature: Rust can do a couple of check but cannot garantee the received pointers are valid. It is the job of the calling language to verify it passes the right pointers and length. The Size functions must be called to get the required length of the returned array before calling it.

Functions

Decode

Decode a base64 string to bytes.

Decrypt

Decrypt a data blob

DeriveKey

Derive a key to create a new one. Can be used with a password.

Encode

Encode a byte array to a base64 string.

Encrypt

Encrypt a data blob

EncryptSize

Get the size of the resulting ciphertext.

GenerateKey

Generate a key using a CSPRNG.

GenerateKeyExchange

Generate a key pair to perform a key exchange. Must be used with MixKey()

GenerateKeyExchangeSize

Get the size of the keys in the key exchange key pair.

HashPassword

Hash a password using a high-cost algorithm.

HashPasswordLength

Get the size of the resulting hash.

KeySize

Size, in bits, of the key used for the current Encrypt() implementation.

MixKeyExchange

Generate a key pair to perform a key exchange. Must be used with MixKey().

MixKeyExchangeSize

Get the size of the keys in the key exchange key pair.

VerifyPassword

Verify a password against a hash with constant-time equality.

Version

Fill the output buffer with the version string

VersionSize

Size of the version string