Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AllowedSigners support #23

Merged
merged 16 commits into from
May 9, 2024
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ yubikey-lite = ["x509-support"]

[dependencies]
base64 = "0.13"
chrono = "0.4"
ring = "0.17"
zeroize = { version = "1", features = ["zeroize_derive"] }

Expand Down
7 changes: 7 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{fmt, io, string};
use crate::ssh::AllowedSignerParsingError;

/// A type to represent the different kinds of errors.
#[derive(Debug)]
Expand All @@ -22,6 +23,10 @@ pub enum Error {
KeyTypeMismatch,
/// The certificate is not signed correctly and invalid
InvalidSignature,
/// A parsing error for one allowed signer
InvalidAllowedSigner(AllowedSignerParsingError),
/// A parsing error for a collection/file of allowed signers
InvalidAllowedSigners(AllowedSignerParsingError, usize),
/// A cryptographic operation failed.
SigningError,
/// An encrypted private key was provided with no decryption key
Expand Down Expand Up @@ -58,6 +63,8 @@ impl fmt::Display for Error {
Error::NotCertificate => write!(f, "Not a certificate"),
Error::KeyTypeMismatch => write!(f, "Key type mismatch"),
Error::InvalidSignature => write!(f, "Data is improperly signed"),
Error::InvalidAllowedSigner(ref v) => write!(f, "Invalid allowed signer format: {}", v),
Error::InvalidAllowedSigners(ref v, line) => write!(f, "Invalid allowed signer format on line {}: {}", line, v),
Error::SigningError => write!(f, "Could not sign data"),
Error::EncryptedPrivateKey => write!(f, "Encountered encrypted private key with no decryption key"),
Error::EncryptedPrivateKeyNotSupported => write!(f, "This method of private key encryption is not supported or sshcerts was not compiled with encrypted private key support"),
Expand Down
Loading
Loading