#[non_exhaustive]
pub enum Algorithm {
Dsa,
Ecdsa {
curve: EcdsaCurve,
},
Ed25519,
Rsa {
hash: Option<HashAlg>,
},
SkEcdsaSha2NistP256,
SkEd25519,
}
Expand description
SSH key algorithms.
This type provides a registry of supported digital signature algorithms used for SSH keys.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Dsa
Digital Signature Algorithm
Ecdsa
Fields
curve: EcdsaCurve
Elliptic curve with which to instantiate ECDSA.
Elliptic Curve Digital Signature Algorithm
Ed25519
Ed25519
Rsa
Fields
RSA
SkEcdsaSha2NistP256
FIDO/U2F key with ECDSA/NIST-P256 + SHA-256
SkEd25519
FIDO/U2F key with Ed25519
Implementations
sourceimpl 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-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
ssh-dss
ssh-ed25519
ssh-rsa
sk-ecdsa-sha2-nistp256@openssh.com
(FIDO/U2F key)sk-ssh-ed25519@openssh.com
(FIDO/U2F key)
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 PROTOCOL.certkeys for more information.
Supported algorithms
ssh-rsa-cert-v01@openssh.com
ssh-dss-cert-v01@openssh.com
ecdsa-sha2-nistp256-cert-v01@openssh.com
ecdsa-sha2-nistp384-cert-v01@openssh.com
ecdsa-sha2-nistp521-cert-v01@openssh.com
ssh-ed25519-cert-v01@openssh.com
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com
(FIDO/U2F key)sk-ssh-ed25519-cert-v01@openssh.com
(FIDO/U2F key)
sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
Get the string identifier which corresponds to this algorithm.
sourcepub fn as_certificate_str(self) -> &'static str
pub fn as_certificate_str(self) -> &'static str
Get the string identifier which corresponds to the OpenSSH certificate format.
OpenSSH certificate algorithms end in *-cert-v01@openssh.com
.
See PROTOCOL.certkeys for more information.
sourcepub fn is_ed25519(self) -> bool
pub fn is_ed25519(self) -> bool
Is the algorithm Ed25519?
Trait Implementations
sourceimpl Ord for Algorithm
impl Ord for Algorithm
1.21.0 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialOrd<Algorithm> for Algorithm
impl PartialOrd<Algorithm> for Algorithm
sourcefn partial_cmp(&self, other: &Algorithm) -> Option<Ordering>
fn partial_cmp(&self, other: &Algorithm) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Algorithm
impl Eq for Algorithm
impl StructuralEq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Encode for Twhere
T: Label,
impl<T> Encode for Twhere
T: Label,
sourcefn encoded_len(&self) -> Result<usize, <T as Label>::Error>
fn encoded_len(&self) -> Result<usize, <T as Label>::Error>
sourcefn encode(&self, writer: &mut impl Writer) -> Result<(), <T as Label>::Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), <T as Label>::Error>
Writer
.sourcefn encoded_len_prefixed(&self) -> Result<usize, Self::Error>
fn encoded_len_prefixed(&self) -> Result<usize, Self::Error>
uint32
length prefix. Read more