summaryrefslogtreecommitdiff
path: root/docs/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* totp: lots of documentation updates, added example walkthrough using new systemEli Collins2016-11-082-107/+243
|
* totp: renamed TOTP.verify() to TOTP.match(); added new TOTP.verify() in it's ↵Eli Collins2016-11-082-13/+30
| | | | | | | | | | | place. * renamed TOTP.verify() to TOTP.match() -- this matches the TotpMatch class name a little better, and frees up TOTP.verify() for something new. * added new TOTP.verify() which handles parsing TOTP config source, and calling TOTP.match(), in one go. Main purpose of this is that it has same signature (and roughly the same behavior) as PasswordHash.verify().
* totp: OTPContext no longer frontend, reduced down to merely holdingEli Collins2016-11-082-27/+9
| | | | | | | | | | | | | | | | | | | | | the application secrets needing for encryption -- renamed to AppWallet() * AppWallet class dedicated to just holding application secrets, rather than providing awkward frontend for TOTP construction. Intended method for invoking it is through TOTP.using(), which handles the details of construction. * Renamed TOTP.context attr to TOTP.wallet * Removed 'context' keyword from TOTP.from_source() etc, callers should now bind the wallet via TOTP.using().from_source(). * Made AppWallet.default_tag a public attr, renamed 'cost' attr to 'encrypt_cost' * Removed the passlib.totp toplevel constructors (new, from_uri, from_json) -- can now do all that from TOTP class.
* totp: added TOTP.using() for constructing TOTP factories with custom ↵Eli Collins2016-11-082-0/+5
| | | | | | | | | | | | | configuration options (such as secrets) already bound to the class. * added TOTP.using() helper * removed 'now' keyword from TOTP() constructor, can now only be specified via TOTP.using() -- adjusted UTs accordingly *
* totp: added TOTP.from_source() frontend which detects serialization format,Eli Collins2016-11-082-15/+18
| | | | and added TOTP.from_dict() for explicitly deserializing from dict format.
* totp: in place of stateful TOTP methods, expanded the TotpMatch() objectEli Collins2016-11-071-24/+36
| | | | | to provider .cache_seconds & .cache_time attributes to help applications decide how long the counter value should be cached.
* totp: stripped out the 'stateful' methods (TOTP.advance, TOTP.consume, and ↵Eli Collins2016-11-072-87/+5
| | | | | | | TOTP.last_counter). switching to purely stateless object, will update docs so that apps are instructed to persist verify()'s last_counter value independantly.
* totp: no functional code changes, just combined the BaseOTP and TOTP classes,Eli Collins2016-11-072-80/+45
| | | | since there's no need for the subdivision.
* totp: stripped out BaseOTP subtype resolutionEli Collins2016-11-072-16/+16
| | | | | | | | | | In preparation for merging BaseOTP & TOTP: * removed BaseOTP.type attr & ._type_map, * hardcoded TOTP class a few places since _type_map is gone * removed 'type' parameter from dict/json format (not needed since HTOP gone) * replaced refs to BaseOTP.from_*()/to_*() with TOTP.from_*()/to_*(), since the base class methods no longer work.
* totp: stripping out HOTP support -- not generally used/useful in the real worldEli Collins2016-11-072-70/+9
| | | | to justify the contortions it requires in the shared BaseOTP api.
* docs: marked MCF as "deprecated" in favor of PHC format, notes scrypt & ↵Eli Collins2016-10-042-3/+5
| | | | argon2 PHC compatibility.
* totp: documented the global from_uri() / from_json() helpers, as well as ↵Eli Collins2016-10-032-0/+25
| | | | to_dict() method.
* totp: added a bunch of tutorial content, relocated nested API documentationEli Collins2016-10-032-46/+558
| | | | | | | into their own sections of file so they're easier to navigate. tutorial covers a bunch of the basics, but still need to document OTPContext, and give a highlevel integration example.
* docs: large reorganization of documentationEli Collins2016-07-298-99/+200
| | | | | | | | | | * reordering into 'narrative' and 'reference' sections, to take advantage of 'fulltoc' extension making all pages visible in sidebar. * styling updates, requires latest cloud_sptheme * wording improvements to various bits of content
* docs: corrected / updated various bits of text, especially TOTP docsEli Collins2016-07-152-3/+8
|
* passlib.totp: large refactoring of API, added support for migration ↵Eli Collins2016-07-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | application secrets This reworks a large portion of the totp module's API, to make it fit better with the needs of the applications it's been integrated into so far. * Key encryption encapsulated in new OTPContext() class, which not only handles encryption of keys, but supports multiple application secrets, allowing migration to new secrets (whether periodic, or after a breach). This makes workflow of OTP object serialization *much* simpler. * encryption format changed to use a simple dict, which gets embedded into overall json data; eliminates need for custom binary format. * BaseOTP.generate_next() has been renamed to .advance(), to make it distinct from .generate(), and give better hinting that it modifies the internal state BaseOTP.verify_next() has been renamed to .consume() for similar reasons. * All .verify() and .verify_next() methods have been modified so they throw an InvalidTokenError if the token doesn't match, instead of returning False. This reduces the boilerplate needed to implement them, as code already had to catch ValueErrors for malformed tokens & reused tokens. - the HotpMatch / TotpMatch objects were adjusted to account for fact that they're only used when token matches successfully. * better exception hierarchy: added base TokenError, as well as subclasses for specific cases (MalformedTokenError, InvalidTokenError, UsedTokenError). * renamed BaseOTP.dirty -> BaseOTP.changed * BaseOTP now detects if encryption is old, and flags that re-encryption + re-serialization is needed. * .from_string() / .to_string() renamed to .from_json() / .to_json() to disambiguate with .from_uri() / .to_uri(), which also returns a string.
* docs: noted issue with sha256_cryptEli Collins2016-06-301-0/+19
|
* docs: cleaned up language & linksEli Collins2016-06-302-4/+6
|
* CryptContext: added "harden_verify" supportEli Collins2016-06-292-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v1.6 deprecated the "min_verify_time" feature, since it required admins to awkwardly hard-code the amount of time they wanted .verify() to take. This was a useful feature, though, since it provided the ability for contexts to mask which accounts had older, weaker, hashes. This commit adds in a replacement feature: CryptContext now supports a "harden_verify" flag, which causes it to autocalculate how long the default hash should take, and make sure to spend at least that much time. Another improvement is that this autocalc is performed at the context level, not per hash like min_verify_time was, making it overall more reliable. It also offers a new "context.dummy_verify()" call for faking the delay for missing accounts. Changes: * Added "harden_verify" option to CryptContext, along with code to autocalculate min_verify_time delay via timing when context is first accessed. XXX: this timing code needs some battle-testing, and may be adjusted later. * Added .dummy_verify() method, integrated it into .verify() and .verify_and_update(). * updated warnings & docs to report harden_verify as replacement for "min_verify_time" option. * to help workflow for adding delay on missing accounts, .verify() and .verify_and_update() now support passing in hash=None, and treat it as "never verifying"
* passlib.hash: Improved handling of hashes which truncate passwordsEli Collins2016-06-292-4/+12
| | | | | | | | | | | | | | * Added PasswordHash.truncate_size info attribute, to detect hashes which truncate the password. * All such hashes (bcrypt, des_crypt, some others) now accept a "truncate_error" option, allowing them to be switched from silent truncation to throwing an error instead. This option is also supported by CryptContext. * tests/HandlerCase: - removed .secret_size config flag, can now just read handler.truncate_size instead. - reworked truncation tests to use new API, and test 'truncate_error' policy support.
* Enhanced disabled hash managementEli Collins2016-06-261-0/+15
| | | | | | | | | | | | | | | | | | * PasswordHash.is_disabled flag now present, to programmatically detect disabled hashers (unix_disabled, etc) * CryptContext now offers methods for disabling, enabling, and testing hashes to see if they're tied to a real hash or not. * disabled hashers now offer .disable() and .enable() helpers, as backend for CryptContext methods. * django_disabled now appends random alphanumeric string, per Django. * adjusted HandlerCase: - checks handler.is_disabled, - handle django_disabled via disabled_contains_salt flag - tests .disable() and .enable() api if present
* docs: build fixesEli Collins2016-06-231-1/+1
| | | | | | * switched to custom sphinx-fulltoc branch for now, due to readthedocs issue * added tox.ini environment to test documentation building * fixed rst warnings about dup target & missing document
* docs: various updatesEli Collins2016-06-206-9/+35
| | | | | * updated new_application_quickstart to account for Argon2 * added doc page for passlib.crypto
* scrypt: hash format changedEli Collins2016-06-201-23/+14
| | | | | | | * tweaked passlib's format to follow argon2 and use explicit param names + normal base64 encoding * added support for openwall's $7$ format * moved hash tests to separate file
* pbkdf2_hmac: now supports hashlib.pbkdf2_hmac() and fastpbkdf2 as backends.Eli Collins2016-06-201-0/+6
| | | | | | | * digest code now checks for fastpbkdf2 & hashlib backends * tests: added some more test vectors from fastpbkdf2 * to match hashlib, now throwing OverflowError on large keylens, not ValueError. * to match hashlib, now throwing ValueError on keylen=0, previously returned b""
* passlib.hash.argon2: support for Argon2 hash formatEli Collins2016-06-172-0/+130
| | | | | | | | | | * passlib.handlers.argon2 module contains 'argon2' hasher class, for both argon2_cffi & argon2pure packages as backends. * added UTs from argon2 clib source, as well as some from argon2_cffi, and some more custom hashes. * UT harness: added limit so salt range test doesn't eat up all the memory under argon2.
* docs: replaced a bunch of :meth:`encrypt` referencesEli Collins2016-06-173-4/+4
|
* renamed PasswordHandler.replace() back to PasswordHandler.using()Eli Collins2016-06-159-10/+10
| | | | | this basically reversed rev 5c41b0153d4f; after using it a bit more, decided the name didn't indicate as well what the method was doing.
* PasswordHash.hash() api shift: deprecating passing settings kwds into hash() --Eli Collins2016-06-1510-21/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | callers should use handler.replace(**settings).hash() instead. this is being done because it greatly streamlines the internals of the .hash() implementation, and allows some redundant configuration parsing to be extracted from the .hash() methods and merged in with existing code in .replace(). this also opens things up for alternate code architectures for implementing new hashers, making it easier to wrap existing libraries (e.g. argon2). internals --------- * replaced a bunch of internal .hash(**settings) calls * GenericHandler - stripped out 'relaxed' keyword from constructor, since it's no longer passed by hash() etc. - _norm_checksum() now only invoked if checksum is specified (simplifies logic). keeping support for 'relaxed' mode, but only as explicit keyword. - removed some unused comments about .from_string() & .to_string() * HasSalt mixin: - .replace() now supports 'salt' keyword, creates variant which has a fixed salt string. - 'salt size' keyword removed from ctor, now handled by .replace() call - _norm_salt() converted to class method so it can be used by .replace() 'salt' keyword code. - per-instance bits of _norm_salt() relocated to HasSalt.__init__ proper - _generate_salt() converted to class method, since no longer depends on instance config. * HasRounds mixin: - similar to HasSalt, relocates per-instance bits of _norm_rounds() into HasRounds.__init__() proper. - remainder of _norm_rounds() turned into class method, merged with ._clip_to_valid_rounds() helper to reduce duplication. - _generate_rounds() converted to class method, since no longer depends on instance config. hashers ------- * fshp: added support for 'variant' keyword to replace() * unix_disabled: added support for 'marker' keyword to replace(), added UTs. * cisco_type7: to match HasSalt, added support for 'salt' keyword to replace(), added UTs. * sha256/512_crypt: now uses custom salt & rounds parsing, rather than relaxed kwd, to handle correctable-but-invalid config strings. unittests --------- * removed checks for PasslibConfigWarning when setting hash(rounds=) out of policy bounds, since that now *is* setting the policy. * adapted some handler ctor to deal w/ lack of 'relaxed' kwd docs ---- * updated docstrings listing hash() keywords for each scheme to list them as .replace() keywords. * updated example code to use .replace() * fleshed out api docs about the change
* passlib.utils: consteq() now an alias for hmac.compare_digest() on python ↵Eli Collins2016-06-111-1/+34
| | | | 3.3 and up
* passlib.apache: drastically rewrote parsing & rendering codeEli Collins2016-06-111-2/+5
| | | | | | | * now preserves whitespace & comments to match htpasswd. * now warns about & skips duplicate entries for same user. * added semi-private .set_hash() helpers for writing hash directly. * some internal cleanups to Htdigest's realm handling
* passlib.handlers.scrypt: created scrypt hash handler, complete with UTs and docsEli Collins2016-06-102-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* passlib.utils.handlers / HasRounds: the 'rounds' keyword is now treatedEli Collins2016-06-101-0/+15
| | | | | | | | | | | 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
* passlib.context: deprecating the 'all' preset scheme --Eli Collins2016-06-101-0/+5
| | | | | | | | | | only legitimate use was for 'vary_rounds' option, which is being phased out, and other uses like 'min_rounds' were a security issue. * fixed CryptContext() tests to stop uses "all" kwds * issue dep warning if "all" scheme is used * issue config warning if anything but "vary_rounds" is used, since config needs to be changed (regardless of passlib version)
* deprecating the 'vary_rounds' option -- *very* little security benefit,Eli Collins2016-06-102-7/+8
| | | | | | | 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
* .encrypt() method renamed to .hash(), other api cleanupsEli Collins2016-06-1033-80/+81
| | | | | | | | | | | | | | | | .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().
* passlib.pwd: big cleanup pass, removing code that won't be ready for releaseEli Collins2016-02-111-29/+5
| | | | | | | | | | | | | | | | | | | | | | | * 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
* added reference for cisco_asa algorithmEli Collins2016-02-101-0/+3
|
* relocated many of the crypto routes inside passlib.utils,Eli Collins2016-02-1012-49/+90
| | | | | | | | | | | | | | | | | | | 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.
* passlib.ext.django: dropped support for django 1.6-1.7, per passlib 1.6.6 ↵Eli Collins2016-02-091-2/+4
| | | | | | | | | announcement motivation is that django hashers framework has matured greatly as of django 1.8, and dropping all prior versions not only eases support burden, but opens up opportunity for integration via less invasive method in a future passlib release, using django 1.8 as a common base.
* Merge with stableEli Collins2016-02-091-0/+1
|\
| * CryptContext: callers can now provider contextual keywords for any hash in ↵Eli Collins2016-02-081-0/+1
| | | | | | | | | | | | the context, and they will only be passed on for the hashes that support them (fixes issue 63).
* | Merge from stableEli Collins2015-07-252-2/+8
|\ \ | |/
| * clarified behavior doc textEli Collins2015-07-251-2/+2
| |
| * added warning about cisco_pix ASA 7.0 compatibilityEli Collins2015-07-251-0/+6
| |
* | forgot additional doc file from previous cisco_asa commitEli Collins2015-07-251-0/+14
| |
* | cisco asa tweaksEli Collins2015-07-252-20/+39
| | | | | | | | | | | | | | | | | | | | | | | | * split cisco ASA 7.0 code out into separate 'cisco_asa' class, some minor reformatting of the internals (no alg changes). * updated documentation to reflect the two different classes, added to changelog. * added some reference vectors generated by current implementation -- vectors chosen to verify thresholds around various if/thens in the ASA alg. added note that these still need to be verified by official implementation.
* | MergeEli Collins2015-07-257-21/+151
|\ \
| * \ Merge from stableEli Collins2015-07-225-17/+67
| |\ \ | | |/
| | * updates changelog & other docs to reflect upcoming 1.6.3 changesEli Collins2015-07-211-1/+1
| | |