pub enum EcdsaSpec {
Es256,
Es384,
}Expand description
ECDSA algorithm specification.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
let es256 = EcdsaSpec::es256();
assert_eq!(es256.alg_name(), "ES256");
assert_eq!(es256.curve_name(), "P-256");
let es384 = EcdsaSpec::es384();
assert_eq!(es384.alg_name(), "ES384");
assert_eq!(es384.curve_name(), "P-384");Variants§
Es256
P-256 / secp256r1 / prime256v1 (for ES256 JWT signing).
Es384
P-384 / secp384r1 (for ES384 JWT signing).
Implementations§
Source§impl EcdsaSpec
impl EcdsaSpec
Sourcepub fn es256() -> Self
pub fn es256() -> Self
Spec suitable for ES256 JWT signing.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
let spec = EcdsaSpec::es256();
assert_eq!(spec.alg_name(), "ES256");
assert_eq!(spec.curve_name(), "P-256");Sourcepub fn es384() -> Self
pub fn es384() -> Self
Spec suitable for ES384 JWT signing.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
let spec = EcdsaSpec::es384();
assert_eq!(spec.alg_name(), "ES384");
assert_eq!(spec.curve_name(), "P-384");Sourcepub fn alg_name(&self) -> &'static str
pub fn alg_name(&self) -> &'static str
Returns the JWT algorithm name.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
assert_eq!(EcdsaSpec::es256().alg_name(), "ES256");
assert_eq!(EcdsaSpec::es384().alg_name(), "ES384");Sourcepub fn curve_name(&self) -> &'static str
pub fn curve_name(&self) -> &'static str
Returns the curve name.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
assert_eq!(EcdsaSpec::es256().curve_name(), "P-256");
assert_eq!(EcdsaSpec::es384().curve_name(), "P-384");Sourcepub fn coordinate_len_bytes(&self) -> usize
pub fn coordinate_len_bytes(&self) -> usize
Returns the expected coordinate length in bytes for uncompressed points.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
assert_eq!(EcdsaSpec::es256().coordinate_len_bytes(), 32);
assert_eq!(EcdsaSpec::es384().coordinate_len_bytes(), 48);Sourcepub fn stable_bytes(&self) -> [u8; 4]
pub fn stable_bytes(&self) -> [u8; 4]
Stable encoding for cache keys / deterministic derivation.
If you change this, bump the derivation version in uselesskey-core.
§Examples
use uselesskey_ecdsa::EcdsaSpec;
let bytes = EcdsaSpec::es256().stable_bytes();
assert_eq!(bytes.len(), 4);Trait Implementations§
impl Copy for EcdsaSpec
impl Eq for EcdsaSpec
impl StructuralPartialEq for EcdsaSpec
Auto Trait Implementations§
impl Freeze for EcdsaSpec
impl RefUnwindSafe for EcdsaSpec
impl Send for EcdsaSpec
impl Sync for EcdsaSpec
impl Unpin for EcdsaSpec
impl UnsafeUnpin for EcdsaSpec
impl UnwindSafe for EcdsaSpec
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