Expand description
This is an intermediate crate that exposes the C API of libolm
to Rust. If you want to start building things with libolm
from Rust, check out olm-rs
.
§Supported Platforms
- Android
- Linux
- macOS
- Windows
- FreeBSD
- WebAssembly
§Building
This library can either be built by statically or dynamically linking against libolm
:
§Static
This is the default and requires no further action. libolm
is built locally and then linked against statically.
§Build dependencies
libstdc++
/libc++
- cmake
- GNU make or a compatible variant (WebAssembly only)
- Emscripten (WebAssembly only)
§Dynamic
For linking against libolm
dynamically, first make sure that you have the library in your link path.
Then build this library with the OLM_LINK_VARIANT
environment variable set to dylib
.
For example, building your project using olm-sys
as a dependency would look like this:
$ OLM_LINK_VARIANT=dylib cargo build
§Cross compiling for Android
To enable cross compilation for Android set the environment variable
ANDROID_NDK
to the location of your NDK installation, for example:
$ ANRDOID_NDK=/home/user/Android/Sdk/ndk/22.0.7026061/
The linker needs to be set to an target specific one as well, for example for
aarch64-linux-android
set this into your cargo config:
[target.aarch64-linux-android]
ar = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/ar"
linker = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"
After both of these are set, compilation should work as usual using cargo:
$ ANDROID_NDK=~/Android/Sdk/ndk/22.0.7026061 cargo build --target aarch64-linux-android
Structs§
- OlmAccount
- OlmInbound
Group Session - OlmOutbound
Group Session - OlmPk
Decryption - OlmPk
Encryption - OlmPk
Signing - OlmSAS
- OlmSession
- OlmUtility
- __
fsid_ t - max_
align_ t
Constants§
- INT8_
MAX - INT8_
MIN - INT16_
MAX - INT16_
MIN - INT32_
MAX - INT32_
MIN - INTPTR_
MAX - INTPTR_
MIN - INT_
FAST8_ MAX - INT_
FAST8_ MIN - INT_
FAST16_ MAX - INT_
FAST16_ MIN - INT_
FAST32_ MAX - INT_
FAST32_ MIN - INT_
LEAS T8_ MAX - INT_
LEAS T8_ MIN - INT_
LEAS T16_ MAX - INT_
LEAS T16_ MIN - INT_
LEAS T32_ MAX - INT_
LEAS T32_ MIN - OLM_
MESSAGE_ TYPE_ MESSAGE - OLM_
MESSAGE_ TYPE_ PRE_ KEY - OlmError
Code_ OLM_ BAD_ ACCOUNT_ KEY - < The supplied account key is invalid
- OlmError
Code_ OLM_ BAD_ LEGACY_ ACCOUNT_ PICKLE - Attempt to unpickle an account which uses pickle version 1 (which did not save enough space for the Ed25519 key; the key should be considered compromised. We don’t let the user reload the account.
- OlmError
Code_ OLM_ BAD_ MESSAGE_ FORMAT - < The message couldn’t be decoded
- OlmError
Code_ OLM_ BAD_ MESSAGE_ KEY_ ID - < The message references an unknown key id
- OlmError
Code_ OLM_ BAD_ MESSAGE_ MAC - < The message couldn’t be decrypted
- OlmError
Code_ OLM_ BAD_ MESSAGE_ VERSION - < The message version is unsupported
- OlmError
Code_ OLM_ BAD_ SESSION_ KEY - < Attempt to initialise an inbound group session from an invalid session key
- OlmError
Code_ OLM_ BAD_ SIGNATURE - Received message had a bad signature
- OlmError
Code_ OLM_ CORRUPTED_ PICKLE - < The pickled object couldn’t be decoded
- OlmError
Code_ OLM_ INPUT_ BUFFER_ TOO_ SMALL - Received message had a bad signature
- OlmError
Code_ OLM_ INVALID_ BASE64 - < The input base64 was invalid
- OlmError
Code_ OLM_ NOT_ ENOUGH_ RANDOM - < Not enough entropy was supplied
- OlmError
Code_ OLM_ OUTPUT_ BUFFER_ TOO_ SMALL - < Supplied output buffer is too small
- OlmError
Code_ OLM_ PICKLE_ EXTRA_ DATA - The pickled object was successfully decoded, but the unpickling still failed because it had some extraneous junk data at the end.
- OlmError
Code_ OLM_ SAS_ THEIR_ KEY_ NOT_ SET - SAS doesn’t have their key set.
- OlmError
Code_ OLM_ SUCCESS - < There wasn’t an error
- OlmError
Code_ OLM_ UNKNOWN_ MESSAGE_ INDEX - < Attempt to decode a message whose index is earlier than our earliest known session key.
- OlmError
Code_ OLM_ UNKNOWN_ PICKLE_ VERSION - < The pickled object is too new
- PTRDIFF_
MAX - PTRDIFF_
MIN - SIG_
ATOMIC_ MAX - SIG_
ATOMIC_ MIN - SIZE_
MAX - UINT8_
MAX - UINT16_
MAX - UINT32_
MAX - UINTPTR_
MAX - UINT_
FAST8_ MAX - UINT_
FAST16_ MAX - UINT_
FAST32_ MAX - UINT_
LEAS T8_ MAX - UINT_
LEAS T16_ MAX - UINT_
LEAS T32_ MAX - WINT_
MAX - WINT_
MIN - _ATFILE_
SOURCE - _BITS_
STDINT_ INTN_ H - _BITS_
STDINT_ UINTN_ H - _BITS_
TIME64_ H - _BITS_
TYPESIZES_ H - _BITS_
TYPES_ H - _BITS_
WCHAR_ H - _DEFAULT_
SOURCE - _FEATURES_
H - _POSIX_
C_ SOURCE - _POSIX_
SOURCE - _STDC_
PREDEF_ H - _STDINT_
H - _SYS_
CDEFS_ H - __
FD_ SETSIZE - __
GLIBC_ MINOR__ - __
GLIBC_ USE_ DEPRECATED_ GETS - __
GLIBC_ USE_ DEPRECATED_ SCANF - __
GLIBC_ USE_ IEC_ 60559_ BFP_ EXT - __
GLIBC_ USE_ IEC_ 60559_ BFP_ EXT_ C2X - __
GLIBC_ USE_ IEC_ 60559_ FUNCS_ EXT - __
GLIBC_ USE_ IEC_ 60559_ FUNCS_ EXT_ C2X - __
GLIBC_ USE_ IEC_ 60559_ TYPES_ EXT - __
GLIBC_ USE_ ISOC2X - __
GLIBC_ USE_ LIB_ EXT2 - __
GLIBC__ - __
GNU_ LIBRARY__ - __
HAVE_ GENERIC_ SELECTION - __
INO_ T_ MATCHES_ INO64_ T - __
KERNEL_ OLD_ TIMEVAL_ MATCHES_ TIMEVA L64 - __
LDOUBLE_ REDIRECTS_ TO_ FLOA T128_ ABI - __
OFF_ T_ MATCHES_ OFF64_ T - __
RLIM_ T_ MATCHES_ RLIM64_ T - __
STATFS_ MATCHES_ STATF S64 - __
STDC_ IEC_ 559_ COMPLEX__ - __
STDC_ IEC_ 559__ - __
STDC_ ISO_ 10646__ - __
SYSCALL_ WORDSIZE - __
TIMESIZE - __
USE_ ATFILE - __
USE_ FORTIFY_ LEVEL - __
USE_ ISOC11 - __
USE_ ISOC95 - __
USE_ ISOC99 - __
USE_ MISC - __
USE_ POSIX - __
USE_ POSI X2 - __
USE_ POSI X199309 - __
USE_ POSI X199506 - __
USE_ POSIX_ IMPLICITLY - __
USE_ XOPE N2K - __
USE_ XOPE N2K8 - __
WORDSIZE - __
WORDSIZE_ TIME64_ COMPA T32 - __
glibc_ c99_ flexarr_ available
Functions§
- _olm_
error_ ⚠to_ string - get a string representation of the given error code.
- olm_
account ⚠ - Initialise an account object using the supplied memory The supplied memory must be at least olm_account_size() bytes
- olm_
account_ ⚠fallback_ key - Deprecated: use olm_account_unpublished_fallback_key instead
- olm_
account_ ⚠fallback_ key_ length - The number of bytes needed to hold the fallback key as returned by olm_account_fallback_key.
- olm_
account_ ⚠forget_ old_ fallback_ key - Forget about the old fallback key. This should be called once you are reasonably certain that you will not receive any more messages that use the old fallback key (e.g. 5 minutes after the new fallback key has been published).
- olm_
account_ ⚠generate_ fallback_ key - Generates a new fallback key. Only one previous fallback key is stored. Returns olm_error() on error. If the number of random bytes is too small then olm_account_last_error() will be “NOT_ENOUGH_RANDOM”.
- olm_
account_ ⚠generate_ fallback_ key_ random_ length - The number of random bytes needed to generate a fallback key.
- olm_
account_ ⚠generate_ one_ time_ keys - Generates a number of new one time keys. If the total number of keys stored by this account exceeds max_number_of_one_time_keys() then the old keys are discarded. Returns olm_error() on error. If the number of random bytes is too small then olm_account_last_error() will be “NOT_ENOUGH_RANDOM”.
- olm_
account_ ⚠generate_ one_ time_ keys_ random_ length - The number of random bytes needed to generate a given number of new one time keys.
- olm_
account_ ⚠identity_ keys - Writes the public parts of the identity keys for the account into the identity_keys output buffer. Returns olm_error() on failure. If the identity_keys buffer was too small then olm_account_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”.
- olm_
account_ ⚠identity_ keys_ length - The size of the output buffer needed to hold the identity keys
- olm_
account_ ⚠last_ error - A null terminated string describing the most recent error to happen to an account
- olm_
account_ ⚠last_ error_ code - An error code describing the most recent error to happen to an account
- olm_
account_ ⚠mark_ keys_ as_ published - Marks the current set of one time keys and fallback key as being published Once marked as published, the one time keys will no longer be returned by olm_account_one_time_keys(), and the fallback key will no longer be returned by olm_account_unpublished_fallback_key().
- olm_
account_ ⚠max_ number_ of_ one_ time_ keys - The largest number of one time keys this account can store.
- olm_
account_ ⚠one_ time_ keys - Writes the public parts of the unpublished one time keys for the account into the one_time_keys output buffer.
- olm_
account_ ⚠one_ time_ keys_ length - The size of the output buffer needed to hold the one time keys
- olm_
account_ ⚠sign - Signs a message with the ed25519 key for this account. Returns olm_error() on failure. If the signature buffer was too small then olm_account_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”
- olm_
account_ ⚠signature_ length - The length of an ed25519 signature encoded as base64.
- olm_
account_ ⚠size - The size of an account object in bytes
- olm_
account_ ⚠unpublished_ fallback_ key - Returns the fallback key (if present, and if unpublished) into the fallback_key buffer
- olm_
account_ ⚠unpublished_ fallback_ key_ length - The number of bytes needed to hold the unpublished fallback key as returned by olm_account_unpublished fallback_key.
- olm_
clear_ ⚠account - Clears the memory used to back this account
- olm_
clear_ ⚠inbound_ group_ session - Clears the memory used to back this group session
- olm_
clear_ ⚠outbound_ group_ session - Clears the memory used to back this group session
- olm_
clear_ ⚠pk_ decryption - Clears the memory used to back this decryption object
- olm_
clear_ ⚠pk_ encryption - Clears the memory used to back this encryption object
- olm_
clear_ ⚠pk_ signing - Clears the memory used to back this signing object
- olm_
clear_ ⚠sas - Clears the memory used to back an SAS object.
- olm_
clear_ ⚠session - Clears the memory used to back this session
- olm_
clear_ ⚠utility - Clears the memory used to back this utility
- olm_
create_ ⚠account - Creates a new account. Returns olm_error() on failure. If there weren’t enough random bytes then olm_account_last_error() will be “NOT_ENOUGH_RANDOM”
- olm_
create_ ⚠account_ random_ length - The number of random bytes needed to create an account.
- olm_
create_ ⚠inbound_ session - Create a new in-bound session for sending/receiving messages from an incoming PRE_KEY message. Returns olm_error() on failure. If the base64 couldn’t be decoded then olm_session_last_error will be “INVALID_BASE64”. If the message was for an unsupported protocol version then olm_session_last_error() will be “BAD_MESSAGE_VERSION”. If the message couldn’t be decoded then olm_session_last_error() will be “BAD_MESSAGE_FORMAT”. If the message refers to an unknown one time key then olm_session_last_error() will be “BAD_MESSAGE_KEY_ID”.
- olm_
create_ ⚠inbound_ session_ from - Same as olm_create_inbound_session, but ensures that the identity key
in the pre-key message matches the expected identity key, supplied via the
their_identity_key
parameter. Fails early if there is no match. - olm_
create_ ⚠outbound_ session - Creates a new out-bound session for sending messages to a given identity_key and one_time_key. Returns olm_error() on failure. If the keys couldn’t be decoded as base64 then olm_session_last_error() will be “INVALID_BASE64” If there weren’t enough random bytes then olm_session_last_error() will be “NOT_ENOUGH_RANDOM”.
- olm_
create_ ⚠outbound_ session_ random_ length - The number of random bytes needed to create an outbound session
- olm_
create_ ⚠sas - Creates a new SAS object.
- olm_
create_ ⚠sas_ random_ length - The number of random bytes needed to create an SAS object.
- olm_
decrypt ⚠ - Decrypts a message using the session. The input message buffer is destroyed. Returns the length of the plain-text on success. Returns olm_error() on failure. If the plain-text buffer is smaller than olm_decrypt_max_plaintext_length() then olm_session_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If the base64 couldn’t be decoded then olm_session_last_error() will be “INVALID_BASE64”. If the message is for an unsupported version of the protocol then olm_session_last_error() will be “BAD_MESSAGE_VERSION”. If the message couldn’t be decoded then olm_session_last_error() will be BAD_MESSAGE_FORMAT“. If the MAC on the message was invalid then olm_session_last_error() will be “BAD_MESSAGE_MAC”.
- olm_
decrypt_ ⚠max_ plaintext_ length - The maximum number of bytes of plain-text a given message could decode to. The actual size could be different due to padding. The input message buffer is destroyed. Returns olm_error() on failure. If the message base64 couldn’t be decoded then olm_session_last_error() will be “INVALID_BASE64”. If the message is for an unsupported version of the protocol then olm_session_last_error() will be “BAD_MESSAGE_VERSION”. If the message couldn’t be decoded then olm_session_last_error() will be “BAD_MESSAGE_FORMAT”.
- olm_
ed25519_ ⚠verify - Verify an ed25519 signature. If the key was too small then olm_utility_last_error() will be “INVALID_BASE64”. If the signature was invalid then olm_utility_last_error() will be “BAD_MESSAGE_MAC”.
- olm_
encrypt ⚠ - Encrypts a message using the session. Returns the length of the message in bytes on success. Writes the message as base64 into the message buffer. Returns olm_error() on failure. If the message buffer is too small then olm_session_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If there weren’t enough random bytes then olm_session_last_error() will be “NOT_ENOUGH_RANDOM”.
- olm_
encrypt_ ⚠message_ length - The size of the next message in bytes for the given number of plain-text bytes.
- olm_
encrypt_ ⚠message_ type - The type of the next message that olm_encrypt() will return. Returns OLM_MESSAGE_TYPE_PRE_KEY if the message will be a PRE_KEY message. Returns OLM_MESSAGE_TYPE_MESSAGE if the message will be a normal message. Returns olm_error on failure.
- olm_
encrypt_ ⚠random_ length - The number of random bytes needed to encrypt the next message.
- olm_
error ⚠ - The value that olm will return from a function if there was an error
- olm_
export_ ⚠inbound_ group_ session - Export the base64-encoded ratchet key for this session, at the given index, in a format which can be used by olm_import_inbound_group_session
- olm_
export_ ⚠inbound_ group_ session_ length - Get the number of bytes returned by olm_export_inbound_group_session()
- olm_
get_ ⚠library_ version - Get the version number of the library. Arguments will be updated if non-null.
- olm_
group_ ⚠decrypt - Decrypt a message.
- olm_
group_ ⚠decrypt_ max_ plaintext_ length - Get an upper bound on the number of bytes of plain-text the decrypt method will write for a given input message length. The actual size could be different due to padding.
- olm_
group_ ⚠encrypt - Encrypt some plain-text. Returns the length of the encrypted message or olm_error() on failure. On failure last_error will be set with an error code. The last_error will be OUTPUT_BUFFER_TOO_SMALL if the output buffer is too small.
- olm_
group_ ⚠encrypt_ message_ length - The number of bytes that will be created by encrypting a message
- olm_
import_ ⚠inbound_ group_ session - Import an inbound group session, from a previous export.
- olm_
inbound_ ⚠group_ session - Initialise an inbound group session object using the supplied memory The supplied memory should be at least olm_inbound_group_session_size() bytes.
- olm_
inbound_ ⚠group_ session_ first_ known_ index - Get the first message index we know how to decrypt.
- olm_
inbound_ ⚠group_ session_ id - Get a base64-encoded identifier for this session.
- olm_
inbound_ ⚠group_ session_ id_ length - Get the number of bytes returned by olm_inbound_group_session_id()
- olm_
inbound_ ⚠group_ session_ is_ verified - Check if the session has been verified as a valid session.
- olm_
inbound_ ⚠group_ session_ last_ error - A null terminated string describing the most recent error to happen to a group session
- olm_
inbound_ ⚠group_ session_ last_ error_ code - An error code describing the most recent error to happen to a group session
- olm_
inbound_ ⚠group_ session_ size - get the size of an inbound group session, in bytes.
- olm_
init_ ⚠inbound_ group_ session - Start a new inbound group session, from a key exported from olm_outbound_group_session_key
- olm_
init_ ⚠outbound_ group_ session - Start a new outbound group session. Returns olm_error() on failure. On failure last_error will be set with an error code. The last_error will be NOT_ENOUGH_RANDOM if the number of random bytes was too small.
- olm_
init_ ⚠outbound_ group_ session_ random_ length - The number of random bytes needed to create an outbound group session
- olm_
matches_ ⚠inbound_ session - Checks if the PRE_KEY message is for this in-bound session. This can happen if multiple messages are sent to this account before this account sends a message in reply. The one_time_key_message buffer is destroyed. Returns 1 if the session matches. Returns 0 if the session does not match. Returns olm_error() on failure. If the base64 couldn’t be decoded then olm_session_last_error will be “INVALID_BASE64”. If the message was for an unsupported protocol version then olm_session_last_error() will be “BAD_MESSAGE_VERSION”. If the message couldn’t be decoded then then olm_session_last_error() will be “BAD_MESSAGE_FORMAT”.
- olm_
matches_ ⚠inbound_ session_ from - Checks if the PRE_KEY message is for this in-bound session. This can happen if multiple messages are sent to this account before this account sends a message in reply. The one_time_key_message buffer is destroyed. Returns 1 if the session matches. Returns 0 if the session does not match. Returns olm_error() on failure. If the base64 couldn’t be decoded then olm_session_last_error will be “INVALID_BASE64”. If the message was for an unsupported protocol version then olm_session_last_error() will be “BAD_MESSAGE_VERSION”. If the message couldn’t be decoded then then olm_session_last_error() will be “BAD_MESSAGE_FORMAT”.
- olm_
outbound_ ⚠group_ session - Initialise an outbound group session object using the supplied memory The supplied memory should be at least olm_outbound_group_session_size() bytes.
- olm_
outbound_ ⚠group_ session_ id - Get a base64-encoded identifier for this session.
- olm_
outbound_ ⚠group_ session_ id_ length - Get the number of bytes returned by olm_outbound_group_session_id()
- olm_
outbound_ ⚠group_ session_ key - Get the base64-encoded current ratchet key for this session.
- olm_
outbound_ ⚠group_ session_ key_ length - Get the number of bytes returned by olm_outbound_group_session_key()
- olm_
outbound_ ⚠group_ session_ last_ error - A null terminated string describing the most recent error to happen to a group session
- olm_
outbound_ ⚠group_ session_ last_ error_ code - An error code describing the most recent error to happen to a group session
- olm_
outbound_ ⚠group_ session_ message_ index - Get the current message index for this session.
- olm_
outbound_ ⚠group_ session_ size - get the size of an outbound group session, in bytes.
- olm_
pickle_ ⚠account - Stores an account as a base64 string. Encrypts the account using the supplied key. Returns the length of the pickled account on success. Returns olm_error() on failure. If the pickle output buffer is smaller than olm_pickle_account_length() then olm_account_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”
- olm_
pickle_ ⚠account_ length - Returns the number of bytes needed to store an account
- olm_
pickle_ ⚠inbound_ group_ session - Stores a group session as a base64 string. Encrypts the session using the supplied key. Returns the length of the session on success.
- olm_
pickle_ ⚠inbound_ group_ session_ length - Returns the number of bytes needed to store an inbound group session
- olm_
pickle_ ⚠outbound_ group_ session - Stores a group session as a base64 string. Encrypts the session using the supplied key. Returns the length of the session on success.
- olm_
pickle_ ⚠outbound_ group_ session_ length - Returns the number of bytes needed to store an outbound group session
- olm_
pickle_ ⚠pk_ decryption - Stores decryption object as a base64 string. Encrypts the object using the supplied key. Returns the length of the pickled object on success. Returns olm_error() on failure. If the pickle output buffer is smaller than olm_pickle_pk_decryption_length() then olm_pk_decryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”
- olm_
pickle_ ⚠pk_ decryption_ length - Returns the number of bytes needed to store a decryption object.
- olm_
pickle_ ⚠session - Stores a session as a base64 string. Encrypts the session using the supplied key. Returns the length of the pickled session on success. Returns olm_error() on failure. If the pickle output buffer is smaller than olm_pickle_session_length() then olm_session_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”
- olm_
pickle_ ⚠session_ length - Returns the number of bytes needed to store a session
- olm_
pk_ ⚠ciphertext_ length - Get the length of the ciphertext that will correspond to a plaintext of the given length.
- olm_
pk_ ⚠decrypt - Decrypt a ciphertext. The input ciphertext buffer is destroyed. See the olm_pk_encrypt function for descriptions of the ephemeral_key and mac arguments. Returns the length of the plaintext on success. Returns olm_error() on failure. If the plaintext buffer is too small then olm_pk_encryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”.
- olm_
pk_ ⚠decryption - Initialise a decryption object using the supplied memory The supplied memory must be at least olm_pk_decryption_size() bytes
- olm_
pk_ ⚠decryption_ last_ error - A null terminated string describing the most recent error to happen to a decription object
- olm_
pk_ ⚠decryption_ last_ error_ code - An error code describing the most recent error to happen to a decription object
- olm_
pk_ ⚠decryption_ size - olm_
pk_ ⚠encrypt - Encrypt a plaintext for the recipient set using olm_pk_encryption_set_recipient_key. Writes to the ciphertext, mac, and ephemeral_key buffers, whose values should be sent to the recipient. mac is a Message Authentication Code to ensure that the data is received and decrypted properly. ephemeral_key is the public part of the ephemeral key used (together with the recipient’s key) to generate a symmetric encryption key. Returns olm_error() on failure. If the ciphertext, mac, or ephemeral_key buffers were too small then olm_pk_encryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If there weren’t enough random bytes then olm_pk_encryption_last_error() will be “OLM_INPUT_BUFFER_TOO_SMALL”.
- olm_
pk_ ⚠encrypt_ random_ length - The number of random bytes needed to encrypt a message.
- olm_
pk_ ⚠encryption - Initialise an encryption object using the supplied memory The supplied memory must be at least olm_pk_encryption_size() bytes
- olm_
pk_ ⚠encryption_ last_ error - A null terminated string describing the most recent error to happen to an encryption object
- olm_
pk_ ⚠encryption_ last_ error_ code - An error code describing the most recent error to happen to an encryption object
- olm_
pk_ ⚠encryption_ set_ recipient_ key - Set the recipient’s public key for encrypting to
- olm_
pk_ ⚠encryption_ size - olm_
pk_ ⚠generate_ key - DEPRECATED: Use olm_pk_key_from_private
- olm_
pk_ ⚠generate_ key_ random_ length - DEPRECATED: Use olm_pk_private_key_length()
- olm_
pk_ ⚠get_ private_ key - Get the private key for an OlmDecryption object as an unencoded byte array private_key must be a pointer to a buffer of at least olm_pk_private_key_length() bytes and this length must be passed in private_key_length. If the given buffer is too small, returns olm_error() and olm_pk_encryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. Returns the number of bytes written.
- olm_
pk_ ⚠key_ from_ private - Initialise the key from the private part of a key as returned by olm_pk_get_private_key(). The associated public key will be written to the pubkey buffer. Returns olm_error() on failure. If the pubkey buffer is too small then olm_pk_decryption_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If the private key was not long enough then olm_pk_decryption_last_error() will be “OLM_INPUT_BUFFER_TOO_SMALL”.
- olm_
pk_ ⚠key_ length - Get the length of a public or ephemeral key
- olm_
pk_ ⚠mac_ length - Get the length of the message authentication code.
- olm_
pk_ ⚠max_ plaintext_ length - Get the length of the plaintext that will correspond to a ciphertext of the given length.
- olm_
pk_ ⚠private_ key_ length - Get the number of bytes required to store an olm private key
- olm_
pk_ ⚠sign - Sign a message. The signature will be written to the signature buffer. Returns olm_error() on failure. If the signature buffer is too small, olm_pk_signing_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”.
- olm_
pk_ ⚠signature_ length - The size of a signature created by a signing object.
- olm_
pk_ ⚠signing - Initialise a signing object using the supplied memory The supplied memory must be at least olm_pk_signing_size() bytes
- olm_
pk_ ⚠signing_ key_ from_ seed - Initialise the signing object with a public/private keypair from a seed. The associated public key will be written to the pubkey buffer. Returns olm_error() on failure. If the public key buffer is too small then olm_pk_signing_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”. If the seed buffer is too small then olm_pk_signing_last_error() will be “INPUT_BUFFER_TOO_SMALL”.
- olm_
pk_ ⚠signing_ last_ error - A null terminated string describing the most recent error to happen to a signing object
- olm_
pk_ ⚠signing_ last_ error_ code - A null terminated string describing the most recent error to happen to a signing object
- olm_
pk_ ⚠signing_ public_ key_ length - The size of the public key of a signing object.
- olm_
pk_ ⚠signing_ seed_ length - The size required for the seed for initialising a signing object.
- olm_
pk_ ⚠signing_ size - olm_
remove_ ⚠one_ time_ keys - Removes the one time keys that the session used from the account. Returns olm_error() on failure. If the account doesn’t have any matching one time keys then olm_account_last_error() will be “BAD_MESSAGE_KEY_ID”.
- olm_sas⚠
- Initialize an SAS object using the supplied memory.
The supplied memory must be at least
olm_sas_size()
bytes. - olm_
sas_ ⚠calculate_ mac - Generate a message authentication code (MAC) based on the shared secret.
- olm_
sas_ ⚠calculate_ mac_ fixed_ base64 - olm_
sas_ ⚠calculate_ mac_ long_ kdf - olm_
sas_ ⚠generate_ bytes - Generate bytes to use for the short authentication string.
- olm_
sas_ ⚠get_ pubkey - Get the public key for the SAS object.
- olm_
sas_ ⚠is_ their_ key_ set - Checks if their key was set.
- olm_
sas_ ⚠last_ error - A null terminated string describing the most recent error to happen to an SAS object.
- olm_
sas_ ⚠last_ error_ code - An error code describing the most recent error to happen to an SAS object.
- olm_
sas_ ⚠mac_ length - The size of the message authentication code generated by olm_sas_calculate_mac()`.
- olm_
sas_ ⚠pubkey_ length - The size of a public key in bytes.
- olm_
sas_ ⚠set_ their_ key - Sets the public key of other user.
- olm_
sas_ ⚠size - The size of an SAS object in bytes.
- olm_
session ⚠ - Initialise a session object using the supplied memory The supplied memory must be at least olm_session_size() bytes
- olm_
session_ ⚠describe - Write a null-terminated string describing the internal state of an olm session to the buffer provided for debugging and logging purposes.
- olm_
session_ ⚠has_ received_ message - olm_
session_ ⚠id - An identifier for this session. Will be the same for both ends of the conversation. If the id buffer is too small then olm_session_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”.
- olm_
session_ ⚠id_ length - The length of the buffer needed to return the id for this session.
- olm_
session_ ⚠last_ error - A null terminated string describing the most recent error to happen to a session
- olm_
session_ ⚠last_ error_ code - An error code describing the most recent error to happen to a session
- olm_
session_ ⚠size - The size of a session object in bytes
- olm_
sha256 ⚠ - Calculates the SHA-256 hash of the input and encodes it as base64. If the output buffer is smaller than olm_sha256_length() then olm_utility_last_error() will be “OUTPUT_BUFFER_TOO_SMALL”.
- olm_
sha256_ ⚠length - The length of the buffer needed to hold the SHA-256 hash.
- olm_
unpickle_ ⚠account - Loads an account from a pickled base64 string. Decrypts the account using the supplied key. Returns olm_error() on failure. If the key doesn’t match the one used to encrypt the account then olm_account_last_error() will be “BAD_ACCOUNT_KEY”. If the base64 couldn’t be decoded then olm_account_last_error() will be “INVALID_BASE64”. The input pickled buffer is destroyed
- olm_
unpickle_ ⚠inbound_ group_ session - Loads a group session from a pickled base64 string. Decrypts the session using the supplied key.
- olm_
unpickle_ ⚠outbound_ group_ session - Loads a group session from a pickled base64 string. Decrypts the session using the supplied key.
- olm_
unpickle_ ⚠pk_ decryption - Loads a decryption object from a pickled base64 string. The associated public key will be written to the pubkey buffer. Decrypts the object using the supplied key. Returns olm_error() on failure. If the key doesn’t match the one used to encrypt the account then olm_pk_decryption_last_error() will be “BAD_ACCOUNT_KEY”. If the base64 couldn’t be decoded then olm_pk_decryption_last_error() will be “INVALID_BASE64”. The input pickled buffer is destroyed
- olm_
unpickle_ ⚠session - Loads a session from a pickled base64 string. Decrypts the session using the supplied key. Returns olm_error() on failure. If the key doesn’t match the one used to encrypt the account then olm_session_last_error() will be “BAD_ACCOUNT_KEY”. If the base64 couldn’t be decoded then olm_session_last_error() will be “INVALID_BASE64”. The input pickled buffer is destroyed
- olm_
utility ⚠ - Initialise a utility object using the supplied memory The supplied memory must be at least olm_utility_size() bytes
- olm_
utility_ ⚠last_ error - A null terminated string describing the most recent error to happen to a utility
- olm_
utility_ ⚠last_ error_ code - An error code describing the most recent error to happen to a utility
- olm_
utility_ ⚠size - The size of a utility object in bytes
Type Aliases§
- OlmError
Code - __
blkcnt64_ t - __
blkcnt_ t - __
blksize_ t - __
caddr_ t - __
clock_ t - __
clockid_ t - __
daddr_ t - __dev_t
- __
fsblkcnt64_ t - __
fsblkcnt_ t - __
fsfilcnt64_ t - __
fsfilcnt_ t - __
fsword_ t - __gid_t
- __id_t
- __
ino64_ t - __ino_t
- __
int8_ t - __
int16_ t - __
int32_ t - __
int64_ t - __
int_ least8_ t - __
int_ least16_ t - __
int_ least32_ t - __
int_ least64_ t - __
intmax_ t - __
intptr_ t - __key_t
- __
loff_ t - __
mode_ t - __
nlink_ t - __
off64_ t - __off_t
- __pid_t
- __
quad_ t - __
rlim64_ t - __
rlim_ t - __
sig_ atomic_ t - __
socklen_ t - __
ssize_ t - __
suseconds64_ t - __
suseconds_ t - __
syscall_ slong_ t - __
syscall_ ulong_ t - __
time_ t - __
timer_ t - __
u_ char - __u_int
- __
u_ long - __
u_ quad_ t - __
u_ short - __uid_t
- __
uint8_ t - __
uint16_ t - __
uint32_ t - __
uint64_ t - __
uint_ least8_ t - __
uint_ least16_ t - __
uint_ least32_ t - __
uint_ least64_ t - __
uintmax_ t - __
useconds_ t - int_
fast8_ t - int_
fast16_ t - int_
fast32_ t - int_
fast64_ t - int_
least8_ t - int_
least16_ t - int_
least32_ t - int_
least64_ t - intmax_
t - uint_
fast8_ t - uint_
fast16_ t - uint_
fast32_ t - uint_
fast64_ t - uint_
least8_ t - uint_
least16_ t - uint_
least32_ t - uint_
least64_ t - uintmax_
t - wchar_t