Skip to content

Commit

Permalink
fix: compile when the pem feature is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
doy authored Apr 26, 2021
1 parent c047ce9 commit 366ff6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- target: thumbv7m-none-eabi
test-target: arm-unknown-linux-gnueabi
args: --no-default-features --features=alloc
- rust: stable
target: x86_64-unknown-linux-gnu
args: --no-default-features --features=std
exclude:
- rust: 1.44.0
target: thumbv7m-none-eabi
Expand Down
3 changes: 3 additions & 0 deletions src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ use crate::{
};
use num_bigint::{BigUint, ToBigInt, ModInverse};
use num_traits::Zero;
#[cfg(feature = "pem")]
use pem::{EncodeConfig, LineEnding};
use simple_asn1::{to_der, ASN1Block, BigInt};
use std::prelude::v1::*;
use std::{vec, format};

const BYTE_BIT_SIZE: usize = 8;
#[cfg(feature = "pem")]
const DEFAULT_ENCODING_CONFIG: EncodeConfig = EncodeConfig {
line_ending: LineEnding::LF,
};
Expand Down Expand Up @@ -216,6 +218,7 @@ pub trait PublicKeyPemEncoding: PublicKeyEncoding {
}
}

#[cfg(feature = "pem")]
impl PublicKeyPemEncoding for RSAPublicKey {
const PKCS1_HEADER: &'static str = "RSA PUBLIC KEY";
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ mod pss;
mod raw;

#[cfg(feature = "std")]
pub use self::encode::{
PrivateKeyEncoding, PrivateKeyPemEncoding, PublicKeyEncoding, PublicKeyPemEncoding,
};
pub use self::encode::{PrivateKeyEncoding, PublicKeyEncoding};
#[cfg(all(feature = "std", feature = "pem"))]
pub use self::encode::{PrivateKeyPemEncoding, PublicKeyPemEncoding};
#[cfg(feature = "alloc")]
pub use self::hash::Hash;
#[cfg(feature = "alloc")]
Expand Down

0 comments on commit 366ff6e

Please sign in to comment.