Struct lock_keeper::crypto::cryptor::Encryptor
source · pub struct Encryptor {
data: Vec<u8>,
context: CryptorContext,
config: SensitiveInfoConfig,
}
Expand description
The Encryptor
type.
It contains data
to be encrypted, plus context
and config
fields.
Fields§
§data: Vec<u8>
The actual bytes of data to be encrypted.
context: CryptorContext
Additional context about the data.
config: SensitiveInfoConfig
Configuration
Implementations§
source§impl Encryptor
impl Encryptor
sourcepub fn new(
data: Vec<u8>,
context: CryptorContext,
config: SensitiveInfoConfig
) -> Self
pub fn new( data: Vec<u8>, context: CryptorContext, config: SensitiveInfoConfig ) -> Self
Constructs a new instance of Encryptor
type.
§Arguments
-
data
- A vector of bytes representing the data to be managed by the instance. -
context
- An instance ofCryptorContext
that provides necessary cryptographic context for operations that may be performed ondata
. -
config
- ASensitiveInfoConfig
instance that provides configuration details for managing sensitive information.
§Returns
- Returns a new instance of
Encryptor
type, initialized with the provideddata
,context
, andconfig
.
§Example
let data = vec![1, 2, 3, 4, 5];
let context = CryptorContext::new(...);
let config = SensitiveInfoConfig::new(true);
let encryptor = Encryptor::new(data, context, config);
sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
Returns a reference to the encrypted data bytes stored within the
Encryptor
instance.
This method provides read-only access to the internal data
field,
ensuring that the encrypted data cannot be modified directly by the
caller.
§Examples
// Assuming you've set up an `Encryptor` instance named `encryptor`
let data_bytes: &[u8] = encryptor.data();
§Returns
A byte slice (&[u8]
) that represents the encrypted data.
Returns a reference to the data bytes.
Trait Implementations§
source§impl PartialEq for Encryptor
impl PartialEq for Encryptor
Implement the PartialEq
trait for the Encryptor
type.
source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Determines if two Encryptor
instances are equal.
This function compares the data
and context
fields of two
Encryptor
instances. It does not compare the config
fields
because the config
field does not affect the functional equivalence of
two Encryptor
instances.
§Arguments
other
- The otherEncryptor
instance to compare with.
§Returns
Returns true
if the data
and context
fields are equal between the
two Encryptor
instances, Otherwise returns false
.
source§impl TryFrom<Encryptor> for Vec<u8>
impl TryFrom<Encryptor> for Vec<u8>
Implementation of the TryFrom
trait for converting to Vec<u8>
source§impl TryFrom<Vec<u8>> for Encryptor
impl TryFrom<Vec<u8>> for Encryptor
Implementation of the TryFrom
trait for converting from Vec<u8>
to
Encryptor
impl Eq for Encryptor
Auto Trait Implementations§
impl Freeze for Encryptor
impl RefUnwindSafe for Encryptor
impl Send for Encryptor
impl Sync for Encryptor
impl Unpin for Encryptor
impl UnwindSafe for Encryptor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request