Skip to main content

IronCryptConfig

Struct IronCryptConfig 

Source
pub struct IronCryptConfig {
    pub standard: CryptoStandard,
    pub symmetric_algorithm: SymmetricAlgorithm,
    pub asymmetric_algorithm: AsymmetricAlgorithm,
    pub rsa_key_size: u32,
    pub buffer_size: usize,
    pub argon2_memory_cost: u32,
    pub argon2_time_cost: u32,
    pub argon2_parallelism: u32,
    pub password_criteria: PasswordCriteria,
    pub secrets: Option<SecretsConfig>,
    pub data_type_config: Option<DataTypeConfig>,
    pub audit: Option<AuditConfig>,
}
Expand description

Main configuration for an IronCrypt instance.

This struct allows for detailed customization of the security parameters used for encryption, key generation, and password hashing.

§Examples

Creating a custom configuration:

use ironcrypt::config::{IronCryptConfig, PasswordCriteria};
use ironcrypt::standards::CryptoStandard;

let custom_config = IronCryptConfig {
    standard: CryptoStandard::Custom,
    symmetric_algorithm: ironcrypt::algorithms::SymmetricAlgorithm::ChaCha20Poly1305,
    asymmetric_algorithm: ironcrypt::algorithms::AsymmetricAlgorithm::Ecc,
    rsa_key_size: 4096,
    buffer_size: 8192,
    argon2_memory_cost: 32768, // 32MB
    argon2_time_cost: 4,
    argon2_parallelism: 2,
    password_criteria: PasswordCriteria {
        min_length: 10,
        ..Default::default()
    },
    secrets: None,
    data_type_config: None,
    audit: None,
};

Fields§

§standard: CryptoStandard

The cryptographic standard to use.

This determines the set of algorithms and key sizes. If set to Custom, the symmetric_algorithm, asymmetric_algorithm, and rsa_key_size fields must be specified manually.

§symmetric_algorithm: SymmetricAlgorithm

The symmetric algorithm to use for data encryption.

Note: This is ignored if standard is not Custom.

§asymmetric_algorithm: AsymmetricAlgorithm

The asymmetric algorithm to use for key encapsulation.

Note: This is ignored if standard is not Custom.

§rsa_key_size: u32

The size of the RSA key in bits.

Note: This is ignored if standard is not Custom.

§buffer_size: usize

The size of the buffer to use for streaming operations (in bytes).

§argon2_memory_cost: u32

The memory cost (in KiB) for the Argon2 password hashing algorithm.

§argon2_time_cost: u32

The time cost (or number of iterations) for the Argon2 algorithm.

§argon2_parallelism: u32

The parallelism factor (or number of threads) for the Argon2 algorithm.

§password_criteria: PasswordCriteria

The criteria used to validate password strength.

§secrets: Option<SecretsConfig>

Configuration for the secret management backend.

§data_type_config: Option<DataTypeConfig>

Configuration for data type specific key management.

§audit: Option<AuditConfig>

Configuration for auditing.

Implementations§

Source§

impl IronCryptConfig

Source

pub fn from_file(path: &str) -> Result<Self, ConfigError>

Loads configuration from a TOML file.

Trait Implementations§

Source§

impl Clone for IronCryptConfig

Source§

fn clone(&self) -> IronCryptConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IronCryptConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IronCryptConfig

Source§

fn default() -> Self

Creates a new IronCryptConfig with secure and sensible default values.

Source§

impl<'de> Deserialize<'de> for IronCryptConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for IronCryptConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more