#[non_exhaustive]pub enum Algorithm {
Dsa,
Ecdsa {
curve: EcdsaCurve,
},
Ed25519,
Rsa {
hash: Option<HashAlg>,
},
SkEcdsaSha2NistP256,
SkEd25519,
MlDsa44Ed25519,
MlDsa87P384,
Other(AlgorithmName),
}Expand description
SSH key algorithms, i.e. digital signature algorithms used with SSH private/public keys.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dsa
Digital Signature Algorithm
Ecdsa
Elliptic Curve Digital Signature Algorithm
Fields
curve: EcdsaCurveElliptic curve with which to instantiate ECDSA.
Ed25519
Ed25519
Rsa
RSA
Fields
SkEcdsaSha2NistP256
FIDO/U2F key with ECDSA/NIST-P256 + SHA-256
SkEd25519
FIDO/U2F key with Ed25519
MlDsa44Ed25519
ed25519 and mldsa only.MLDSA44-Ed25519-SHA512 composite signature algorithm.
MlDsa87P384
mldsa and p384 only.MLDSA87-P384-SHA512 composite signature algorithm.
Other(AlgorithmName)
alloc only.Other
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn new(id: &str) -> Result<Self>
pub fn new(id: &str) -> Result<Self>
Decode algorithm from the given string identifier.
§Supported algorithms
ecdsa-sha2-nistp256ecdsa-sha2-nistp384ecdsa-sha2-nistp521ssh-dssssh-ed25519ssh-rsask-ecdsa-sha2-nistp256@openssh.com(FIDO/U2F key)sk-ssh-ed25519@openssh.com(FIDO/U2F key)ssh-mldsa44-ed25519ssh-mldsa87-p384
Any other algorithms are mapped to the Algorithm::Other variant.
§Errors
Returns Error::Encoding in the event the algorithm name is not known.
Sourcepub fn new_certificate(id: &str) -> Result<Self>
pub fn new_certificate(id: &str) -> Result<Self>
Decode algorithm from the given string identifier as used by the OpenSSH certificate format.
OpenSSH certificate algorithms end in *-cert-v01@openssh.com.
See draft-ietf-sshm-cert for more information.
§Supported algorithms
ssh-rsa-cert-v01@openssh.comssh-dss-cert-v01@openssh.comecdsa-sha2-nistp256-cert-v01@openssh.comecdsa-sha2-nistp384-cert-v01@openssh.comecdsa-sha2-nistp521-cert-v01@openssh.comssh-ed25519-cert-v01@openssh.comsk-ecdsa-sha2-nistp256-cert-v01@openssh.com(FIDO/U2F key)sk-ssh-ed25519-cert-v01@openssh.com(FIDO/U2F key)ssh-mldsa44-ed25519-certssh-mldsa87-p384-cert
Any other algorithms are mapped to the Algorithm::Other variant.
§Errors
Returns Error::AlgorithmUnknown in the event the algorithm is not known.
Sourcepub fn to_certificate_type(&self) -> String
Available on crate feature alloc only.
pub fn to_certificate_type(&self) -> String
alloc only.Get the string identifier which corresponds to the OpenSSH certificate format.
OpenSSH certificate algorithms end in *-cert-v01@openssh.com.
See draft-ietf-sshm-cert for more information.
Sourcepub fn is_ed25519(self) -> bool
pub fn is_ed25519(self) -> bool
Is the algorithm Ed25519?
Sourcepub fn is_mldsa44_ed25519(self) -> bool
Available on crate features ed25519 and mldsa only.
pub fn is_mldsa44_ed25519(self) -> bool
ed25519 and mldsa only.Is the algorithm the MLDSA44-Ed25519 composite scheme?
Sourcepub fn is_mldsa87_p384(self) -> bool
Available on crate features mldsa and p384 only.
pub fn is_mldsa87_p384(self) -> bool
mldsa and p384 only.Is the algorithm the MLDSA87-P384 composite scheme?
Trait Implementations§
impl Eq for Algorithm
Source§impl From<EcdsaCurve> for Algorithm
impl From<EcdsaCurve> for Algorithm
Source§fn from(curve: EcdsaCurve) -> Algorithm
fn from(curve: EcdsaCurve) -> Algorithm
impl Label for Algorithm
Source§impl Ord for Algorithm
impl Ord for Algorithm
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Algorithm
impl PartialOrd for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Forget for Algorithm
impl Freeze for Algorithm
impl Move for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithmwhere
RawVecInner: Send,
impl Sync for Algorithmwhere
RawVecInner: Sync,
impl Unpin for Algorithm
impl UnsafeUnpin for Algorithm
impl UnwindSafe for Algorithmwhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Encode for Twhere
T: Label,
impl<T> Encode for Twhere
T: Label,
Source§fn encoded_len(&self) -> Result<usize, Error>
fn encoded_len(&self) -> Result<usize, Error>
Source§fn encoded_len_prefixed(&self) -> Result<usize, Error>
fn encoded_len_prefixed(&self) -> Result<usize, Error>
uint32 length prefix. Read more