Add from_der and to_der to PKCS7
This commit is contained in:
parent
16a0e6f674
commit
96575db11d
|
|
@ -29,6 +29,10 @@ pub const PKCS7_REUSE_DIGEST: c_int = 0x8000;
|
||||||
pub const PKCS7_NO_DUAL_CONTENT: c_int = 0x10000;
|
pub const PKCS7_NO_DUAL_CONTENT: c_int = 0x10000;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
pub fn d2i_PKCS7(a: *mut *mut PKCS7, pp: *mut *const c_uchar, length: c_long) -> *mut PKCS7;
|
||||||
|
|
||||||
|
pub fn i2d_PKCS7(a: *mut PKCS7, buf: *mut *mut u8) -> c_int;
|
||||||
|
|
||||||
pub fn PKCS7_encrypt(
|
pub fn PKCS7_encrypt(
|
||||||
certs: *mut stack_st_X509,
|
certs: *mut stack_st_X509,
|
||||||
b: *mut BIO,
|
b: *mut BIO,
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,17 @@ impl Pkcs7 {
|
||||||
ffi::PEM_read_bio_PKCS7
|
ffi::PEM_read_bio_PKCS7
|
||||||
}
|
}
|
||||||
|
|
||||||
|
from_der! {
|
||||||
|
/// Deserializes a DER-encoded PKCS#7 signature
|
||||||
|
///
|
||||||
|
/// This corresponds to [`d2i_PKCS7`].
|
||||||
|
///
|
||||||
|
/// [`d2i_PKCS7`]: https://www.openssl.org/docs/man1.1.0/man3/d2i_PKCS7.html
|
||||||
|
from_der,
|
||||||
|
Pkcs7,
|
||||||
|
ffi::d2i_PKCS7
|
||||||
|
}
|
||||||
|
|
||||||
/// Parses a message in S/MIME format.
|
/// Parses a message in S/MIME format.
|
||||||
///
|
///
|
||||||
/// Returns the loaded signature, along with the cleartext message (if
|
/// Returns the loaded signature, along with the cleartext message (if
|
||||||
|
|
@ -181,6 +192,16 @@ impl Pkcs7Ref {
|
||||||
ffi::PEM_write_bio_PKCS7
|
ffi::PEM_write_bio_PKCS7
|
||||||
}
|
}
|
||||||
|
|
||||||
|
to_der! {
|
||||||
|
/// Serializes the data into a DER-encoded PKCS#7 structure.
|
||||||
|
///
|
||||||
|
/// This corresponds to [`i2d_PKCS7`].
|
||||||
|
///
|
||||||
|
/// [`i2d_PKCS7`]: https://www.openssl.org/docs/man1.1.0/man3/i2d_PKCS7.html
|
||||||
|
to_der,
|
||||||
|
ffi::i2d_PKCS7
|
||||||
|
}
|
||||||
|
|
||||||
/// Decrypts data using the provided private key.
|
/// Decrypts data using the provided private key.
|
||||||
///
|
///
|
||||||
/// `pkey` is the recipient's private key, and `cert` is the recipient's
|
/// `pkey` is the recipient's private key, and `cert` is the recipient's
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue