pub struct Attribute {
pub value: GroupElement,
}Expand description
An attribute (in the background, this is a GroupElement), which should not be identifiable
and can be encrypted and rekeyed, but not reshuffled.
Fields§
§value: GroupElementMethods from Deref<Target = GroupElement>§
Sourcepub fn to_bytes(&self) -> [u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
Convert to a 32-byte array.
Any GroupElement can be converted this way.
Trait Implementations§
Source§impl BatchEncryptable for Attribute
Available on crate feature batch only.
impl BatchEncryptable for Attribute
Available on crate feature
batch only.fn preprocess_batch(items: &[Self]) -> Result<Vec<Self>, BatchError>
impl Copy for Attribute
Source§impl<'de> Deserialize<'de> for Attribute
impl<'de> Deserialize<'de> for Attribute
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 ElGamalEncryptable for Attribute
impl ElGamalEncryptable for Attribute
Source§fn value(&self) -> &GroupElement
fn value(&self) -> &GroupElement
Get the
GroupElement plaintext value.Source§fn from_value(value: GroupElement) -> Selfwhere
Self: Sized,
fn from_value(value: GroupElement) -> Selfwhere
Self: Sized,
Create from a
GroupElement.Source§fn from_point(value: GroupElement) -> Selfwhere
Self: Sized,
fn from_point(value: GroupElement) -> Selfwhere
Self: Sized,
Create from a
GroupElement.Source§fn random<R: Rng + CryptoRng>(rng: &mut R) -> Selfwhere
Self: Sized,
fn random<R: Rng + CryptoRng>(rng: &mut R) -> Selfwhere
Self: Sized,
Create with a random value.
Source§fn to_bytes(&self) -> [u8; 32]
fn to_bytes(&self) -> [u8; 32]
Encode as a byte array of length 32.
See
GroupElement::to_bytes.Source§fn from_bytes(bytes: &[u8; 32]) -> Option<Self>where
Self: Sized,
fn from_bytes(bytes: &[u8; 32]) -> Option<Self>where
Self: Sized,
Create from a byte array of length 32.
Returns
None if the input is not a valid encoding of a GroupElement.Source§fn from_slice(slice: &[u8]) -> Option<Self>where
Self: Sized,
fn from_slice(slice: &[u8]) -> Option<Self>where
Self: Sized,
Create from a slice of bytes.
Returns
None if the input is not a valid encoding of a GroupElement.Source§fn from_hex(hex: &str) -> Option<Self>where
Self: Sized,
fn from_hex(hex: &str) -> Option<Self>where
Self: Sized,
Create from a hexadecimal string.
Returns
None if the input is not a valid encoding of a GroupElement.Source§fn from_hash(hash: &[u8; 64]) -> Selfwhere
Self: Sized,
fn from_hash(hash: &[u8; 64]) -> Selfwhere
Self: Sized,
Create from a hash value.
See
GroupElement::from_hash.Source§fn from_lizard(data: &[u8; 16]) -> Selfwhere
Self: Sized,
fn from_lizard(data: &[u8; 16]) -> Selfwhere
Self: Sized,
Create from a byte array of length 16 using lizard encoding.
This is useful for creating a pseudonym from an existing identifier or encoding attributes,
as it accepts any 16-byte value.
See
GroupElement::from_lizard.Source§fn to_lizard(&self) -> Option<[u8; 16]>
fn to_lizard(&self) -> Option<[u8; 16]>
Encode as a byte array of length 16 using lizard encoding.
Returns
None if the point is not a valid lizard encoding of a 16-byte value.
See GroupElement::to_lizard.
If the value was created using ElGamalEncryptable::from_lizard, this will return a valid value,
but otherwise it will most likely return None.Source§impl Encryptable for Attribute
impl Encryptable for Attribute
Source§type EncryptedType = EncryptedAttribute
type EncryptedType = EncryptedAttribute
The encrypted version of this type.
Source§type PublicKeyType = AttributeSessionPublicKey
type PublicKeyType = AttributeSessionPublicKey
The session public key type required for encryption.
Source§type GlobalPublicKeyType = AttributeGlobalPublicKey
type GlobalPublicKeyType = AttributeGlobalPublicKey
The global public key type required for offline encryption.
Source§fn encrypt<R>(
&self,
public_key: &Self::PublicKeyType,
rng: &mut R,
) -> Self::EncryptedType
fn encrypt<R>( &self, public_key: &Self::PublicKeyType, rng: &mut R, ) -> Self::EncryptedType
Encrypt this value using a session key.
Source§fn encrypt_global<R>(
&self,
public_key: &Self::GlobalPublicKeyType,
rng: &mut R,
) -> Self::EncryptedType
fn encrypt_global<R>( &self, public_key: &Self::GlobalPublicKeyType, rng: &mut R, ) -> Self::EncryptedType
Encrypt this value using a global key (offline encryption).
impl Eq for Attribute
Source§impl From<GroupElement> for Attribute
impl From<GroupElement> for Attribute
Source§fn from(value: GroupElement) -> Self
fn from(value: GroupElement) -> Self
Converts to this type from the input type.
Source§impl Padded for Attribute
impl Padded for Attribute
Source§fn from_bytes_padded(data: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_padded(data: &[u8]) -> Result<Self, Error>where
Self: Sized,
Encodes an arbitrary byte array using PKCS#7 padding. Read more
Source§fn from_string_padded(text: &str) -> Result<Self, Error>where
Self: Sized,
fn from_string_padded(text: &str) -> Result<Self, Error>where
Self: Sized,
Encodes a string using PKCS#7 padding. Read more
impl StructuralPartialEq for Attribute
Auto Trait Implementations§
impl Freeze for Attribute
impl RefUnwindSafe for Attribute
impl Send for Attribute
impl Sync for Attribute
impl Unpin for Attribute
impl UnsafeUnpin for Attribute
impl UnwindSafe for Attribute
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
Mutably borrows from an owned value. Read more