Skip to main content

Kyber

Struct Kyber 

Source
pub struct Kyber<ProcessStatus = Encryption, KyberSize = Kyber1024, ContentStatus = Files, AlgorithmParam = AES>
where KyberSize: KyberSizeVariant,
{ /* private fields */ }
Expand description

Represents a generic Kyber structure with templated parameters for process status, Kyber size, content status, and algorithm parameter.

Implementations§

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus, AlgorithmParam> Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>

Source

pub fn new(key: Vec<u8>, nonce: Option<String>) -> Result<Self, CryptError>

Constructs a new Kyber instance with a key and an optional nonce.

Source

pub fn get_key(&self) -> Result<Vec<u8>, CryptError>

Returns the cryptographic key.

Source

pub fn get_nonce(&self) -> Result<&str, CryptError>

Returns the nonce.

Source

pub fn hmac_sha256(&mut self) -> Result<(), CryptError>

Switches the HMAC size to SHA-256 (default is SHA-512).

Source§

impl Kyber<Encryption, Kyber1024, Files, AES>

Usable when KyberSize = Kyber1024

Source§

impl Kyber<Encryption, Kyber768, Files, AES>

Usable when KyberSize = Kyber768

Source§

impl Kyber<Encryption, Kyber512, Files, AES>

Usable when KyberSize = Kyber512

Source§

impl Kyber<Encryption, Kyber1024, Files, AesGcmSiv>

Usable when KyberSize = Kyber1024

Source§

impl Kyber<Encryption, Kyber768, Files, AesGcmSiv>

Usable when KyberSize = Kyber768

Source§

impl Kyber<Encryption, Kyber512, Files, AesGcmSiv>

Usable when KyberSize = Kyber512

Source§

impl Kyber<Encryption, Kyber1024, Files, AesCtr>

Usable when KyberSize = Kyber1024

Source§

impl Kyber<Encryption, Kyber768, Files, AesCtr>

Usable when KyberSize = Kyber768

Source§

impl Kyber<Encryption, Kyber512, Files, AesCtr>

Usable when KyberSize = Kyber512

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Usable when AlgorithmParam = AES

Source

pub fn xchacha20( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Source

pub fn aes_gcm_siv( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Source

pub fn aes_ctr(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Source

pub fn aes_xts(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Source

pub fn xchacha20poly1305( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Usable when AlgorithmParam = XChaCha20

Source

pub fn aes(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Source

pub fn aes_gcm_siv( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Source

pub fn aes_ctr(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Source

pub fn aes_xts(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Source

pub fn xchacha20poly1305( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Usable when AlgorithmParam = XChaCha20Poly1305

Source

pub fn aes(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Source

pub fn aes_gcm_siv( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Source

pub fn aes_ctr(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Source

pub fn aes_xts(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Source

pub fn xchacha20( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Usable when AlgorithmParam = AesGcmSiv

Source

pub fn xchacha20( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Source

pub fn xchacha20poly1305( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Source

pub fn aes(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Source

pub fn aes_ctr(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Source

pub fn aes_xts(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Usable when AlgorithmParam = AesCtr

Source

pub fn xchacha20( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Source

pub fn aes(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Source

pub fn aes_gcm_siv( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Source

pub fn aes_xts(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Source

pub fn xchacha20poly1305( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, ContentStatus> Kyber<ProcessStatus, KyberSize, ContentStatus, AesXts>

Usable when AlgorithmParam = AesXts

Source

pub fn xchacha20( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20>

Source

pub fn xchacha20poly1305( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, XChaCha20Poly1305>

Source

pub fn aes(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AES>

Source

pub fn aes_gcm_siv( self, ) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesGcmSiv>

Source

pub fn aes_ctr(self) -> Kyber<ProcessStatus, KyberSize, ContentStatus, AesCtr>

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, AlgorithmParam> Kyber<ProcessStatus, KyberSize, Files, AlgorithmParam>

Usable when ContentStatus = Files

Source

pub fn message(self) -> Kyber<ProcessStatus, KyberSize, Message, AlgorithmParam>

Source

pub fn data(self) -> Kyber<ProcessStatus, KyberSize, Data, AlgorithmParam>

Source

pub fn is_file(self) -> bool

Source

pub fn is_message(self) -> bool

Source

pub fn is_data(self) -> bool

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, AlgorithmParam> Kyber<ProcessStatus, KyberSize, Message, AlgorithmParam>

Usable when ContentStatus = Message

Source

pub fn file(self) -> Kyber<ProcessStatus, KyberSize, Files, AlgorithmParam>

Source

pub fn data(self) -> Kyber<ProcessStatus, KyberSize, Data, AlgorithmParam>

Source

pub fn is_file(self) -> bool

Source

pub fn is_message(self) -> bool

Source

pub fn is_data(self) -> bool

Source§

impl<ProcessStatus, KyberSize: KyberSizeVariant, AlgorithmParam> Kyber<ProcessStatus, KyberSize, Data, AlgorithmParam>

Usable when ContentStatus = Data

Source

pub fn file(self) -> Kyber<ProcessStatus, KyberSize, Files, AlgorithmParam>

Source

pub fn message(self) -> Kyber<ProcessStatus, KyberSize, Message, AlgorithmParam>

Source

pub fn is_file(self) -> bool

Source

pub fn is_message(self) -> bool

Source

pub fn is_data(self) -> bool

Source§

impl<KyberSize: KyberSizeVariant, ContentStatus, AlgorithmParam> Kyber<Encryption, KyberSize, ContentStatus, AlgorithmParam>

Usable when ProcessStatus = Encryption

Source

pub fn decryption(self) -> Kyber<Decryption, KyberSize, Message, AlgorithmParam>

Source§

impl<KyberSize: KyberSizeVariant, ContentStatus, AlgorithmParam> Kyber<Decryption, KyberSize, ContentStatus, AlgorithmParam>

Usable when ProcessStatus = Decryption

Source

pub fn encryption(self) -> Kyber<Encryption, KyberSize, Files, AlgorithmParam>

Auto Trait Implementations§

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> Freeze for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> RefUnwindSafe for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>
where ContentStatus: RefUnwindSafe, KyberSize: RefUnwindSafe, AlgorithmParam: RefUnwindSafe, ProcessStatus: RefUnwindSafe,

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> Send for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>
where ContentStatus: Send, KyberSize: Send, AlgorithmParam: Send, ProcessStatus: Send,

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> Sync for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>
where ContentStatus: Sync, KyberSize: Sync, AlgorithmParam: Sync, ProcessStatus: Sync,

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> Unpin for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>
where ContentStatus: Unpin, KyberSize: Unpin, AlgorithmParam: Unpin, ProcessStatus: Unpin,

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> UnsafeUnpin for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>

§

impl<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam> UnwindSafe for Kyber<ProcessStatus, KyberSize, ContentStatus, AlgorithmParam>
where ContentStatus: UnwindSafe, KyberSize: UnwindSafe, AlgorithmParam: UnwindSafe, ProcessStatus: UnwindSafe,

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> 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> Same for T

Source§

type Output = T

Should always be Self
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