summaryrefslogtreecommitdiff
path: root/passlib/handlers/misc.py
Commit message (Collapse)AuthorAgeFilesLines
* assorted bugfixes, tweaks, and tests added; based on coverage examinationEli Collins2012-04-121-0/+2
| | | | | | | * 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
* clarify behavior for secret=None and hash=NoneEli Collins2012-04-111-23/+23
| | | | | | | | | | | | | | | | | | | | | | | * 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.
* passlib.exc: added constructors for common errors, should normalize error ↵Eli Collins2012-04-101-3/+3
| | | | messages
* *all* hashes now throw PasswordSizeError if password is larger than 4096 ↵Eli Collins2012-04-091-0/+2
| | | | chars; to prevent DOS issues.
* did rewrite of unix_fallback as unix_disabled; unix_fallback is now deprecatedEli Collins2012-03-101-0/+77
|
* utils.handlers framework reworked; removed a bunch of boilerplate codeEli Collins2012-03-091-19/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* StaticHandler._norm_hash() should return native str typeEli Collins2012-01-181-10/+9
|
* import cleanupsEli Collins2012-01-181-2/+5
| | | | | | | | | | | | | | | * 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
* clarified border case where verify() accepted configuration strings instead ↵Eli Collins2012-01-091-1/+4
| | | | of throwing ValueError for some handlers
* deprecated to_hash_str, replaced all instances with to_native_strEli Collins2011-12-281-3/+3
| | | | | | decided that to_hash_str will always return native string, feature of hashes being returned as unicode under python 2 is better done through a CryptContext option.
* stripped trailing whitespace from a bunch of filesEli Collins2011-07-081-1/+1
|
* couple of bugfixes after running UTs (cpython 2.5, 2.6, 2.7, 3.1, 3.2; pypy 1.5)Eli Collins2011-06-221-1/+1
|
* StaticHandler now provides internal _norm_hash() method for subclasses to ↵Eli Collins2011-06-221-1/+11
| | | | | | | | override * enhanced StaticHandler.verify method to normalize hash unicode/bytes better * changed various StaticHandler-derived classes to use _norm_hash() instead of re-implementing verify() * oracle, postgres hashes now derive from StaticHandler instead of object.
* converts handlers .digests, .ldap_digests, .misc to be py3 compatEli Collins2011-06-171-5/+3
| | | | * also allows PrefixWrapper test to pass
* misc tweaksEli Collins2011-04-251-1/+1
|
* converted most handlers to use new helper classes.Eli Collins2011-04-051-16/+4
| | | | | | | | | | * converted all ExtendedHandler & MultiBackendHandler subclasses to use GenericHandler + appropriate mixins. * converted most SimpleHandler subclasses to use StaticHandler. * changed some hashes to parse_mc2/mc3 methods: md5_crypt, apr_md5_crypt, most pbkdf2 hashes, sha1_crypt * changed most hashes to coerce unicode hash strings -> ascii * changed some internal attribute names for consistency
* unix_fallback: disabled wildcard support unless explicitly enabledEli Collins2011-03-291-7/+9
| | | | for security purposes, so as not to surprise new users.
* more error statements rewrittenEli Collins2011-03-281-1/+1
|
* replaced "raise exc, msg" with "raise exc(msg)" everywhere (working on py3k ↵Eli Collins2011-03-281-4/+4
| | | | compat, changes made by 2to3)
* big rename: changed base handler class namesEli Collins2011-03-221-3/+3
| | | | | | | | ============================================ renamed the classes in passlib.utils.handlers, for clarity in code: * BaseHash -> SimpleHandler * ExtHash -> ExtendedHandler * BackendExtHash -> MultiBackendHandler
* big rename: driver->handlerEli Collins2011-03-221-0/+89
=========================== Renamed all references from password hash "driver" -> password hash "handler", to be more consistent with existing phrasing. This also required rearranging quite a lot of modules.