summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-09-20Disable unused Python 2 variant.main-16kKrzysztof Kosiński
Bug: 245854393 Test: presubmit Change-Id: I4daab8bd3843e58ce7ee6ed2aa74bad846da1a70
2021-11-11Upgrade cryptography from 2.5 to 3.3Lucia Li
Source code is from https://github.com/pyca/cryptography/tree/3.3.x Run setup.py locally and rename _openssl.so/_padding.so Bug: 205265538 Test: None Change-Id: If031739ef5830ba2fb177add74515e4660e2906e
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to external/python/cryptographyBob Badour
Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: Android.bp src/cryptography/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Idd06c2e93a3e6ea5c568dd35482a792e1f7f851d
2019-05-02Merge commit '83aa36d' into importKevin Cheng
Merged in version 2.5 and add in misc files. Bug: 122778810 Test: None Change-Id: I9c999773d30f4114ab1ce8aa44b27f3aa4ded80c
2019-01-22changelog and version bump for 2.5 (#4729)Paul Kehrer
2019-01-22allow asn1 times of 1950-01-01 and later. (#4728)Paul Kehrer
* allow asn1 times of 1950-01-01 and later. * add a test * pretty up the test
2019-01-21allow 32-bit platforms to encode certs with dates > unix epoch (#4727)Paul Kehrer
Previously we used unix timestamps, but now we are switching to using ASN1_TIME_set_string and automatically formatting the string based on the year. The rule is as follows: Per RFC 5280 (section 4.1.2.5.), the valid input time strings should be encoded with the following rules: 1. UTC: YYMMDDHHMMSSZ, if YY < 50 (20YY) --> UTC: YYMMDDHHMMSSZ 2. UTC: YYMMDDHHMMSSZ, if YY >= 50 (19YY) --> UTC: YYMMDDHHMMSSZ 3. G'd: YYYYMMDDHHMMSSZ, if YYYY >= 2050 --> G'd: YYYYMMDDHHMMSSZ 4. G'd: YYYYMMDDHHMMSSZ, if YYYY < 2050 --> UTC: YYMMDDHHMMSSZ Notably, Dates < 1950 are not valid UTCTime. At the moment we still reject dates < Jan 1, 1970 in all cases but a followup PR can fix that.
2019-01-21bind EVP_R_MEMORY_LIMIT_EXCEEDED and update a test (#4726)Paul Kehrer
* bind EVP_R_MEMORY_LIMIT_EXCEEDED and update a test This will allow OpenSSL 1.1.1 on 32-bit (including our Windows 32-bit builders) to fail as expected. Technically this isn't a malloc error, but rather failing because the allocation requested is larger than 32-bits, but raising a MemoryError still seems appropriate * what you want an endif too?
2019-01-20deprecate encode_point and migrate all internal callers (#4720)Paul Kehrer
2019-01-20add support for encoding compressed points (#4638)Paul Kehrer
* add support for encoding compressed points * review feedback
2019-01-19shake128/256 support (#4611)Paul Kehrer
* shake128/256 support * remove block_size * doc an exception * change how we detect XOF by adding _xof attribute * interface! * review feedback
2019-01-19expose the ed448 nid (#4717)Paul Kehrer
we already did all the conditional binding, but forgot to actually expose it.
2019-01-17support byteslike in KBKDFHMAC (#4711)Paul Kehrer
2019-01-17support byteslike in ConcatKDF{HMAC,Hash}, Scrypt, and X963KDF (#4709)Paul Kehrer
* byteslike concatkdf * byteslike scrypt * byteslike x963kdf
2019-01-17Support byteslike in HKDF and PBKDF2HMAC (#4707)Paul Kehrer
* support byteslike in HKDF * support byteslike in PBKDF2HMAC * add missing docs
2019-01-17support bytes-like for X25519PrivateKey.from_private_bytes (#4698)Paul Kehrer
yuck.
2019-01-17x448 and x25519 should enforce key lengths in backend (#4703)Paul Kehrer
* x448 and x25519 should enforce key lengths in from_private_bytes they should also check if the algorithm is supported like the public bytes class methods do * oops * move the checks
2019-01-17support byteslike in hmac update (#4705)Paul Kehrer
needed for some KDF keying material
2019-01-16support byteslike in hash updates (#4702)Paul Kehrer
This is needed to handle keying material in some of the KDFs
2019-01-16support bytes-like keys in CMAC and HMAC contexts (#4701)Paul Kehrer
2019-01-16add support for byteslike password/data to load_{pem,der}_private_key (#4693)Paul Kehrer
* add support for byteslike password/data to load_{pem,der}_private_key * pypy 5.4 can't do memoryview from_buffer
2019-01-15support byteslike in aead for key and nonce (#4695)Paul Kehrer
2019-01-15support byteslike in X448PrivateKey.from_private_bytes (#4694)Paul Kehrer
2019-01-15add support for byteslike on password and data for pkcs12 loading (#4690)Paul Kehrer
* add support for byteslike on password and data for pkcs12 loading * use a contextmanager to yield a null terminated buffer we can zero * review feedback * updated text * one last change
2019-01-15Remove a dead assignment (#4692)Alex Gaynor
2019-01-14Serialization x25519 (#4688)Paul Kehrer
* modify x25519 serialization to match x448 supports raw and pkcs8 encoding on private_bytes supports raw and subjectpublickeyinfo on public_bytes deprecates zero argument call to public_bytes * add docs * this is public now * don't need that * review feedback
2019-01-13support x448 public/private serialization both raw and pkcs8 (#4653)Paul Kehrer
* support x448 public/private serialization both raw and pkcs8 * add tests for all other asym key types to prevent Raw * more tests * better tests * fix a test * funny story, I'm actually illiterate. * pep8 * require PrivateFormat.Raw or PublicFormat.Raw with Encoding.Raw * missing docs * parametrize * docs fixes * remove dupe line * assert something
2019-01-12Fixes #4683 -- fixed linux kernel version that has getrandom (#4684)Alex Gaynor
2019-01-11Add bindings to get SRTP protection profile (#4679)Jeremy Lainé
This adds the ability to retrieve the selected SRTP protection profile after the DTLS handshake completes. This is needed to perform the correct key derivation if multiple profiles were offered.
2019-01-10add signature_hash_algorithm to OCSPResponse (#4681)Paul Kehrer
* add signature_hash_algorithm to OCSPResponse * fix pointless asserts
2018-12-31HTTPS a bunch of links in random places (#4666)Alex Gaynor
* HTTPS a bunch of links in random places * What the heck happened here?
2018-12-29Fixes #4645 -- poll() on /dev/random before reading from /dev/urandom on ↵Alex Gaynor
Linux (#4656) * Fixes #4645 -- select() on /dev/random before reading from /dev/urandom on linux * whoops * Missing header * whoops * Review notes * Potential uninitialized fix * Signals are literally impossible
2018-12-18Improve error message for unsupported ciphers (#4650)Alex Gaynor
* Improve error message for unsupported ciphers * fix spacing * include the openssl version number in the message * backwards * pep8
2018-12-17handle empty byte string in from_encoded_point (#4649)Paul Kehrer
* handle empty byte string in from_encoded_point * move the error
2018-12-18Remove spaces from RFC 4514 strings for better compliance (#4643) (#4646)Marti Raudsepp
RFC 4514 does not explicitly allow whitespace between separators: https://tools.ietf.org/html/rfc4514 Reported-by: David Arnold <dar@xoe.solutions>
2018-12-11deprecate old from_encoded_point (#4640)Paul Kehrer
2018-12-11Compressed point support (#4629)Paul Kehrer
* compressed point support * refactor to use oct2point directly * small docs change * remove deprecation for the moment and a bit of review feedback * no backend arg, implicitly import it * missed a spot * double oops * remove superfluous call * use refactored method * use vector file * one last item
2018-12-10convert some asserts to function calls (#4636)Paul Kehrer
2018-12-10ec key creation by curve name refactored into a method (#4634)Paul Kehrer
* ec key creation by curve name refactored into a method * typo
2018-12-09allow bytes-like for key/iv/data for symmetric encryption (#4621)Paul Kehrer
* allow bytearrays for key/iv for symmetric encryption * bump pypy/cffi requirements * update docs, fix some tests * old openssl is naught but pain * revert a typo * use trusty for old pypy * better error msg again * restore match
2018-12-08Adds a more descriptive error msg for wrong wrapping (#4504)André Almeida
* PoC code for check PEM wrap * Remove PoC check wrap code * Add PEM file info to FAQ * Add FAQ/PEM link in exception message * Fix flake8 style issues * refactor, update language * it's really amazing how bad the spell checker is * review feedback * change to etc
2018-12-08Updated BLAKE2s and BLAKE2b error messages from unsupportedalgorithm … (#4519)Colin Metcalf
* Updated BLAKE2s and BLAKE2b error messages from unsupportedalgorithm exception to an explicit error. The error is now "ValueError: Digest size must be 32" (or 64 for BLAKE2b) This was done to give a more contextual error message and should be in place until OpenSSL supports variable lengths. * Updated if statements in hashes.py so that they no longer wrap to separate line. Updated test_hashes.py to unclude a test for non 32 or 64 digest_sizes that fall between 0-32/64. * Removed the new tests in test_hashes.py as the old ones were satisfactory. This also solved misaligned tabs and spaces. * Removed dead code in hashes.py that could no longer be reached after error message updates. * pep8 fix * remove superfluous parens
2018-12-08Raise MemoryError when backend.derive_scrypt can't malloc enough (#4592)Tux
* Raise MemoryError when backend.derive_scrypt can't malloc enough * Expose ERR_R_MALLOC_FAILURE and use the reason_match pattern to catch it * Add test_scrypt_malloc_failure in test_scrypt * let's see if this passes * add comment to filippo's blog post about scrypt's params
2018-12-08Add RFC 4514 Distinguished Name formatting for Name, RDN and NameAttribute ↵Marti Raudsepp
(#4304)
2018-12-06remove idna as a primary dependency (#4624)Paul Kehrer
* remove idna as a primary dependency * empty commit * dynamodb test fix (thanks to Matt Bullock) * review feedback
2018-12-02encode IssuingDistributionPoint (#4618)Paul Kehrer
2018-12-02centralize our bytes check (#4622)Paul Kehrer
this will make life a bit easier when we support bytearrays
2018-12-02switch osrandom engine to blocking mode when getting entropy (#4620)Paul Kehrer
* switch osrandom engine to blocking mode when getting entropy * review feedback * we can remove this too
2018-12-01reuse the libressl branch for OpenSSL built with OPENSSL_NO_PSK (#4619)Paul Kehrer
2018-12-01refactor some code into separate functions in asn1 encode (#4617)Paul Kehrer
* refactor some code into separate functions in asn1 encode this will be useful in IDP encoding * review feedback