aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add support for extracting timestamp from a Fernet token (#4229)Paul Kehrer2018-05-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add API for retrieving the seconds-to-expiry for the token, given a TTL. * Process PR feedback: * Do compute the TTL, but just the age of the token. The caller can decided what to do next. * Factored out the HMAC signature verification to a separate function. * Fixed a copy&paste mistake in the test cases * Tests cleanup. * `struct` no longer needed * Document `def age()` * typo in `age()` documentation * token, not data * remove test for TTL expiry that is already covered by the parameterized `test_invalid()`. * let's call this extract_timestamp and just return timestamp * review comments * it's UNIX I know this
* Raise ve on bad gt (#4180)Joshua Crowgey2018-04-031-0/+12
| | | | | | | | | | | | | | | * Raise a ValueError when conversion to generalizedtime fails * added test for badasn1time value error * pep8 compliance * Addressing code review + VE now raises with ```{!r}``` formatting + Test now checks that the bad string made it into the VE message * using ValueError.match
* fix bug with n % 8 length wrapping on AESKWP (#4160)Paul Kehrer2018-03-201-0/+24
| | | | | | * fix bug with n % 8 length wrapping on AESKWP * review feedback
* Revert "don't allow GeneralNames to be an empty list (#4128)" (#4161)Alex Gaynor2018-03-201-4/+0
| | | | | This breaks the urllib3 tests, as well as several in-the-wild certs This reverts commit 388d1bd3e9cd953fcc948edbc152d5d140c87eb8.
* implement AES KW with padding (RFC 5649) (#3880)Paul Kehrer2018-03-181-0/+65
| | | | | | | | | | | | | | | | | | * implement AES KW with padding (RFC 5649) fixes #3791 * oops, 2.2 * make sure this is the right valueerror * more match * make key padding easier to read * review feedback * review feedback
* Allow DSA q=224 (#4147)Paul Kehrer2018-03-182-91/+18
| | | | | | | | * load Q=224 vectors * DSA parameters should support 224 for q length * oxford comma
* Brainpool curves (#4129)Paul Kehrer2018-03-151-1/+28
| | | | | | | | | | | | | | | | | | * added brainpool ec-curves key_length >= 256bit * limit brainpool curves to the set that appear required + docs * oops * typos all around me * add brainpool ECDH kex tests * switch to using rfc 7027 vectors * review feedback * empty commits are the best
* don't allow GeneralNames to be an empty list (#4128)Paul Kehrer2018-03-051-0/+4
| | | | | | * don't allow GeneralNames to be an empty list * flake8
* fix a memory leak in ec derive_private_key (#4096)Paul Kehrer2018-02-041-0/+8
| | | | | | | | * fix a memory leak in ec derive_private_key fixes #4095 * pep8!
* Fixes #4076 - simplify the implementation of int_from_bytes on python2 (#4077)Alex Gaynor2018-01-101-0/+2
| | | | | | | | * Fixes #4076 - simplify the implementation of int_from_bytes on python2 * whitespace * Added a test
* The HKDF limit is actually 255 * digest_length_in_bytes (#4037)Paul Kehrer2018-01-061-2/+20
| | | | | | | | | | | * The HKDF limit is actually 255 * digest_length_in_bytes Previously we had a bug where we divided digest_size by 8...but HashAlgorithm.digest_size is already in bytes. * test longer output * changelog
* Expose `BN_clear_free` in the OpenSSL backend (#4071)Tux2018-01-051-1/+1
| | | | | | * Expose BN_clear_free * Use BN_clear_free in test_int_to_bn
* Fixed #4058 -- use the thread-safe API from OpenSSL, not the danger one (#4059)Alex Gaynor2017-12-181-3/+3
|
* Fixed 120 warnings from the RSA tests (#4052)Alex Gaynor2017-12-111-9/+6
| | | | | | * Fixed 120 warnings from the RSA tests * typo
* Fixed DSA tests to not emit 200 warnings (#4050)Alex Gaynor2017-12-101-8/+2
|
* update the ec tests to not emit 3000 warnings (#4048)Alex Gaynor2017-12-101-11/+12
|
* In RSA test vectors, use verify() to avoid warnings (#4047)Alex Gaynor2017-12-101-8/+14
| | | | | | * In RSA test vectors, use verify() to avoid warnings * whoops
* Fixed deprecation warnings in x509 tests (#4040)Alex Gaynor2017-12-041-26/+18
|
* Fix ASN1 string type encoding for several Name OIDs (#4035)Paul Kehrer2017-11-301-16/+135
| | | | | | | | | | | | | | | | | | | * Fix ASN1 string type encoding for several Name OIDs When we changed over to the new type encoding system we didn't verify that the new code exactly matched the ASN1 string types that OpenSSL was previously choosing. This caused serialNumber, dnQualifier, emailAddress, and domainComponent to change from their proper encodings to UTF8String as of version 2.1. Now we check to see if there's a sentinel value (indicating no custom type has been passed) and then check if the OID has a different default than UTF8. If it does, we set it. This PR also adds tests for the ASN1 string type of ever supported NameOID. * review feedback
* Use a different warning class so users get warnings (#4014)Alex Gaynor2017-11-115-23/+26
| | | | | | | | | | | | * Use a different warning class so users get warnings * fixed tests * do our own warning class * typo * flake8
* Fix a few new flake8 issues (#4008)Alex Gaynor2017-11-022-2/+0
|
* Add Multifernet.rotate method (#3979)Chris Wolfe2017-10-191-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add rotate method * add some more tests for the failure modes * start adding some documentation for the rotate method * operate on a single token at a time, leave lists to the caller * add versionadded add versionadded, drop rotate from class doctest * give rotate a doctest * single level, not aligned * add changelog for mf.rotate * show that, once rotated, the old fernet instance can no longer decrypt the token * add the instead of just the how * update docs to reflect removal of ttl from rotate * update tests * refactor internal methods so that we can extract the timestamp * implement rotate * update wordlist (case sensitive?) * lints * consistent naming * get_token_data/get_unverified_token_data -> better name * doc changes * use the static method, do not treat as imethod * move up to MultiFernet docs * add to authors * alter wording * monkeypatch time to make it less possible for the test to pass simply due to calls occuring in less than one second * set the time after encryption to make sure that the time is preserved as part of re-encryption
* Inline calls to bit_length now that it's trivial (#3966)Alex Gaynor2017-10-125-8/+12
| | | | | | | | * Inline calls to bit_length now that it's trivial * unused imports * An comment
* Debian sid is python3.6 now (#3968)Alex Gaynor2017-10-121-0/+3
| | | | | | * Debian sid is python3.6 now * Workaround because apparently measuring coverage correctly isn't a legitimate use case
* expunge python 2.6 (#3962)Paul Kehrer2017-10-111-4/+0
| | | | | | | | | | * expunge python 2.6 * how did THAT happen * remove another unsupported python from the tox envlist * hypothesis can now be unconditionally imported
* backwards incompatible change to UniformResourceIdentifier (#3954)Paul Kehrer2017-10-102-167/+166
| | | | | | | | | | | | | | | * backwards incompatible change to UniformResourceIdentifier During this release cycle we decided to officially deprecate passing U-labels to our GeneralName constructors. At first we tried changing this in a purely backwards compatible way but get_values_for_type made that untenable. This PR modifies URI to accept two types: U-label strings (which raises a deprecation warning) and A-label strings (the new preferred type). There is also a constructor for URI that bypasses validation so we can parse garbage out of certificates (and round trip it if necessary) * nonsense empty commit 2.6 and codecov are the worst
* backwards incompatible change to RFC822Name (#3953)Paul Kehrer2017-10-102-38/+47
| | | | | | | | | | | | | | | * backwards incompatible change to RFC822Name During this release cycle we decided to officially deprecate passing U-labels to our GeneralName constructors. At first we tried changing this in a purely backwards compatible way but get_values_for_type made that untenable. This PR modifies RFC822Name to accept two types: U-label strings (which raises a deprecation warning) and A-label strings (the new preferred type). There is also a constructor for RFC822Name that bypasses validation so we can parse garbage out of certificates (and round trip it if necessary) * whoops
* Backwards incompatible change to DNSName (#3951)Paul Kehrer2017-10-103-142/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Backwards incompatible change to DNSName During this release cycle we decided to officially deprecate passing U-labels to our GeneralName constructors. At first we tried changing this in a purely backwards compatible way but get_values_for_type made that untenable. This PR modifies DNSName to take three different types. U-label strings (which raises a deprecation warning), A-label strings (the new preferred type), and bytes (which are assumed to be decodable to unicode strings). The latter, while supported, is primarily intended for use by our parser and allows us to return the actual encoded data in a certificate even if it has not been properly encoded to A-label before the certificate is created. (Of course, if the certificate contains invalid utf8 sequences this will still fail, but let's handle one catastrophic failure at a time). * coverage * don't delete that asterisk from a test. it does things. * no bytes in DNSName. Private constructor for bypassing validation * test unicode in dnsname (yuck) * fix docs * empty commit, you disappoint me codecov * CI is the worst
* Add support for AES XTS (#3900)Paul Kehrer2017-10-012-1/+59
| | | | | | | | | | | | | | | | | | | | | | | | * Add support for AES XTS We drop the non-byte aligned test vectors because according to NIST http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSVS.pdf "An implementation may support a data unit length that is not a multiple of 8 bits." OpenSSL does not support this, so we can't use those test vectors. * fix docs and pep8 * docs fix * the spellchecker is so frustrating * add note about AES 192 for XTS (it's not supported) * docs work * enforce key length on ECB mode in AES as well (thanks XTS) * a few more words about why we exclude some test vectors for XTS
* add ChaCha20 support (#3919)Paul Kehrer2017-09-281-0/+60
| | | | | | | | | | * add ChaCha20 support * review feedback * 256 divided by 8 is what again? * ...
* both parse and encode the ASN1 string type for Name attributes (#3896)Paul Kehrer2017-09-251-0/+58
| | | | | | | | | | | | | | | * both parse and encode the ASN1 string type for Name attributes Previously cryptography encoded everything (except country names) as UTF8String. This caused problems with chain building in libraries like NSS where the subject and issuer are expected to match byte-for-byte. With this change we now parse and store the ASN1 string type as a private _type in NameAttribute. We then use this to encode when issuing a new certificate. This allows the CertificateBuilder to properly construct an identical issuer and fixes the issue with NSS. * make the sentinel private too
* FreshestCRL extension support (#3937)Paul Kehrer2017-09-232-0/+259
| | | | | | | | | | * add freshest CRL support * add tests * add changelog * add tests for FreshestCRL generation
* support delta crl indicator extension (#3936)Paul Kehrer2017-09-223-0/+44
| | | This is an extension for CRLs
* parametrize a bunch of x509 extension tests that were identical (#3931)Paul Kehrer2017-09-211-377/+139
|
* implement __hash__ on DistributionPoint and CRLDistributionPoints (#3915)Paul Kehrer2017-09-131-0/+74
|
* add __hash__ to GeneralNames, SAN, IAN, and CertificateIssuer (#3916)Paul Kehrer2017-09-131-0/+34
|
* add __hash__ to PolicyConstraints and Extension (#3917)Paul Kehrer2017-09-131-0/+26
|
* implement __hash__ on KeyUsage and ExtendedKeyUsage (#3913)Paul Kehrer2017-09-131-0/+48
| | | | | | * implement __hash__ on KeyUsage and ExtendedKeyUsage * properly use private values and alter test to catch that bug
* implement __hash__ on CertificatePolicies and its child classes (#3914)Paul Kehrer2017-09-131-0/+45
|
* add aki hash (#3910)Paul Kehrer2017-09-131-1/+10
| | | | | | | | | | * Implement __hash__ on AuthorityKeyIdentifier * Adding dirname to fix build issue on AuthorityKeyIdentifier test * .authority_cert_issuer to str * use a tuple and not a str repr
* name constraints __hash__ (#3912)Paul Kehrer2017-09-131-0/+21
|
* AIA hashing (#3911)Paul Kehrer2017-09-131-0/+34
|
* fix a bug with URI value when parsing a string with no hostname (#3909)Paul Kehrer2017-09-131-4/+5
| | | | | strings of the form "scheme:///anything" would incorrectly have two slashes dropped. This is fixed in two code paths in this PR but one of those code paths will be entirely removed in a followup PR.
* implement __hash__ on all GeneralName types (#3907)Paul Kehrer2017-09-131-0/+41
| | | Needed to implement __hash__ on AuthorityKeyIdentifier
* compare against bytes values, not the U-label decoded ones (#3906)Paul Kehrer2017-09-121-0/+5
| | | | We need to add one small test to cover a case that is no longer covered with this switch.
* [WIP] add support for the TLSFeature extension in x509 (#3899)Paul Kehrer2017-09-102-0/+115
| | | | | | | | | | | | | | | | | | * add support for the TLSFeature extension in x509 This extension is used for OCSP Must-Staple. * fix changelog link * pep8 * refactor to support the sequence properly and add status_request_v2 * update some language * add test vector, implement eq/ne/hash on TLSFeature * address review comments
* RSA OAEP label support for OpenSSL 1.0.2+ (#3897)Paul Kehrer2017-09-082-14/+129
| | | | | | | | | | * RSA OAEP label support for OpenSSL 1.0.2+ * changelog * move around tests, address review feedback, use backend supported method * unsupported padding catches this now
* move x509 tests into a module (#3889)Paul Kehrer2017-09-066-12/+12
| | | | | | | | | | | * move x509 tests into a module This is just to make grouping things like test_ocsp, etc a bit simpler in the future * fix path * pep8
* add blake2b/blake2s support for hmac (#3873)Paul Kehrer2017-08-221-1/+29
| | | | | | | | | | * add blake2b/blake2s support for hmac This was a bug, but it turns out the noise protocol suggests using the HMAC construction with BLAKE2 (rather than BLAKE2's own keyed functionality) for a few reasons, so we should support it. * actually test the thing
* Add is_signature_valid method on CertificateRevocationList (#3849)Vincent Pelletier2017-08-121-0/+41
|