-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,4 @@ | ||
import cryptography.x509 | ||
|
||
SHA256_OID = cryptography.x509.ObjectIdentifier("2.16.840.1.101.3.4.2.1") | ||
SHA512_OID = cryptography.x509.ObjectIdentifier("2.16.840.1.101.3.4.2.3") |
This file contains 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 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,21 @@ | ||
from rfc3161_client._rust import create_timestamp_request | ||
from rfc3161_client.base import HashAlgorithm | ||
|
||
from .common import SHA256_OID, SHA512_OID | ||
|
||
|
||
def test_create_timestamp_request(): | ||
request = create_timestamp_request( | ||
data=b"hello", nonce=True, cert=False, hash_algorithm=HashAlgorithm.SHA512 | ||
) | ||
|
||
assert request.message_imprint.hash_algorithm == SHA512_OID | ||
|
||
# Optional parameter | ||
request = create_timestamp_request(data=b"hello", nonce=True, cert=True) | ||
assert request.message_imprint.hash_algorithm == SHA512_OID | ||
|
||
request = create_timestamp_request( | ||
data=b"hello", nonce=True, cert=True, hash_algorithm=HashAlgorithm.SHA256 | ||
) | ||
assert request.message_imprint.hash_algorithm == SHA256_OID |