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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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 MediaSegments 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 DecryptionKeys 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

This uri points to a key file, which contains the cipher key.

Note

This field is required.

This uri points to a key file, which contains the cipher key.

Note

This field is required.

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()?;

Makes the struct independent of its lifetime, by taking ownership of all internal Cows.

Note

This is a relatively expensive operation.

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.