[All] - [crypto_errno
] - [keypair_encoding
] - [publickey_encoding
] - [secretkey_encoding
] - [signature_encoding
] - [algorithm_type
] - [version
] - [size
] - [timestamp
] - [u64
] - [array_output
] - [options
] - [secrets_manager
] - [keypair
] - [signature_state
] - [signature
] - [publickey
] - [secretkey
] - [signature_verification_state
] - [symmetric_state
] - [symmetric_key
] - [symmetric_tag
] - [opt_options_u
] - [opt_options
] - [opt_symmetric_key_u
] - [opt_symmetric_key
] - [signature_keypair
] - [signature_publickey
] - [signature_secretkey
]
[All] - [signature_export()
] - [signature_import()
] - [signature_state_open()
] - [signature_state_update()
] - [signature_state_sign()
] - [signature_state_close()
] - [signature_verification_state_open()
] - [signature_verification_state_update()
] - [signature_verification_state_verify()
] - [signature_verification_state_close()
] - [signature_close()
]
Enumeration with tag type: u16
, and the following members:
success
:crypto_errno
guest_error
:crypto_errno
not_implemented
:crypto_errno
unsupported_feature
:crypto_errno
prohibited_operation
:crypto_errno
unsupported_encoding
:crypto_errno
unsupported_algorithm
:crypto_errno
unsupported_option
:crypto_errno
invalid_key
:crypto_errno
invalid_length
:crypto_errno
verification_failed
:crypto_errno
rng_error
:crypto_errno
algorithm_failure
:crypto_errno
invalid_signature
:crypto_errno
closed
:crypto_errno
invalid_handle
:crypto_errno
overflow
:crypto_errno
internal_error
:crypto_errno
too_many_handles
:crypto_errno
key_not_supported
:crypto_errno
key_required
:crypto_errno
invalid_tag
:crypto_errno
invalid_operation
:crypto_errno
nonce_required
:crypto_errno
invalid_nonce
:crypto_errno
option_not_set
:crypto_errno
not_found
:crypto_errno
parameters_missing
:crypto_errno
in_progress
:crypto_errno
incompatible_keys
:crypto_errno
expired
:crypto_errno
Error codes.
Enumeration with tag type: u16
, and the following members:
raw
:keypair_encoding
pkcs8
:keypair_encoding
pem
:keypair_encoding
local
:keypair_encoding
Encoding to use for importing or exporting a key pair.
Enumeration with tag type: u16
, and the following members:
raw
:publickey_encoding
pkcs8
:publickey_encoding
pem
:publickey_encoding
sec
:publickey_encoding
local
:publickey_encoding
Encoding to use for importing or exporting a public key.
Enumeration with tag type: u16
, and the following members:
raw
:secretkey_encoding
pkcs8
:secretkey_encoding
pem
:secretkey_encoding
sec
:secretkey_encoding
local
:secretkey_encoding
Encoding to use for importing or exporting a secret key.
Enumeration with tag type: u16
, and the following members:
raw
:signature_encoding
der
:signature_encoding
Encoding to use for importing or exporting a signature.
Enumeration with tag type: u16
, and the following members:
signatures
:algorithm_type
symmetric
:algorithm_type
key_exchange
:algorithm_type
An algorithm category.
Alias for u64
.
Version of a managed key.
A version can be an arbitrary
u64
integer, with the expection of some reserved values.
Alias for usize
.
Size of a value.
Alias for u64
.
A UNIX timestamp, in seconds since 01/01/1970.
Alias for u64
.
A 64-bit value
Alias for handle
.
Handle for functions returning output whose size may be large or not known in advance.
An
array_output
object contains a host-allocated byte array.A guest can get the size of that array after a function returns in order to then allocate a buffer of the correct size. In addition, the content of such an object can be consumed by a guest in a streaming fashion.
An
array_output
handle is automatically closed after its full content has been consumed.
Alias for handle
.
A set of options.
This type is used to set non-default parameters.
The exact set of allowed options depends on the algorithm being used.
Alias for handle
.
A handle to the optional secrets management facilities offered by a host.
This is used to generate, retrieve and invalidate managed keys.
Alias for handle
.
A key pair.
Alias for handle
.
A state to absorb data to be signed.
After a signature has been computed or verified, the state remains valid for further operations.
A subsequent signature would sign all the data accumulated since the creation of the state object.
Alias for handle
.
A signature.
Alias for handle
.
A public key, for key exchange and signature verification.
Alias for handle
.
A secret key, for key exchange mechanisms.
Alias for handle
.
A state to absorb signed data to be verified.
Alias for handle
.
A state to perform symmetric operations.
The state is not reset nor invalidated after an option has been performed. Incremental updates and sessions are thus supported.
Alias for handle
.
A symmetric key.
The key can be imported from raw bytes, or can be a reference to a managed key.
If it was imported, the host will wipe it from memory as soon as the handle is closed.
Alias for handle
.
An authentication tag.
This is an object returned by functions computing authentication tags.
A tag can be compared against another tag (directly supplied as raw bytes) in constant time with the
symmetric_tag_verify()
function.This object type can't be directly created from raw bytes. They are only returned by functions computing MACs.
The host is reponsible for securely wiping them from memory on close.
Enumeration with tag type: u8
, and the following members:
some
:opt_options_u
none
:opt_options_u
Options index, only required by the Interface Types translation layer.
Tagged union with tag type: u8
and the following possibilities:
some
:options
none
: (empty)
An optional options set.
This union simulates an
Option\<Options\>
type to make theoptions
parameter of some functions optional.
Enumeration with tag type: u8
, and the following members:
some
:opt_symmetric_key_u
none
:opt_symmetric_key_u
Symmetric key index, only required by the Interface Types translation layer.
Tagged union with tag type: u8
and the following possibilities:
some
:symmetric_key
none
: (empty)
An optional symmetric key.
This union simulates an
Option\<SymmetricKey\>
type to make thesymmetric_key
parameter of some functions optional.
Alias for handle
.
$signature_keypair
is just an alias for$keypair
However, bindings may want to define a specialized type
signature_keypair
as a super class ofkeypair
, with additional methods such assign
.
Alias for handle
.
$signature_publickey
is just an alias for$publickey
However, bindings may want to define a specialized type
signature_publickey
as a super class ofpublickey
, with additional methods such asverify
.
Alias for handle
.
$signature_secretkey
is just an alias for$secretkey
However, bindings may want to define a specialized type
signature_secretkey
as a super class ofsecretkey
.
Returned error type: crypto_errno
signature
:signature
encoding
:signature_encoding
array_output
mutable pointer
Export a signature.
This function exports a signature object using the specified encoding.
May return
unsupported_encoding
if the signature cannot be encoded into the given format.
Returned error type: crypto_errno
algorithm
:string
encoded
:u8
pointerencoded_len
:size
encoding
:signature_encoding
signature
mutable pointer
Create a signature object.
This object can be used along with a public key to verify an existing signature.
It may return
invalid_signature
if the signature is invalid or incompatible with the specified algorithm, as well asunsupported_encoding
if the encoding is not compatible with the signature type.The function may also return
unsupported_algorithm
if the algorithm is not supported by the host.Example usage:
let signature_handle = ctx.signature_import("ECDSA_P256_SHA256", SignatureEncoding::DER, encoded)?;
Returned error type: crypto_errno
signature_state
mutable pointer
Create a new state to collect data to compute a signature on.
This function allows data to be signed to be supplied in a streaming fashion.
The state is not closed and can be used after a signature has been computed, allowing incremental updates by calling
signature_state_update()
again afterwards.Example usage - signature creation
let kp_handle = ctx.keypair_import(AlgorithmType::Signatures, "Ed25519ph", keypair, KeypairEncoding::Raw)?; let state_handle = ctx.signature_state_open(kp_handle)?; ctx.signature_state_update(state_handle, b"message part 1")?; ctx.signature_state_update(state_handle, b"message part 2")?; let sig_handle = ctx.signature_state_sign(state_handle)?; let raw_sig = ctx.signature_export(sig_handle, SignatureEncoding::Raw)?;
Returned error type: crypto_errno
state
:signature_state
input
:u8
pointerinput_len
:size
This function has no output.
Absorb data into the signature state.
This function may return
unsupported_feature
is the selected algorithm doesn't support incremental updates.
Returned error type: crypto_errno
state
:signature_state
array_output
mutable pointer
Compute a signature for all the data collected up to that point.
The function can be called multiple times for incremental signing.
Returned error type: crypto_errno
state
:signature_state
This function has no output.
Destroy a signature state.
Objects are reference counted. It is safe to close an object immediately after the last function needing it is called.
Note that closing a signature state doesn't close or invalidate the key pair object, that be reused for further signatures.
Returned error type: crypto_errno
signature_verification_state
mutable pointer
Create a new state to collect data to verify a signature on.
This is the verification counterpart of
signature_state
.Data can be injected using
signature_verification_state_update()
, and the state is not closed after a verification, allowing incremental verification.Example usage - signature verification:
let pk_handle = ctx.publickey_import(AlgorithmType::Signatures, "ECDSA_P256_SHA256", encoded_pk, PublicKeyEncoding::Sec)?; let signature_handle = ctx.signature_import(AlgorithmType::Signatures, "ECDSA_P256_SHA256", encoded_sig, SignatureEncoding::Der)?; let state_handle = ctx.signature_verification_state_open(pk_handle)?; ctx.signature_verification_state_update(state_handle, "message")?; ctx.signature_verification_state_verify(signature_handle)?;
Returned error type: crypto_errno
state
:signature_verification_state
input
:u8
pointerinput_len
:size
This function has no output.
Absorb data into the signature verification state.
This function may return
unsupported_feature
is the selected algorithm doesn't support incremental updates.
Returned error type: crypto_errno
state
:signature_verification_state
signature
:signature
This function has no output.
Check that the given signature is verifies for the data collected up to that point point.
The state is not closed and can absorb more data to allow for incremental verification.
The function returns
invalid_signature
if the signature doesn't appear to be valid.
Returned error type: crypto_errno
state
:signature_verification_state
This function has no output.
Destroy a signature verification state.
Objects are reference counted. It is safe to close an object immediately after the last function needing it is called.
Note that closing a signature state doesn't close or invalidate the public key object, that be reused for further verifications.
Returned error type: crypto_errno
signature
:signature
This function has no output.
Destroy a signature.
Objects are reference counted. It is safe to close an object immediately after the last function needing it is called.