Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.5", default-features = false, features = ["alloc", "oid"] }
pkcs1 = { version = "0.7.5", default-features = false, features = ["alloc", "pkcs8"] }
pkcs8 = { version = "0.10.2", default-features = false, features = ["alloc"] }
signature = { version = "2", default-features = false , features = ["digest", "rand_core"] }
signature = { version = "2", default-features = false , features = ["alloc", "digest", "rand_core"] }
spki = { version = "0.7.2", default-features = false, features = ["alloc"] }
zeroize = { version = "1.5", features = ["alloc"] }

# optional dependencies
Expand Down
10 changes: 10 additions & 0 deletions src/pkcs1v15/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pub use ::signature::{
DigestSigner, DigestVerifier, Error, Keypair, RandomizedDigestSigner, RandomizedSigner, Result,
SignatureEncoding, Signer, Verifier,
};
use spki::{
der::{asn1::BitString, Result as DerResult},
SignatureBitStringEncoding,
};

use crate::algorithms::pad::uint_to_be_pad;
use alloc::{boxed::Box, string::ToString};
Expand All @@ -22,6 +26,12 @@ impl SignatureEncoding for Signature {
type Repr = Box<[u8]>;
}

impl SignatureBitStringEncoding for Signature {
fn to_bitstring(&self) -> DerResult<BitString> {
BitString::new(0, self.to_vec())
}
}

impl TryFrom<&[u8]> for Signature {
type Error = signature::Error;

Expand Down
10 changes: 10 additions & 0 deletions src/pss/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pub use ::signature::{
DigestSigner, DigestVerifier, Error, Keypair, RandomizedDigestSigner, RandomizedSigner, Result,
SignatureEncoding, Signer, Verifier,
};
use spki::{
der::{asn1::BitString, Result as DerResult},
SignatureBitStringEncoding,
};

use crate::algorithms::pad::uint_to_be_pad;
use alloc::{boxed::Box, string::ToString};
Expand All @@ -22,6 +26,12 @@ impl SignatureEncoding for Signature {
type Repr = Box<[u8]>;
}

impl SignatureBitStringEncoding for Signature {
fn to_bitstring(&self) -> DerResult<BitString> {
BitString::new(0, self.to_vec())
}
}

impl TryFrom<&[u8]> for Signature {
type Error = signature::Error;

Expand Down