Struct hls_m3u8::types::DecryptionKey [−][src]
#[non_exhaustive]pub struct DecryptionKey<'a> { pub method: EncryptionMethod, pub iv: InitializationVector, pub format: Option<KeyFormat>, pub versions: Option<KeyFormatVersions>, // some fields omitted }
Expand description
Specifies how to decrypt encrypted data from the server.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.method: EncryptionMethod
The encryption method, which has been used to encrypt the data.
An EncryptionMethod::Aes128
signals that the data is encrypted using
the Advanced Encryption Standard (AES) with a 128-bit key, Cipher Block
Chaining (CBC), and Public-Key Cryptography Standards #7 (PKCS7)
padding. CBC is restarted on each segment boundary, using either the
DecryptionKey::iv
field or the MediaSegment::number
as the IV.
An EncryptionMethod::SampleAes
means that the MediaSegment
s
contain media samples, such as audio or video, that are encrypted using
the Advanced Encryption Standard (Aes128). How these media streams are
encrypted and encapsulated in a segment depends on the media encoding
and the media format of the segment.
Note
This field is required.
iv: InitializationVector
An initialization vector (IV) is a fixed size input that can be used along with a secret key for data encryption.
Note
This field is optional and an absent value indicates that
MediaSegment::number
should be used instead.
format: Option<KeyFormat>
A server may offer multiple ways to retrieve a key by providing multiple
DecryptionKey
s with different KeyFormat
values.
An EncryptionMethod::Aes128
uses 16-octet (16 byte/128 bit) keys. If
the format is KeyFormat::Identity
, the key file is a single packed
array of 16 octets (16 byte/128 bit) in binary format.
Note
This field is optional.
versions: Option<KeyFormatVersions>
A list of numbers that can be used to indicate which version(s)
this instance complies with, if more than one version of a particular
KeyFormat
is defined.
Note
This field is optional.
Implementations
Creates a new DecryptionKey
from an uri pointing to the key data and
an EncryptionMethod
.
Example
use hls_m3u8::types::EncryptionMethod; let key = DecryptionKey::new(EncryptionMethod::Aes128, "https://www.example.uri/key");
Returns a builder for a DecryptionKey
.
Example
use hls_m3u8::types::{EncryptionMethod, KeyFormat}; let key = DecryptionKey::builder() .method(EncryptionMethod::Aes128) .uri("https://www.example.com/") .iv([ 16, 239, 143, 117, 140, 165, 85, 17, 85, 132, 187, 91, 60, 104, 127, 82, ]) .format(KeyFormat::Identity) .versions(&[1, 2, 3, 4, 5]) .build()?;
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for DecryptionKey<'a>
impl<'a> Send for DecryptionKey<'a>
impl<'a> Sync for DecryptionKey<'a>
impl<'a> Unpin for DecryptionKey<'a>
impl<'a> UnwindSafe for DecryptionKey<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more