Struct yasna::models::TaggedDerValue[][src]

pub struct TaggedDerValue { /* fields omitted */ }

Container for a tag and arbitrary DER value.

When obtained by BERReader::read_tagged_der in DER mode, the reader verifies that the payload is actually valid DER. When constructed from bytes, the caller is responsible for providing valid DER.

Implementations

impl TaggedDerValue[src]

pub fn from_octetstring(bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue as an octet string

pub fn from_tag_and_bytes(tag: Tag, bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue from its tag and content

pub fn from_tag_pc_and_bytes(tag: Tag, pcbit: PCBit, bytes: Vec<u8>) -> Self[src]

Constructs a new TaggedDerValue from its tag, primitive/constructed bit, and content

pub fn tag(&self) -> Tag[src]

Returns the tag

pub fn pcbit(&self) -> PCBit[src]

Returns the primitive/constructed bit

pub fn value(&self) -> &[u8][src]

Returns the value

pub fn as_bytes(&self) -> Option<&[u8]>[src]

If the value is something that contains raw bytes, returns its content.

Examples

use yasna::models::TaggedDerValue;
let value = TaggedDerValue::from_octetstring(vec![1, 2, 3, 4, 5, 6]);
assert!(value.as_bytes() == Some(&[1, 2, 3, 4, 5, 6]));

pub fn as_str(&self) -> Option<&str>[src]

If the value is something string-like, returns it as string.

Trait Implementations

impl BERDecodable for TaggedDerValue[src]

impl Clone for TaggedDerValue[src]

impl Debug for TaggedDerValue[src]

impl Eq for TaggedDerValue[src]

impl Hash for TaggedDerValue[src]

impl Ord for TaggedDerValue[src]

impl PartialEq<TaggedDerValue> for TaggedDerValue[src]

impl PartialOrd<TaggedDerValue> for TaggedDerValue[src]

impl StructuralEq for TaggedDerValue[src]

impl StructuralPartialEq for TaggedDerValue[src]

Auto Trait Implementations

impl RefUnwindSafe for TaggedDerValue

impl Send for TaggedDerValue

impl Sync for TaggedDerValue

impl Unpin for TaggedDerValue

impl UnwindSafe for TaggedDerValue

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.