summaryrefslogtreecommitdiff
path: root/passlib/handlers
Commit message (Collapse)AuthorAgeFilesLines
* changed bcrypt's os_crypt backend to try alternatives before bailing.Eli Collins2012-04-171-4/+7
|
* a bunch of bugfixes found during unittestingEli Collins2012-04-172-3/+4
| | | | | | | | | | * bsdi_crypt apparently available on openbsd 4.9 * typo fixes * ConfigParser apparently only uses OrderedDict for >= PY27, adjusted CryptContext test accordingly * fixed test that depended on sha256_crypt.default_rounds * handle os_crypt backend w/ no fallback (bcrypt) * let _norm_rounds accept longs
* retuned default_rounds for a few hashes based on benchmarksEli Collins2012-04-174-12/+16
|
* added deprecation detector so CryptContext will upgrade bsdi_crypt hashes ↵Eli Collins2012-04-171-0/+13
| | | | with even rounds
* CryptPolicy deprecated, part2 - updated rest of library to use CryptContext ↵Eli Collins2012-04-171-1/+1
| | | | directly
* bugfix: set des_crypt.checksum_size, so it will now reject hashes with ↵Eli Collins2012-04-171-0/+1
| | | | missing chars
* updated passlib.apache module's api - more flexible to use, changed some ↵Eli Collins2012-04-171-1/+61
| | | | ambiguous method names
* issue warning if app requests even bsdi_crypt roundsEli Collins2012-04-131-1/+17
|
* work on des_crypt familyEli Collins2012-04-131-136/+77
| | | | | * cleaned up source of des_crypt variants and DES util functions * DES utils functions now have tighter input validation, full UT coverage
* assorted bugfixes, tweaks, and tests added; based on coverage examinationEli Collins2012-04-126-11/+12
| | | | | | | * test os_crypt backend has functional fallback * test handler methods accept all unicode/bytes combinations for secret & hash * fixed some incorrect error messages & types being caught & raised * other minor cleanups
* scram hash: improved UTs to cover some edge cases, full-verify now throws ↵Eli Collins2012-04-121-3/+2
| | | | error for inconsistent hashes.
* ran full UTs, found and fixed a few bugs introduced in last few commits.Eli Collins2012-04-114-11/+20
|
* clarify behavior for secret=None and hash=NoneEli Collins2012-04-1117-159/+91
| | | | | | | | | | | | | | | | | | | | | | | * passing a non-string secret or non-string hash to any CryptContext or handler method will now reliably result in a TypeError. previously, passing hash=None to many handler identify() and verify() methods would return False, while others would raise a TypeError. other handler methods would alternately throw ValueError or TypeError when passed a value that wasn't unicode or bytes. the various CryptContext methods also behaved inconsistently, depending on the behavior of the underlying handler. all of these behaviors are gone, they should all raise the same TypeError. * redid many of the from_string() methods to verify the hash type. * moved secret type & size validation to GenericHandler's encrypt/genhash/verify methods. this cheaply made the secret validation global to all hashes, and lets _calc_digest() implementations trust that the secret is valid. * updated the CryptContext and handler unittests to verify the above behavior is adhered to.
* replaced some common string ops with util funcs (repeat_string, ↵Eli Collins2012-04-104-11/+10
| | | | right_pad_string)
* tightened OS crypt backend testsEli Collins2012-04-105-11/+25
| | | | | | | | | * split os_crypt tests into separate mixin * tests now require os_crypt backends to detect some simple incorrect returns from crypt() - e.g. returning wrong ident prefix, wrong size, etc - added relevant asserts to all os_crypt backends * tests now check if platform crypt detection is functioning correctly via platform_crypt_support dict in tests.
* minor constant & comment tweaksEli Collins2012-04-103-11/+8
|
* md5_crypt / sha2-crypt cleanupEli Collins2012-04-102-511/+479
| | | | | * tried to clarify documentation & alg for builtin md5_crypt / sha2-crypt backends * replaced regex parser in sha2-crypt with index-based one - less redundant, and should be faster.
* parse_mc3/render_mc3 helpers now handle rounds str<->int, consolidated a ↵Eli Collins2012-04-102-76/+33
| | | | bunch of redundant code
* passlib.exc: added constructors for common errors, should normalize error ↵Eli Collins2012-04-1016-69/+69
| | | | messages
* ldap salted digest improvementsEli Collins2012-04-091-12/+36
| | | | | | * support variable salt size of 4-16 bytes [issue 30]. * throw correct error when invalid base64 encoding is encountered. * added some test vectors for the above.
* *all* hashes now throw PasswordSizeError if password is larger than 4096 ↵Eli Collins2012-04-093-0/+6
| | | | chars; to prevent DOS issues.
* misc bugfixesEli Collins2012-03-123-8/+12
| | | | | | | | | | | * removed cisco_type7 config string, conflicted w/ empty password * fixed unicode type issue in cisco_type7, win32.nthash * bsdi_crypt.min_rounds now 1 (0 results in identical hashes) * fixed unicode type issue in UPASS_TABLE tests for plaintext, ldap_plaintext * relocated test vectors from test_win32 to lmhash/nthash * 8bit test for UnsaltedHash * fuzz testing expanded to use 5-99 char passwords, and 1/10000 are empty *
* bcrypt workEli Collins2012-03-121-36/+53
| | | | | | | * added code to shoehorn $2$-support wrapper for bcryptor backend * added PasslibSecurityWarning when builtin backend is enabled (still considered whether it should be enabled by default) * py3 compat fix for repair_unused
* doc tweaksEli Collins2012-03-121-8/+9
|
* updated test support & py3 compat code from an external libraryEli Collins2012-03-125-14/+14
| | | | | | | | | | | | | | | | passlib.tests ------------- * deprecated support for unittest 1... accumulated too many backports, planning to require unittest2 in next release. * case_prefix renamed to shortDescription * test case now archives & clears warning registry state in addition to warning filter state passlib.utils.compat -------------------- * a bunch of the bytes-related functions were renamed for clarity * NativeStringIO alias added * trange alias merged into irange
* misc bugfixes dealing with changes from last 8 or so commitsEli Collins2012-03-111-2/+3
|
* added some notesEli Collins2012-03-101-0/+6
|
* various bcrypt improvementsEli Collins2012-03-101-36/+48
| | | | | | | | | | | | * studied crypt_blowfish's 8bit bug - verified none of passlib's backends were affected - added recognition (but not support) for crypt_blowfish's $2x$ hash prefix - added support for crypt_blowfish's $2y$ hash prefix - note in docs about Passlib's current handling of crypt_blowfish 8bit issues. * refactored bcrypt's salt-unused-bits repair code into Base64Engine.repair_unused(), making the code cleaner and more isolated. a bunch more tests. * added bcrypt64 (bcrypt-base64 variant) to utils * added LazyBase64Engine to reduce memory / startup time
* cleanup of scram hash; improved norm_digest_name() and moved it to utils.pbkdf2Eli Collins2012-03-101-295/+188
|
* did rewrite of unix_fallback as unix_disabled; unix_fallback is now deprecatedEli Collins2012-03-101-0/+77
|
* added Window's DCC hashes (aka mscache / mscash) version 1 & 2Eli Collins2012-03-101-1/+96
|
* renamed nthash -> bsd_nthash; added real nthash implementedEli Collins2012-03-101-46/+84
| | | | | | | after some thought, realized the 'nthash' name should implement the raw hash. since bsd_nthash was very rarely used, it shouldn't present backwards incompatibility issues at this point to go ahead and rename it.
* added support for lmhashEli Collins2012-03-101-4/+96
|
* added support for Cisco PIX & Type 7 hashesEli Collins2012-03-101-0/+195
| | | | | | | | * Cisco Type 5 appears to be same as md5_crypt * added requires_user=False support to HandlerCase * added more through salt-generation test (since cisco_pix has only 4 bits of salt) * added HandlerCase test to ensure user is used as salt
* added mssql 2000/2005 hashes; enhanced HandlerCase's password case sensitive ↵Eli Collins2012-03-101-0/+226
| | | | test
* utils.handlers framework reworked; removed a bunch of boilerplate codeEli Collins2012-03-0915-297/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | * StaticHandler is now subclass of GenericHandler - _calc_checksum() should be implemented instead of encrypt(). (compatibility stub added so old code should continue to work) - _norm_hash() no longer needs to handle ->unicode conversion - default from_string() contains a bunch of features, including stripping a known prefix, etc. * context kwds now pulled into constructor, so GenericHandler supports context kwds properly; HasUserContext mixin added to support common 'user' context kwd * identify_regexp & identify_prefix removed, functionality rolled into default GenericHandler.identify() implementation. - default identify checks _hash_regex as potential way to identify hashes * HasStubChecksum removed, functionality rolled into GenericHandler * HasRawChecksum now just sets a flag, functionality moved into GenericHandler * HasManyIdents._parse_ident() helper added to valid & split identifier from hashes. * GenericHandler._norm_checksum() is now strict about unicode / bytes
* base HandlerCase class reworkedEli Collins2012-03-091-0/+1
| | | | | | | | | | | | * reworked warning-matching code into assertWarningList() method * reorganized HandlerCase hash tests based on cross-cutting topic, not per-function; this combined many tests together to eliminate redundant setup * added test of reported rounds limits * added better fuzz testing - tests random passwords & options using encrypt(), and verifies against any all available backends * added flags to properly support 'disabled' handlers, and other border cases. * added tests for password & user case-sensitivity * restores warning filters after every test
* consolidated some unit testsEli Collins2012-02-092-10/+12
|
* renamed calc_checksum() -> _calc_checksum(), hiding the last of the private ↵Eli Collins2012-02-0811-22/+22
| | | | methods of most handlers
* renamed passlib.exc warning classesEli Collins2012-02-082-4/+4
|
* minor tweaks & fixesEli Collins2012-02-081-3/+5
|
* large refactor of GenericHandler internalsEli Collins2012-02-0814-73/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strict keyword -------------- * GenericHandler's "strict" keyword had poorly defined semantics; replaced this with "use_defaults" and "relaxed" keywords. Most handlers' from_string() method specified strict=True. This is now the default behavior, use_defaults=True is enabled only for encrypt() and genconfig(). relaxed=True is enabled only for specific handlers (and unittests) whose code requires it. This *does* break backward compat with passlib 1.5 handlers, but this is mostly and internal class. * missing required settings now throws a TypeError instead of a ValueError, to be more in line with std python behavior. * The norm_xxx functions provided by the GenericHandler mixins (e.g. norm_salt) have been renamed to _norm_xxx() to reflect their private nature; and converted from class methods to instance methods, to simplify their call signature for subclassing. misc ---- * rewrote GenericHandler unittests to use constructor only, instead of poking into norm_salt/norm_rounds internals. * checksum/salt charset checks speed up using set comparison * some small cleanups to FHSP implementation
* minor updatesEli Collins2012-01-191-1/+1
|
* simplified crypt.crypt() wrappersEli Collins2012-01-197-84/+75
| | | | | | | * safe_crypt() improved - accepts unicode/bytes for salt, checks for NULL, returns None on failure * added test_crypt() wrapper to simplify backend checks. * removed native=True from most to_string() implementations, unused now. * updated UTs
* split exceptions/warnings to separate module; added some additional warning ↵Eli Collins2012-01-182-6/+9
| | | | classes to make filtering easier
* misc bugfixes from round of changesEli Collins2012-01-189-19/+20
| | | | | | | | | * added str_to_[ub]ascii to wrap hexdigest() calls * fixed some h64big calls I missed * some py3 fixes * removed utils.compat.aliases, using overlay to replace real compat module instead (to agree w/ imports already in code)
* StaticHandler._norm_hash() should return native str typeEli Collins2012-01-185-32/+15
|
* import cleanupsEli Collins2012-01-1819-108/+114
| | | | | | | | | | | | | | | * moved bytes compat functions from utils to utils.compat (bord, bjoin, bjoin_ints, bjoin_elems, ujoin) * renamed bord -> belem_ord for clarify * a bunch of to_native_str() always use ascii, and have fixed input types (always bytes or always unicode). these don't need overhead of to_native_str(), so replaced those calls with two new funcs: compat.bascii_to_str() / compat.uascii_to_str() * cleaned up a lot of imports from utils/utils.compat to pull from correct module * simplified the to_string() logic of a bunch of handlers to reduce unicode<->byte transitions
* scram norm_digest_name() now normalizes 'sha-2-256' -> 'sha-256'Eli Collins2012-01-181-5/+6
|
* renamed the utils.handlers.XX_CHARS constants to match utils.XX_CHARS (old ↵Eli Collins2012-01-1812-30/+30
| | | | aliases kept for now)