Struct coset::CoseKeyBuilder

source ·
pub struct CoseKeyBuilder(/* private fields */);
Expand description

Builder for CoseKey objects.

Implementations§

source§

impl CoseKeyBuilder

source

pub fn new() -> Self

Constructor for builder.

source

pub fn build(self) -> CoseKey

Build the completed object.

source

pub fn kty(self, kty: KeyType) -> Self

Set the associated field.

source

pub fn key_id(self, key_id: Vec<u8>) -> Self

Set the associated field.

source

pub fn base_iv(self, base_iv: Vec<u8>) -> Self

Set the associated field.

source

pub fn new_ec2_pub_key(curve: EllipticCurve, x: Vec<u8>, y: Vec<u8>) -> Self

Constructor for an elliptic curve public key specified by x and y coordinates.

source

pub fn new_ec2_pub_key_y_sign( curve: EllipticCurve, x: Vec<u8>, y_sign: bool ) -> Self

Constructor for an elliptic curve public key specified by x coordinate plus sign of y coordinate.

source

pub fn new_ec2_priv_key( curve: EllipticCurve, x: Vec<u8>, y: Vec<u8>, d: Vec<u8> ) -> Self

Constructor for an elliptic curve private key specified by d, together with public x and y coordinates.

source

pub fn new_symmetric_key(k: Vec<u8>) -> Self

Constructor for a symmetric key specified by k.

source

pub fn new_okp_key() -> Self

Constructor for a octet keypair key.

source

pub fn key_type(self, key_type: KeyType) -> Self

Set the key type.

source

pub fn algorithm(self, alg: Algorithm) -> Self

Set the algorithm.

source

pub fn add_key_op(self, op: KeyOperation) -> Self

Add a key operation.

source

pub fn param(self, label: i64, value: Value) -> Self

Set a parameter value.

§Panics

This function will panic if it used to set a parameter label from the iana::KeyParameter range.

Trait Implementations§

source§

impl Debug for CoseKeyBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CoseKeyBuilder

source§

fn default() -> CoseKeyBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.