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

remove pkcs8 file loading functions #208

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions biscuit-auth/src/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use ed25519_dalek::*;

use nom::Finish;
use rand_core::{CryptoRng, RngCore};
#[cfg(feature = "pem")]
use std::path::Path;
use std::{convert::TryInto, fmt::Display, hash::Hash, ops::Drop, str::FromStr};
use zeroize::Zeroize;

Expand Down Expand Up @@ -58,20 +56,6 @@ impl KeyPair {
Ok(KeyPair { kp })
}

#[cfg(feature = "pem")]
pub fn from_private_key_der_file(path: impl AsRef<Path>) -> Result<Self, error::Format> {
let kp = SigningKey::read_pkcs8_der_file(path)
.map_err(|e| error::Format::InvalidKey(e.to_string()))?;
Ok(KeyPair { kp })
}

#[cfg(feature = "pem")]
pub fn from_private_key_pem_file(path: impl AsRef<Path>) -> Result<Self, error::Format> {
let kp = SigningKey::read_pkcs8_pem_file(path)
.map_err(|e| error::Format::InvalidKey(e.to_string()))?;
Ok(KeyPair { kp })
}

pub fn private(&self) -> PrivateKey {
let secret = self.kp.to_bytes();
PrivateKey(secret)
Expand Down
Loading