| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* scrypt kdf code
- relocated scrypt kdf code to passlib.crypto.scrypt
- py3 compat fixes
- split UTs out into separate file
- removed "non-power of 2" support, not needed.
- added wrapper which can toggle between builtin backend,
and extenrnal scrypt package.
- factored out n/r/p validation code so it can be used independantly
of calling kdf itself.
* passlib.handlers.scrypt: added scrypt handler which wraps the kdf.
- added some custom test strings, as well as adapted some reference values
from the scrypt whitepaper.
- added documentation page
- integrated scrypt kdf wrapper w/ hash's HasManyBackends api
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
as a fallback for 'default_rounds', 'min_rounds', and 'max_rounds'.
this makes it easier to specify a django-style policy of "deprecate all hashes
which have a differing rounds value".
* removed special handling from 'rounds' from CryptContext parser
* tweaked affected CryptContext serialization tests
* added test for new behavior
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
implementation
these all derived directly from PasswordHash, and lacked a working .using().
* added UT to check for a working .using() method
* factored out GenericHandler's .using() into another base class
which these three hashes could inherit from.
|
| | |
| |
| |
| |
| |
| |
| | |
and not worth the amount of code it requires to support it.
* stripped out vary_rounds from all internal presets
* added deprecation warning if it's ever used
|
| | |
| |
| |
| |
| | |
removed _CryptRecord proxy object completely. CryptContext now just
worked with custom handler instances directly.
|
| | |
| |
| |
| | |
default salt size, added UTs.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
* HasRounds: now parses vary_rounds="0.x" format correctly
* PrefixWrapper: now exposes "vary_rounds" attr
* handler tests: split HasRounds.using() into multiple tests, one for each property
(max_rounds, min_rounds, etc)
* context tests: added checks that custom handler is being configured correctly,
since actual behavior is now being checked by handler tests.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
.encrypt()
----------
hash.encrypt() & context.encrypt() have been renamed to .hash().
this should take care of the long-standing issue 21 (the poor naming of .encrypt).
per docs, legacy aliases will remain in place until passlib 2.0.
.genhash() / .genconfig()
-------------------------
taking advantage of this reorganization to also deprecate .genconfig()
and .genhash() -- they're not really useful in a modern system,
nor as needed for historical support as initially thought:
.genconfig() will be retired completely in passlib 2.0;
.genhash() is rolled into the new .hash() method along with .encrypt().
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* split generate() into genword() & genphrase() --
APIs are just too different to keep combined.
* renamed internal calc funcs to better reflect their purpose.
* commented out PhraseGenerator's min_chars code, can't confirm
it's doing correct thing.
* commented out password strength estimator, too half-baked.
* tried to simplify SequenceGenerator attributes.
* genword(): defined some base charsets to work with
* genphrase(): wordsets now stored uncompressed (not really that big,
and .whl will compress everything for transport).
* fleshed out UTs for genword() & genphrase()
* updated docs
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
and moved them to a separate passlib.crypto subpackage.
along with this move, made a few api cleanups:
* unified all code that's looking up hashes
to use new passlib.crypto.lookup_hash() wrapper, which takes
care of hash name normalization, loading fallback implementations,
and alg metadata inspection, all hidden behind a memoized function.
* deprecated pbkdf2() in favor of pbkdf2_hmac() -- only real use,
and new signature matches stdlib function. additionally,
this version is a bit faster, due to some assumptions that
can be made due to the PRF always being HMAC based.
* added compile_hmac() helper which does an even more efficient
job of pre-compiling a keyed HMAC function; this helped speed up pbkdf2 a bit more.
|
| | | |
|
| | |\ |
|
| | | |
| | |
| | |
| | | |
handlers.
|
| | | |
| | |
| | |
| | | |
which abstracts out job of parsing rounds value from hash.
|
| | | |
| | |
| | |
| | | |
(may need to do bigger overhaul of PrefixWrapper at some point)
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | | |
PasslibSecurityError.
now treated like the backend isn't available in most cases; rather than
throwing unexpected security error.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* test_handlers: fix py3 u() compat issue
* test_totp: clean norm_hash_name() caches so warnings repeat per-test,
added/fixed some warnings checks.
* HandlerCase: HasRounds.using() test: hack so bsdi_crypt can pass
(the 'odd rounds only' was playing havoc w/ the test's expectations)
* HandlerCase: effective_rounds() / effective_ident() helpers
now unwrap PrefixWrappers first; wrappers aren't callable like classes.
* HandlerCase: HasRounds.using() test: don't check min_rounds-1
if min_rounds is 0.
* HandlerCase: multithreaded fuzz test -- detect & log errors if stalled thread,
rather than main thread stalling forever. reduced thread count down to 10.
* reset_warning_filter() context manager -- simplified __exit__() cleanup code
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* added UTs for basic min/max/default options.
still needs vary_rounds & alias tests
* clarified error/warning condtions for some cases,
handled implicit min/max policy settings.
* All HasRounds.using() options now accept values as strings,
to help CryptContext.
* Replaced some dup code in _norm_rounds w/ a call to _clip_to_valid_rounds
* departing from previous CryptContext behavior,
passing an explicit rounds value to encrypt() will now override
the policy limits (w/ a warning)
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | | |
the using() call; and added PrefixWrapper.needs_update() proxy wrapper.
|
| | | | |
|
| | | |
| | |
| | |
| | | |
for the few simple uses that we have.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* moved utils.patchAttr() function to TestCase.patchAttr(),
redid a bunch of manual monkeypatches to use .patchAttr() method.
* temporary_backend() hack replaced by subcls.using(), so temporary
backend use will be threadsafe (needed for concurrent tests).
* HandlerCase.create_backend_cases() replaced with HandlerCase.create_backend_case(),
all calls split out to make individual calls for each backend.
Easier to read in diffs going forward when backends added/removed.
* moved os_crypt specific code w/in create_backend_case() to OsCryptMixin,
which just subclasses the method it needs to modify. allowed
removing find_crypt_replacement() method entirely; decision to skip backend
now directly uses OsCryptMixin's own logic.
* fuzz_verifier_crypt() cleanups
- moved to OsCryptMixin; removing .using_patched_crypt ref from HandlerCase
- has_crypt_support() helper rolled into method, was only caller.
- os_supports_ident() refactored into crypt_supports_variant().
fuzz_verified_crypt() is (now) the only caller.
* bcrypt's crypt_supports_variant() now uses actual test of crypt()
rather than hardcoded list of supported values.
* fuzz verifier now handlers hashes throwing SkipTest.
* utils.has_crypt_support() rolled into
|
| | |\ \
| | |/ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
bcrypt
------
* added support & UT for $2b$ hash format.
not making it the default yet, for backward compat.
* large refactor of how bcrypt backends are loaded:
instead of per-backend workarounds within each _calc_checksum_<backend>()
function: now using runtime detection of specific capabilities & workarounds,
that runs whenever set_backend() is called, combined with consolidated
workaround code within _calc_checksum(), controlled by the flags
set by set_backend().
this detection now looks for:
- the 8bit bug: throws a PasslibSecurityError
- the wraparound bug: issues warning, sets flag enabling a workaround.
- support for 2/2y/2b: if backend lacks support for particular variants,
sets flag enabling workaround to add support.
* os_crypt backend now just issues error if it can't handle a password encoding;
rather than trying fallbacks first -- edge case anyways, and likely
to not have any fallbacks when it does happen. simplifies backend code.
* added UTs to make sure wraparound-vulnerable passwords are hashed correctly
(as a 72char string, not a 1-3 char string that's repeated).
* internal blowfish code's ident parsing clarified.
other
-----
* added exc.PasslibSecurityError for fatal runtime errors.
* test framework: os_crypt backends no longer expected to use
*any* backend as fallback, just ones with lower priority than os_crypt.
* test framework: crypt_stub() wrapper now subclasses the handler,
so it can use an independant backend, instead of changing global
backend for duration of call (made parallel testing hard)
docs
----
* added entry to bcrypt page, writing down wraparound bug details,
and how passlib is handling it.
* all versions of pybcrypt & bcryptor seem to be vulnerable to wraparound bug.
starting process of deprecating these backends: marked bcrypt backend
as 'preferred' throughout the documentation.
|
| | |\ \
| | |/ |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
``isinstance(xxx, native_string_types)`` checks, to handle str or unicode
under py2. this should explicitly take care of issue 54, but not closing
that until checking deeper into the unicode handling.
should allow str/unicode anywhere the inputs are program values
(e.g. config options), not user-provided values.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* relocated all hash._bind_needs_update() into the new hash.needs_update()
interface.
* des_crypt._generate_rounds() now makes default_rounds odd,
even if vary_round is unset (to prevent cyclic issue w/ needs_update).
* CryptRecord.needs_update() is now direct proxy for hash.needs_update().
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* removed _CryptRecord._init_encrypt_and_genconfig() -- it was just
wrapping some default options around encrypt() and genconfig().
now passing these straight to handler.using().
* HasManyIdents.using() implemented, to support CryptContext
passing default ident=xxx values.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is first part of relocation seeking to move most of the functionality
from inside the _CryptRecord class, into a public interface of the PasswordHash
class. This would give a number of benefits, including reducing the amount
of hash-specific hacks contained within CryptContext's internals.
* added PasswordHash.using(), which creates a subclass configured
with CryptContext options. Mixins can then provide
helpers to customize based on various parameters.
* added PasswordHash.needs_update(), a frontend for checking if a hash
needs updating per configuration provided via using().
* moved all the rounds generation code from _CryptRecord to HasRounds.using()'s
wrapper, and HasRounds._generate_rounds().
* moved all the rounds needs_update() code to HasRounds._calc_needs_update().
* _CryptRecord now calls hash.using() to configure rounds behavior,
and uses the methods of that custom handler, instead of the original,
so that rounds are taken into account.
|
| | | |
| | |
| | |
| | | |
clarity.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* removed exc_err() compat helper, can now use "Exception as err"
* next_method_attr replaced by nextgetter(), which seems a little cleaner
* removed py30/31 alias for SafeConfigParser
* put some PY26 features behind PY26 compat flag
* removed PY25 from setup classifiers
|
| |\ \ \
| |/ / |
|
| | | |
| | |
| | |
| | |
| | |
| | | |
_load_backend() entirely,
was causing problems with new _load_backend() framework.
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
support;
as well as PyPy 1.x and Jython 2.5.
shims removed
-------------
* b() shim replaced with b'' (py25)
* 'bytes' alias no longer needed (py25)
* callable() shim no longer needed (py30,31)
* PY_MIN_32 flag replaced with PY3 flag (py30,31)
* removed 'abc' module stub used by passlib.ifc (py25)
* removed chain_from_iterable() backport (py25)
* tests: removed catch_warnings() backport,
replaced refs with real warnings.catch_warnings() (py25)
* tests: removed unittest2 backports (py25, py30, py31) --
now throw hard error if unittest2 not present under py26
(the only release remaining which lacks the unittest2 features)
* removed SUPPORTS_DIR_METHOD conditional (py25, pypy 1.x)
* some other minor workarounds
other
-----
* added check in passlib.compat which now throws error telling user
version isn't supported (to prevent spurious errors later)
|
| | | |
| | |
| | |
| | | |
des_crypt code
|
| | |\ \
| | |/
| |/| |
|
| | | |\ |
|
| | | |\ \
| | | | |
| | | | |
| | | | | |
before 1.7 release)
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* updated sha1_crypt to use get_keyed_prf(), should be ~10% faster
* documented get_hash_info() and get_keyed_prf()
|
| | | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
* added multi-thread fuzz testing to shared PasswordHash test suite
* added code to detect pybcrypt <0.3, issue warning, and implement
thread-lock to workaround it's fatal concurrency issue.
* TODO: audit rest of passlib for threading issues (shouldn't be any major ones)
|