Struct field_encryption::FieldEncryption
source · pub struct FieldEncryption { /* private fields */ }
Expand description
FieldEncryption
struct. Provides methods to encrypt values matching the input regex to a
value matching the output regex (and to decrypt).
Both regular expressions must be finite, i.e. they must contain a bounded number of possible
values - so no unbounded expressions such as .*
or [0-9]+
are permitted.
Furthermore the number of possible values of the output regex must be equal to, or greater than, the number of possible values of the input regex, i.e. the ‘domain’ of the output regex must be greater than or equal to the ‘domain’ pf the input regex.
Implementations
sourceimpl FieldEncryption
impl FieldEncryption
sourcepub fn new(
input_regex: &str,
output_regex: &str,
key: &[u8]
) -> Result<Self, Error>
pub fn new(
input_regex: &str,
output_regex: &str,
key: &[u8]
) -> Result<Self, Error>
Create a new FieldEncryption
instance.
Arguments
input_regex
- the regular expression that describes all inputsoutput_regex
- the regular expression that describes all outputskey
- the encryption key, must be at least 32 bytes
Errors
InfiniteRegex
- if either regex is infiniteOutputDomainTooSmall
- if the domain of the output regex is < domain of the input regexInvalidKeyLength
- of the encryption key is too small
Auto Trait Implementations
impl !RefUnwindSafe for FieldEncryption
impl Send for FieldEncryption
impl !Sync for FieldEncryption
impl Unpin for FieldEncryption
impl UnwindSafe for FieldEncryption
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more