#[derive(Debug)]
pub struct PrivateKeyError(pub Box<dyn std::error::Error + Send + Sync + 'static>);
impl std::fmt::Display for PrivateKeyError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}
impl std::error::Error for PrivateKeyError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
self.0.source()
}
}
impl PrivateKeyError {
pub fn new<E: std::error::Error + Send + Sync + 'static>(e: E) -> Self {
Self(Box::new(e))
}
}
#[derive(Debug)]
pub struct NoCryptoError;
impl std::fmt::Display for NoCryptoError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no crypto backend configured; cannot decrypt PKCS#12 encrypted bags \
(enable the 'openssl' feature or provide a Pkcs12Decryptor)",
)
}
}
impl std::error::Error for NoCryptoError {}
#[derive(Debug)]
pub struct NoEncryptorError;
impl std::fmt::Display for NoEncryptorError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no crypto backend configured; cannot encrypt content \
(enable the 'openssl' feature or provide an Encryptor implementation)",
)
}
}
impl std::error::Error for NoEncryptorError {}
#[derive(Debug)]
pub struct NoSignerError;
impl std::fmt::Display for NoSignerError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no certificate signer configured; cannot sign certificates \
(enable the 'openssl' feature or provide a CertificateSigner implementation)",
)
}
}
impl std::error::Error for NoSignerError {}
#[derive(Debug)]
pub struct NoSignatureVerifierError;
impl std::fmt::Display for NoSignatureVerifierError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no signature verifier configured; cannot verify certificate signatures \
(enable the 'openssl' feature or provide a SignatureVerifier implementation)",
)
}
}
impl std::error::Error for NoSignatureVerifierError {}
#[derive(Debug)]
pub struct NoKeyIdHasherError;
impl std::fmt::Display for NoKeyIdHasherError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no crypto backend configured: enable the 'openssl' feature \
for SubjectKeyIdentifier / AuthorityKeyIdentifier hashing",
)
}
}
impl std::error::Error for NoKeyIdHasherError {}
#[derive(Debug)]
pub struct NoEnvelopedDataDecryptorError;
impl std::fmt::Display for NoEnvelopedDataDecryptorError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(
"no crypto backend configured; cannot decrypt EnvelopedData \
(enable the 'openssl' feature or provide an EnvelopedDataDecryptor implementation)",
)
}
}
impl std::error::Error for NoEnvelopedDataDecryptorError {}