-
-
Notifications
You must be signed in to change notification settings - Fork 774
Timestamp Protocol Wrapper (RFC 3161) #2286
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
Open
JM4ier
wants to merge
15
commits into
sfackler:master
Choose a base branch
from
JM4ier:timestamping
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
43fab3b
openssl-sys: add wrappers for timestamping functions
krisztian-kovacs 5b12bd1
openssl/ts: add timestamping functionality
krisztian-kovacs 4e98937
openssl/ts: add functionality for a basic Time Stamp Authority
krisztian-kovacs a48269f
change interface to match original openssl, add helper functions for …
ea3182d
add tryfrom
151b5dc
add TS_REQ_get_msg_imprint
b32fc0a
corresponds
343c3b4
corresponds
e7b4565
add getters & equality functionality s.t. one can extract digest+algo…
00ba4b7
methods to fetch timestamp from timestamp response object
75d5cc2
Merge branch 'sfackler:master' into timestamping
JM4ier cdab526
pipeline fixes
870e0e4
adjust TsMsgImprint to not use X509_ALGOR_set_md
17acb84
cargo clippy && cargo fmt
fef4011
EVP_MD_type instead of EVP_MD_get_type
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
use libc::*; | ||
|
||
use super::*; | ||
|
||
pub enum TS_MSG_IMPRINT {} | ||
pub enum TS_REQ {} | ||
pub enum TS_RESP {} | ||
pub enum TS_TST_INFO {} | ||
pub enum TS_RESP_CTX {} | ||
pub enum TS_VERIFY_CTX {} | ||
|
||
pub const TS_VFY_SIGNATURE: c_uint = 0x1; | ||
pub const TS_VFY_VERSION: c_uint = 0x2; | ||
pub const TS_VFY_POLICY: c_uint = 0x4; | ||
pub const TS_VFY_IMPRINT: c_uint = 0x8; | ||
pub const TS_VFY_DATA: c_uint = 0x10; | ||
pub const TS_VFY_NONCE: c_uint = 0x20; | ||
pub const TS_VFY_SIGNER: c_uint = 0x40; | ||
pub const TS_VFY_TSA_NAME: c_uint = 0x80; | ||
|
||
pub const TS_VFY_ALL_IMPRINT: c_uint = TS_VFY_SIGNATURE | ||
| TS_VFY_VERSION | ||
| TS_VFY_POLICY | ||
| TS_VFY_IMPRINT | ||
| TS_VFY_NONCE | ||
| TS_VFY_SIGNER | ||
| TS_VFY_TSA_NAME; | ||
pub const TS_VFY_ALL_DATA: c_uint = TS_VFY_SIGNATURE | ||
| TS_VFY_VERSION | ||
| TS_VFY_POLICY | ||
| TS_VFY_DATA | ||
| TS_VFY_NONCE | ||
| TS_VFY_SIGNER | ||
| TS_VFY_TSA_NAME; | ||
|
||
pub const TS_STATUS_GRANTED: c_uint = 0; | ||
pub const TS_STATUS_GRANTED_WITH_MODS: c_uint = 1; | ||
pub const TS_STATUS_REJECTION: c_uint = 2; | ||
pub const TS_STATUS_WAITING: c_uint = 3; | ||
pub const TS_STATUS_REVOCATION_WARNING: c_uint = 4; | ||
pub const TS_STATUS_REVOCATION_NOTIFICATION: c_uint = 5; | ||
|
||
extern "C" { | ||
pub fn TS_MSG_IMPRINT_new() -> *mut TS_MSG_IMPRINT; | ||
pub fn TS_MSG_IMPRINT_free(a: *mut TS_MSG_IMPRINT); | ||
pub fn TS_MSG_IMPRINT_set_algo(a: *mut TS_MSG_IMPRINT, alg: *mut X509_ALGOR) -> c_int; | ||
pub fn TS_MSG_IMPRINT_get_algo(a: *mut TS_MSG_IMPRINT) -> *mut X509_ALGOR; | ||
pub fn TS_MSG_IMPRINT_set_msg(a: *mut TS_MSG_IMPRINT, d: *mut c_uchar, length: c_int) -> c_int; | ||
pub fn TS_MSG_IMPRINT_get_msg(a: *mut TS_MSG_IMPRINT) -> *mut ASN1_OCTET_STRING; | ||
|
||
pub fn TS_REQ_new() -> *mut TS_REQ; | ||
pub fn TS_REQ_free(a: *mut TS_REQ); | ||
pub fn d2i_TS_REQ(a: *mut *mut TS_REQ, pp: *mut *const c_uchar, length: c_long) -> *mut TS_REQ; | ||
pub fn i2d_TS_REQ(a: *const TS_REQ, pp: *mut *mut c_uchar) -> c_int; | ||
pub fn TS_REQ_set_version(a: *mut TS_REQ, version: c_long) -> c_int; | ||
pub fn TS_REQ_set_msg_imprint(a: *mut TS_REQ, msg_imprint: *mut TS_MSG_IMPRINT) -> c_int; | ||
pub fn TS_REQ_get_msg_imprint(a: *mut TS_REQ) -> *mut TS_MSG_IMPRINT; | ||
pub fn TS_REQ_set_nonce(a: *mut TS_REQ, nonce: *const ASN1_INTEGER) -> c_int; | ||
pub fn TS_REQ_set_cert_req(a: *mut TS_REQ, cert_req: c_int) -> c_int; | ||
|
||
pub fn TS_RESP_new() -> *mut TS_RESP; | ||
pub fn TS_RESP_free(a: *mut TS_RESP); | ||
pub fn d2i_TS_RESP( | ||
a: *mut *mut TS_RESP, | ||
pp: *mut *const c_uchar, | ||
length: c_long, | ||
) -> *mut TS_RESP; | ||
pub fn i2d_TS_RESP(a: *const TS_RESP, pp: *mut *mut c_uchar) -> c_int; | ||
|
||
pub fn TS_VERIFY_CTX_new() -> *mut TS_VERIFY_CTX; | ||
pub fn TS_VERIFY_CTX_free(ctx: *mut TS_VERIFY_CTX); | ||
#[cfg(ossl110)] | ||
pub fn TS_VERIFY_CTX_set_imprint( | ||
ctx: *mut TS_VERIFY_CTX, | ||
hexstr: *mut c_uchar, | ||
length: c_long, | ||
) -> *mut c_uchar; | ||
pub fn TS_RESP_verify_response(ctx: *mut TS_VERIFY_CTX, response: *mut TS_RESP) -> c_int; | ||
|
||
pub fn TS_REQ_to_TS_VERIFY_CTX(req: *mut TS_REQ, ctx: *mut TS_VERIFY_CTX) | ||
-> *mut TS_VERIFY_CTX; | ||
|
||
pub fn TS_RESP_CTX_new() -> *mut TS_RESP_CTX; | ||
pub fn TS_RESP_CTX_free(ctx: *mut TS_RESP_CTX); | ||
pub fn TS_RESP_CTX_set_signer_cert(ctx: *mut TS_RESP_CTX, signer: *mut X509) -> c_int; | ||
pub fn TS_RESP_CTX_set_signer_key(ctx: *mut TS_RESP_CTX, key: *mut EVP_PKEY) -> c_int; | ||
pub fn TS_RESP_CTX_add_md(ctx: *mut TS_RESP_CTX, md: *const EVP_MD) -> c_int; | ||
|
||
pub fn TS_RESP_create_response(ctx: *mut TS_RESP_CTX, req_bio: *mut BIO) -> *mut TS_RESP; | ||
|
||
pub fn TS_RESP_get_tst_info(a: *mut TS_RESP) -> *mut TS_TST_INFO; | ||
pub fn TS_TST_INFO_get_time(a: *const TS_TST_INFO) -> *const ASN1_STRING; | ||
pub fn TS_TST_INFO_free(a: *mut TS_TST_INFO); | ||
} | ||
|
||
cfg_if! { | ||
if #[cfg(any(ossl110, libressl280))] { | ||
extern "C" { | ||
pub fn TS_REQ_set_policy_id( | ||
a: *mut TS_REQ, | ||
policy: *const ASN1_OBJECT | ||
) -> c_int; | ||
pub fn TS_RESP_CTX_set_def_policy( | ||
ctx: *mut TS_RESP_CTX, | ||
def_policy: *const ASN1_OBJECT | ||
) -> c_int; | ||
} | ||
} else { | ||
extern "C" { | ||
pub fn TS_REQ_set_policy_id( | ||
a: *mut TS_REQ, | ||
policy: *mut ASN1_OBJECT | ||
) -> c_int; | ||
pub fn TS_RESP_CTX_set_def_policy( | ||
ctx: *mut TS_RESP_CTX, | ||
def_policy: *mut ASN1_OBJECT | ||
) -> c_int; | ||
} | ||
} | ||
} | ||
|
||
cfg_if! { | ||
if #[cfg(ossl110)] { | ||
extern "C" { | ||
pub fn TS_RESP_CTX_set_signer_digest( | ||
ctx: *mut TS_RESP_CTX, | ||
signer_digest: *const EVP_MD, | ||
) -> c_int; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.