MPDC: Multi Party Domain Cryptosystem 1.0.0.0b (A0)
MPDC Interior protocol
|
MPDC Cryptographic Functions. More...
Go to the source code of this file.
Functions | |
MPDC_EXPORT_API bool | mpdc_crypto_decrypt_stream (uint8_t *output, const uint8_t *seed, const uint8_t *input, size_t length) |
Decrypt a stream of bytes. | |
MPDC_EXPORT_API void | mpdc_crypto_encrypt_stream (uint8_t *output, const uint8_t *seed, const uint8_t *input, size_t length) |
Encrypt a stream of bytes. | |
MPDC_EXPORT_API void | mpdc_crypto_generate_application_keychain (uint8_t *seed, size_t seedlen, const char *password, size_t passlen, const char *username, size_t userlen) |
Generate a secure application key chain. | |
MPDC_EXPORT_API void | mpdc_crypto_generate_application_salt (uint8_t *output, size_t outlen) |
Generate a user-unique application salt from OS sources. | |
MPDC_EXPORT_API void | mpdc_crypto_generate_hash_code (char *output, const char *message, size_t msglen) |
Hash a message and write the resulting hash to an output array. | |
MPDC_EXPORT_API void | mpdc_crypto_generate_mac_code (char *output, size_t outlen, const char *message, size_t msglen, const char *key, size_t keylen) |
Compute a MAC (Message Authentication Code) for a message. | |
MPDC_EXPORT_API void | mpdc_crypto_hash_password (char *output, size_t outlen, const char *username, size_t userlen, const char *password, size_t passlen) |
Hash a password and user name. | |
MPDC_EXPORT_API bool | mpdc_crypto_password_minimum_check (const char *password, size_t passlen) |
Check a password for a minimum secure threshold. | |
MPDC_EXPORT_API bool | mpdc_crypto_password_verify (const char *username, size_t userlen, const char *password, size_t passlen, const char *hash, size_t hashlen) |
Verify a password against a stored hash. | |
MPDC_EXPORT_API uint8_t * | mpdc_crypto_secure_memory_allocate (size_t length) |
Allocate a block of secure memory. | |
MPDC_EXPORT_API void | mpdc_crypto_secure_memory_deallocate (uint8_t *block, size_t length) |
Release an allocated block of secure memory. | |
MPDC Cryptographic Functions.
This header defines the cryptographic functions used by the Multi-Party Domain Cryptosystem (MPDC). The crypto module encapsulates all operations required for secure data processing including:
Two configuration macros are provided to tune the passphrase hashing function:
These tests help ensure that the cryptographic foundation of MPDC is robust and reliable.
MPDC_EXPORT_API bool mpdc_crypto_decrypt_stream | ( | uint8_t * | output, |
const uint8_t * | seed, | ||
const uint8_t * | input, | ||
size_t | length ) |
Decrypt a stream of bytes.
output | [out] The output array receiving the plain-text. |
seed | [in, const] The secret seed array used as the decryption key (expected size: MPDC_CRYPTO_SEED_SIZE). |
input | [in, const] The cipher-text input. |
length | The number of bytes to decrypt. |
MPDC_EXPORT_API void mpdc_crypto_encrypt_stream | ( | uint8_t * | output, |
const uint8_t * | seed, | ||
const uint8_t * | input, | ||
size_t | length ) |
Encrypt a stream of bytes.
output | [out] The output array receiving the cipher-text. |
seed | [in, const] The secret seed array used as the encryption key (expected size: MPDC_CRYPTO_SEED_SIZE). |
input | [in, const] The plain-text input. |
length | The number of bytes to encrypt. |
MPDC_EXPORT_API void mpdc_crypto_generate_application_keychain | ( | uint8_t * | seed, |
size_t | seedlen, | ||
const char * | password, | ||
size_t | passlen, | ||
const char * | username, | ||
size_t | userlen ) |
Generate a secure application key chain.
Derives a secure key chain (seed) from the provided password and username combined with an application salt generated from OS-specific sources.
seed | [out] The output secret seed array. |
seedlen | The length of the seed array. |
password | [in, const] The password. |
passlen | The byte length of the password. |
username | [in, const] The computer's user name. |
userlen | The byte length of the user name. |
MPDC_EXPORT_API void mpdc_crypto_generate_application_salt | ( | uint8_t * | output, |
size_t | outlen ) |
Generate a user-unique application salt from OS sources.
The salt is generated by collecting system parameters such as the computer name, user name, and MAC address, and then hashing these values using SHAKE256.
output | [out] The secret seed array to receive the salt. |
outlen | The length of the salt array. |
MPDC_EXPORT_API void mpdc_crypto_generate_hash_code | ( | char * | output, |
const char * | message, | ||
size_t | msglen ) |
Hash a message and write the resulting hash to an output array.
Computes the SHA3-256 hash of the specified message.
output | [out] The output array receiving the hash. |
message | [in, const] A pointer to the message array. |
msglen | The length of the message. |
MPDC_EXPORT_API void mpdc_crypto_generate_mac_code | ( | char * | output, |
size_t | outlen, | ||
const char * | message, | ||
size_t | msglen, | ||
const char * | key, | ||
size_t | keylen ) |
Compute a MAC (Message Authentication Code) for a message.
Uses KMAC256 to compute a MAC from the provided message and key.
output | [out] The output array receiving the MAC. |
outlen | The byte length of the output array. |
message | [in, const] A pointer to the message array. |
msglen | The length of the message. |
key | [in, const] A pointer to the key array. |
keylen | The length of the key array. |
MPDC_EXPORT_API void mpdc_crypto_hash_password | ( | char * | output, |
size_t | outlen, | ||
const char * | username, | ||
size_t | userlen, | ||
const char * | password, | ||
size_t | passlen ) |
Hash a password and user name.
Combines the username and password with an application salt to compute a secure hash via KMAC256.
output | [out] The output array receiving the hash. |
outlen | The length of the output array. |
username | [in, const] The computer's user name. |
userlen | The byte length of the user name. |
password | [in, const] The password. |
passlen | The length of the password. |
MPDC_EXPORT_API bool mpdc_crypto_password_minimum_check | ( | const char * | password, |
size_t | passlen ) |
Check a password for a minimum secure threshold.
Evaluates the password for minimum requirements (such as inclusion of uppercase, lowercase, numeric, and special characters, and a minimum length).
password | [in, const] The password array. |
passlen | The byte length of the password. |
MPDC_EXPORT_API bool mpdc_crypto_password_verify | ( | const char * | username, |
size_t | userlen, | ||
const char * | password, | ||
size_t | passlen, | ||
const char * | hash, | ||
size_t | hashlen ) |
Verify a password against a stored hash.
Computes the hash of the username and password and compares it with a stored hash.
username | [in, const] The computer's user name. |
userlen | The byte length of the user name. |
password | [in, const] The password. |
passlen | The byte length of the password. |
hash | The stored hash to compare. |
hashlen | The length of the stored hash. |
MPDC_EXPORT_API uint8_t * mpdc_crypto_secure_memory_allocate | ( | size_t | length | ) |
Allocate a block of secure memory.
Allocates memory using secure allocation routines to prevent sensitive data from being paged or left in memory.
length | The number of bytes to allocate. |
MPDC_EXPORT_API void mpdc_crypto_secure_memory_deallocate | ( | uint8_t * | block, |
size_t | length ) |
Release an allocated block of secure memory.
Securely erases the memory block and then frees it.
block | The pointer to the memory block. |
length | The length of the memory block. |