class KeyTests(unittest.TestCase): (source)
Known subclasses: twisted.conch.test.test_keys.PyNaClKeyTests
Undocumented
Method | set |
Undocumented |
Method | tear |
Undocumented |
Method | test__guess |
Test that the _guessStringType method guesses string types correctly. |
Method | test_blob |
Return the over-the-wire SSH format of the DSA public key. |
Method | test_blob |
Return the over-the-wire SSH format of the EC public key. |
Method | test_blob |
Return the over-the-wire SSH format of the Ed25519 public key. |
Method | test_blob |
RuntimeError is raised when the blob is requested for a Key which is not wrapping anything. |
Method | test_blob |
Return the over-the-wire SSH format of the RSA public key. |
Method | test_data |
The keys.Key.data method raises RuntimeError for bad keys. |
Method | test |
Test that Key objects are compared correctly. |
Method | test |
No summary |
Method | test_fingerprint |
A BadFingerPrintFormat error is raised when unsupported formats are requested. |
Method | test |
No summary |
Method | test |
No summary |
Method | test_from |
Test that keys are correctly generated from Agent v3 strings. |
Method | test_from |
A public DSA key is correctly generated from a public key blob. |
Method | test_from |
Key.fromString generates ECDSA keys from blobs. |
Method | test_from |
A public Ed25519 key is correctly generated from a public key blob. |
Method | test_from |
A public RSA key is correctly generated from a public key blob. |
Method | test_from |
A BadKeyError error is raised whey the blob has an unsupported key type. |
Method | test_from |
Test that fromFile works correctly. |
Method | test_from |
DSA public and private key can be generated from LSHs. |
Method | test_from |
BadKeyError exception is raised when private key has an unknown type. |
Method | test_from |
BadKeyError exception is raised when public key has an unknown type. |
Method | test_from |
RSA public and private keys can be generated from a LSH strings. |
Method | test_from |
Newer versions of OpenSSH generate encrypted keys which have a longer IV than the older versions. These newer keys are also loaded. |
Method | test_from |
Test that keys are correctly generated from OpenSSH strings. |
Method | test_from |
OpenSSH 6.5 introduced a newer "openssh-key-v1" private key format (made the default in OpenSSH 7.8). Loading keys in this format produces identical results to loading the same keys in the old PEM-based format. |
Method | test_from |
Test that keys are correctly generated from OpenSSH strings with Windows line endings. |
Method | test_from |
If key strings have trailing whitespace, it should be ignored. |
Method | test_from |
Tests for invalid key types. |
Method | test_from |
A private DSA key is correctly generated from a private key blob. |
Method | test_from |
A private EC key is correctly generated from a private key blob. |
Method | test_from |
A private Ed25519 key is correctly generated from a private key blob. |
Method | test_from |
A private RSA key is correctly generated from a private key blob. |
Method | test_from |
BadKeyError is raised when loading a private blob with an unsupported type. |
Method | test_from |
keys.Key.fromString should raise BadKeyError when the key is invalid. |
Method | test_from |
keys.Key.fromString applies Normalization Form KC to Unicode passphrases. |
Method | test |
Test that the PublicKey object is initialized correctly. |
Method | test_is |
The keys.Key.isPublic method returns True for public keys otherwise False. |
Method | test_not |
Test that Key objects are not-compared correctly. |
Method | test_private |
keys.Key.privateBlob returns the SSH protocol-level format of a DSA private key. |
Method | test_private |
keys.Key.privateBlob returns the SSH ptotocol-level format of EC private key. |
Method | test_private |
keys.Key.privateBlob returns the SSH protocol-level format of an Ed25519 private key. |
Method | test_private |
Raises RuntimeError if the underlying key object does not exists. |
Method | test_private |
keys.Key.privateBlob returns the SSH protocol-level format of an RSA private key. |
Method | test |
The keys.Key.public method returns a public key for both public and private keys. |
Method | test_repr |
The repr of a keys.Key contains all the OpenSSH format for an ECDSA private key. |
Method | test_repr |
The repr of a keys.Key contains all the OpenSSH format for an Ed25519 private key. |
Method | test_repr |
The repr of a keys.Key contains all of the RSA components for an RSA private key. |
Method | test_repr |
The repr of a keys.Key contains all the OpenSSH format for an ECDSA public key. |
Method | test_repr |
The repr of a keys.Key contains all the OpenSSH format for an Ed25519 public key. |
Method | test_repr |
The repr of a keys.Key contains all of the RSA components for an RSA public key. |
Method | test_sign |
Signed data can be verified using DSA. |
Method | test_sign |
Signed data can be verified using EC. |
Method | test_sign |
Signed data can be verified using Ed25519. |
Method | test_sign |
Signed data can be verified using RSA (with SHA-1, the default). |
Method | test_sign |
Signed data can be verified using RSA with SHA-256. |
Method | test_sign |
Signed data can be verified using RSA with SHA-512. |
Method | test_sign |
keys.Key.sign raises keys.BadSignatureAlgorithmError when asked to sign with a public key algorithm that doesn't make sense with the given key. |
Method | test |
The keys.Key.size method returns the size of key object in bits. |
Method | test_supported |
keys.Key.supportedSignatureAlgorithms returns the appropriate public key signature algorithms for each key type. |
Method | test_to |
keys.Key.toString serializes a DSA key in Agent v3 format. |
Method | test_to |
keys.Key.toString serializes an RSA key in Agent v3 format. |
Method | test_to |
keys.Key.toString serializes a DSA key in LSH format. |
Method | test_to |
keys.Key.toString serializes an RSA key in LSH format. |
Method | test_to |
keys.Key.toString serializes a DSA key in OpenSSH format. |
Method | test_to |
keys.Key.toString serializes a DSA key in OpenSSH's v1 format. |
Method | test_to |
keys.Key.toString serializes an ECDSA key in OpenSSH format. |
Method | test_to |
keys.Key.toString serializes an ECDSA key in OpenSSH's v1 format. |
Method | test_to |
keys.Key.toString serializes an Ed25519 key in OpenSSH's v1 format. |
Method | test_to |
keys.Key.toString refuses to serialize an Ed25519 key in OpenSSH's old PEM format, as no encoding of Ed25519 is defined for that format. |
Method | test_to |
keys.Key.toString serializes an RSA key in OpenSSH format. |
Method | test_to |
keys.Key.toString serializes an RSA key in OpenSSH's v1 format. |
Method | test_to |
keys.Key.toString raises keys.BadKeyError when passed an invalid format type. |
Method | test_to |
keys.Key.toString applies Normalization Form KC to Unicode passphrases. |
Method | test |
Test that the type method returns the correct type for an object. |
Method | test_verify |
A known-good DSA signature verifies successfully. |
Method | test_verify |
Some commercial SSH servers send DSA keys as 2 20-byte numbers; they are still verified as valid keys. |
Method | test_verify |
A known-good RSA signature verifies successfully. |
Class Variable | skip |
Undocumented |
Instance Variable | dsa |
Undocumented |
Instance Variable | dsa |
Undocumented |
Instance Variable | ec |
Undocumented |
Instance Variable | ec |
Undocumented |
Instance Variable | ec |
Undocumented |
Instance Variable | ed25519 |
Undocumented |
Instance Variable | key |
Undocumented |
Instance Variable | rsa |
Undocumented |
Instance Variable | rsa |
Undocumented |
Method | _test |
Undocumented |
Method | _test |
Undocumented |
Method | _test |
Undocumented |
Inherited from TestCase
:
Method | __call__ |
Run the test. Should always do exactly the same thing as run(). |
Method | __init__ |
Construct an asynchronous test case for methodName. |
Method | add |
Extend the base cleanup feature with support for cleanup functions which return Deferreds. |
Method | assert |
Fail if deferred does not errback with one of expectedFailures. Returns the original Deferred with callbacks added. You will need to return this Deferred from your test case. |
Method | defer |
Run any scheduled cleanups and report errors (if any) to the result. object. |
Method | defer |
Undocumented |
Method | defer |
Undocumented |
Method | defer |
Undocumented |
Method | get |
Undocumented |
Method | get |
Returns the timeout value set on this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a timeout attribute, returns that. Returns util.DEFAULT_TIMEOUT_DURATION ... |
Instance Variable | timeout |
A real number of seconds. If set, the test will raise an error if it takes longer than timeout seconds. If not set, util.DEFAULT_TIMEOUT_DURATION is used. |
Method | _cb |
Undocumented |
Method | _class |
Undocumented |
Method | _clean |
Undocumented |
Method | _deprecate |
Deprecate iterate, crash and stop on reactor. That is, each method is wrapped in a function that issues a deprecation warning, then calls the original. |
Method | _eb |
Undocumented |
Method | _eb |
Undocumented |
Method | _eb |
Undocumented |
Method | _make |
Create a method which wraps the reactor method name. The new method issues a deprecation warning and calls the original. |
Method | _run |
Run a single method, either a test method or fixture. |
Method | _run |
Really run setUp, the test method, and tearDown. Any of these may return defer.Deferred s. After they complete, do some reactor cleanup. |
Method | _undeprecate |
Restore the deprecated reactor methods. Undoes what _deprecateReactor did. |
Method | _wait |
Take a Deferred that only ever callbacks. Block until it happens. |
Instance Variable | _passed |
Undocumented |
Instance Variable | _reactor |
Undocumented |
Instance Variable | _timed |
Undocumented |
Inherited from SynchronousTestCase
(via TestCase
):
Method | __eq__ |
Override the comparison defined by the base TestCase which considers instances of the same class with the same _testMethodName to be equal. Since trial puts TestCase instances into a set, that definition of comparison makes it impossible to run the same test method twice... |
Method | __hash__ |
Undocumented |
Method | call |
Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated. |
Method | flush |
Remove stored errors received from the log. |
Method | flush |
Remove stored warnings from the list of captured warnings and return them. |
Method | get |
Retrieve a module attribute which should have been deprecated, and assert that we saw the appropriate deprecation warning. |
Method | get |
Return the skip reason set on this test, if any is set. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a skip attribute, returns that in a tuple (... |
Method | get |
Return a Todo object if the test is marked todo. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a todo attribute, returns that. Returns ... |
Method | mktemp |
Create a new path name which can be used for a new file or directory. |
Method | patch |
Monkey patch an object for the duration of the test. |
Method | run |
Run the test case, storing the results in result. |
Method | run |
If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside. |
Method | short |
Undocumented |
Instance Variable | failure |
An exception class, defaulting to FailTest. If the test method raises this exception, it will be reported as a failure, rather than an exception. All of the assertion methods raise this if the assertion fails. |
Instance Variable | suppress |
None or a list of tuples of (args, kwargs) to be passed to warnings.filterwarnings. Use these to suppress warnings raised in a test. Useful for testing deprecated code. See also util.suppress . |
Instance Variable | todo |
None , a string or a tuple of (errors, reason) where errors is either an exception class or an iterable of exception classes, and reason is a string. See Todo or makeTodo for more information. |
Method | _get |
Return the reason to use for skipping a test method. |
Method | _get |
Returns any warning suppressions set for this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a suppress attribute, returns that. ... |
Method | _install |
Undocumented |
Method | _remove |
Undocumented |
Method | _run |
Synchronously run any cleanups which have been added. |
Instance Variable | _cleanups |
Undocumented |
Instance Variable | _observer |
Undocumented |
Instance Variable | _parents |
Undocumented |
Instance Variable | _test |
Undocumented |
Instance Variable | _warnings |
Undocumented |
Inherited from _Assertions
(via TestCase
, SynchronousTestCase
):
Method | assert |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assert |
Fail if first - second > tolerance |
Method | assert |
Fail the test if first and second are not equal. |
Method | assert |
Fail the test if condition evaluates to True. |
Method | assert |
Fail the test if containee is not found in container. |
Method | assert |
Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Fail if instance is not an instance of the given class or of one of the given classes. |
Method | assert |
Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test. |
Method | assert |
Assert that deferred does not have a result at this point. |
Method | assert |
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. |
Method | assert |
Fail the test if first == second. |
Method | assert |
Fail the test if containee is found in container. |
Method | assert |
Fail if instance is an instance of the given class or of one of the given classes. |
Method | assert |
Fail if astring contains substring. |
Method | assert |
Fail the test unless calling the function f with the given args and kwargs raises exception. The failure will report the traceback and call stack of the unexpected exception. |
Method | assert |
Fail if substring does not exist within astring. |
Method | assert |
Fail the test if condition evaluates to False. |
Method | assert |
Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine. |
Method | fail |
Absolutely fail the test. Do not pass go, do not collect $200. |
Method | failure |
Return the current failure result of deferred or raise self.failureException. |
Method | success |
Return the current success result of deferred or raise self.failureException. |
Newer versions of OpenSSH generate encrypted keys which have a longer IV than the older versions. These newer keys are also loaded.
OpenSSH 6.5 introduced a newer "openssh-key-v1" private key format (made the default in OpenSSH 7.8). Loading keys in this format produces identical results to loading the same keys in the old PEM-based format.
keys.Key.sign
raises keys.BadSignatureAlgorithmError
when asked to sign with a public key algorithm that doesn't make sense with the given key.
keys.Key.supportedSignatureAlgorithms
returns the appropriate public key signature algorithms for each key type.
keys.Key.toString
refuses to serialize an Ed25519 key in OpenSSH's old PEM format, as no encoding of Ed25519 is defined for that format.
Some commercial SSH servers send DSA keys as 2 20-byte numbers; they are still verified as valid keys.