twisted.conch.test.test_keys.KeyTests(unittest.TestCase) class documentationtwisted.conch.test.test_keys
(View In Hierarchy)
| Method | setUp | Undocumented | 
| Method | tearDown | Undocumented | 
| Method | test_size | The keys.Key.sizemethod returns the size of key object in bits. | 
| Method | test__guessStringType | Test that the _guessStringType method guesses string types correctly. | 
| Method | test_public | The keys.Key.publicmethod returns a public key for both public and private keys. | 
| Method | test_isPublic | The keys.Key.isPublicmethod returns True for public keys otherwise False. | 
| Method | test_fromOpenSSH | Test that keys are correctly generated from OpenSSH strings. | 
| Method | test_fromOpenSSHErrors | Tests for invalid key types. | 
| Method | test_fromOpenSSH_with_whitespace | If key strings have trailing whitespace, it should be ignored. | 
| Method | test_fromNewerOpenSSH | Newer versions of OpenSSH generate encrypted keys which have a longer IV than the older versions. These newer keys are also loaded. | 
| Method | test_fromOpenSSH_v1_format | No summary | 
| Method | test_fromOpenSSH_windows_line_endings | Test that keys are correctly generated from OpenSSH strings with Windows line endings. | 
| Method | test_fromLSHPublicUnsupportedType | BadKeyErrorexception is raised when public key has an 
unknown type. | 
| Method | test_fromLSHPrivateUnsupportedType | BadKeyErrorexception is raised when private key has an 
unknown type. | 
| Method | test_fromLSHRSA | RSA public and private keys can be generated from a LSH strings. | 
| Method | test_fromLSHDSA | DSA public and private key can be generated from LSHs. | 
| Method | test_fromAgentv3 | Test that keys are correctly generated from Agent v3 strings. | 
| Method | test_fromStringErrors | keys.Key.fromString should raise BadKeyError when the key is invalid. | 
| Method | test_fromFile | Test that fromFile works correctly. | 
| Method | test_init | Test that the PublicKey object is initialized correctly. | 
| Method | test_equal | Test that Key objects are compared correctly. | 
| Method | test_notEqual | Test that Key objects are not-compared correctly. | 
| Method | test_dataError | The keys.Key.datamethod raises RuntimeError for bad keys. | 
| Method | test_fingerprintdefault | Test that the fingerprint method returns fingerprint in L{FingerprintFormats.MD5-HEX} format by default. | 
| Method | test_fingerprint_md5_hex | fingerprint method generates key fingerprint in L{FingerprintFormats.MD5-HEX} format if explicitly specified. | 
| Method | test_fingerprintsha256 | fingerprint method generates key fingerprint in L{FingerprintFormats.SHA256-BASE64} format if explicitly specified. | 
| Method | test_fingerprintBadFormat | A BadFingerPrintFormaterror is raised when unsupported 
formats are requested. | 
| Method | test_type | Test that the type method returns the correct type for an object. | 
| Method | test_fromBlobUnsupportedType | A BadKeyErrorerror is raised whey the blob has an 
unsupported key type. | 
| Method | test_fromBlobRSA | A public RSA key is correctly generated from a public key blob. | 
| Method | test_fromBlobDSA | A public DSA key is correctly generated from a public key blob. | 
| Method | test_fromBlobECDSA | Key.fromString generates ECDSA keys from blobs. | 
| Method | test_fromPrivateBlobUnsupportedType | BadKeyErroris raised when loading a private blob with an 
unsupported type. | 
| Method | test_fromPrivateBlobRSA | A private RSA key is correctly generated from a private key blob. | 
| Method | test_fromPrivateBlobDSA | A private DSA key is correctly generated from a private key blob. | 
| Method | test_fromPrivateBlobECDSA | A private EC key is correctly generated from a private key blob. | 
| Method | test_blobRSA | Return the over-the-wire SSH format of the RSA public key. | 
| Method | test_blobDSA | Return the over-the-wire SSH format of the DSA public key. | 
| Method | test_blobEC | Return the over-the-wire SSH format of the EC public key. | 
| Method | test_blobNoKey | RuntimeErroris raised when the blob is requested for a Key
which is not wrapping anything. | 
| Method | test_privateBlobRSA | keys.Key.privateBlobreturns the SSH protocol-level format of an RSA private key. | 
| Method | test_privateBlobDSA | keys.Key.privateBlobreturns the SSH protocol-level format of a DSA private key. | 
| Method | test_privateBlobEC | keys.Key.privateBlobreturns the SSH ptotocol-level format of EC private key. | 
| Method | test_privateBlobNoKeyObject | Raises RuntimeErrorif the underlying key object does not exists. | 
| Method | test_toOpenSSHRSA | keys.Key.toStringserializes an RSA key in OpenSSH format. | 
| Method | test_toOpenSSHRSA_v1_format | keys.Key.toStringserializes an RSA key in OpenSSH's v1 format. | 
| Method | test_toOpenSSHDSA | keys.Key.toStringserializes a DSA key in OpenSSH format. | 
| Method | test_toOpenSSHDSA_v1_format | keys.Key.toStringserializes a DSA key in OpenSSH's v1 format. | 
| Method | test_toOpenSSHECDSA | keys.Key.toStringserializes an ECDSA key in OpenSSH format. | 
| Method | test_toOpenSSHECDSA_v1_format | keys.Key.toStringserializes an ECDSA key in OpenSSH's v1 format. | 
| Method | test_toLSHRSA | keys.Key.toStringserializes an RSA key in LSH format. | 
| Method | test_toLSHDSA | keys.Key.toStringserializes a DSA key in LSH format. | 
| Method | test_toAgentv3RSA | keys.Key.toStringserializes an RSA key in Agent v3 format. | 
| Method | test_toAgentv3DSA | keys.Key.toStringserializes a DSA key in Agent v3 format. | 
| Method | test_toStringErrors | keys.Key.toStringraiseskeys.BadKeyErrorwhen passed an invalid format type. | 
| Method | test_signAndVerifyRSA | Signed data can be verified using RSA. | 
| Method | test_signAndVerifyDSA | Signed data can be verified using DSA. | 
| Method | test_signAndVerifyEC | Signed data can be verified using EC. | 
| Method | test_verifyRSA | A known-good RSA signature verifies successfully. | 
| Method | test_verifyDSA | A known-good DSA signature verifies successfully. | 
| Method | test_verifyDSANoPrefix | Some commercial SSH servers send DSA keys as 2 20-byte numbers; they are still verified as valid keys. | 
| Method | test_reprPrivateRSA | The repr of a keys.Keycontains 
all of the RSA components for an RSA private key. | 
| Method | test_reprPublicRSA | The repr of a keys.Keycontains 
all of the RSA components for an RSA public key. | 
| Method | test_reprPublicECDSA | The repr of a keys.Keycontains 
all the OpenSSH format for an ECDSA public key. | 
| Method | test_reprPrivateECDSA | The repr of a keys.Keycontains 
all the OpenSSH format for an ECDSA private key. | 
| Method | _testPublicPrivateFromString | Undocumented | 
| Method | _testPublicFromString | Undocumented | 
| Method | _testPrivateFromString | Undocumented | 
Inherited from TestCase:
| Instance Variable | timeout | A real number of seconds. If set, the test will raise an error if it takes 
longer than timeoutseconds. If not set, 
util.DEFAULT_TIMEOUT_DURATION is used. | 
| Method | __init__ | Construct an asynchronous test case for methodName. | 
| Method | assertFailure | Fail if deferreddoes not errback with one ofexpectedFailures. Returns the original Deferred with callbacks
added. You will need to return this Deferred from your test case. | 
| Method | __call__ | Run the test. Should always do exactly the same thing as run(). | 
| Method | deferSetUp | Undocumented | 
| Method | deferTestMethod | Undocumented | 
| Method | deferTearDown | Undocumented | 
| Method | deferRunCleanups | Run any scheduled cleanups and report errors (if any to the result object. | 
| Method | addCleanup | Extend the base cleanup feature with support for cleanup functions which return Deferreds. | 
| Method | getSuppress | Undocumented | 
| Method | getTimeout | No summary | 
| Method | _run | Run a single method, either a test method or fixture. | 
| Method | _ebDeferSetUp | Undocumented | 
| Method | _cbDeferTestMethod | Undocumented | 
| Method | _ebDeferTestMethod | Undocumented | 
| Method | _ebDeferTearDown | Undocumented | 
| Method | _cbDeferRunCleanups | Undocumented | 
| Method | _cleanUp | Undocumented | 
| Method | _classCleanUp | Undocumented | 
| Method | _makeReactorMethod | Create a method which wraps the reactor method name. The 
new method issues a deprecation warning and calls the original. | 
| Method | _deprecateReactor | Deprecate iterate,crashandstoponreactor. That is, each method is wrapped in a function that
issues a deprecation warning, then calls the original. | 
| Method | _undeprecateReactor | Restore the deprecated reactor methods. Undoes what _deprecateReactordid. | 
| Method | _runCleanups | Run the cleanups added with addCleanupin order. | 
| Method | _runFixturesAndTest | Really run setUp, the test method, andtearDown.  Any of these may returndefer.Deferreds.
After they complete, do some reactor cleanup. | 
| Method | _wait | Take a Deferred that only ever callbacks. Block until it happens. | 
Inherited from SynchronousTestCase (via TestCase):
| Instance Variable | failureException | 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 | skip | Noneor a string explaining why this test is to be skipped. If defined, the test
will not be run. Instead, it will be reported to the result object as 
'skipped' (if theTestResultsupports skipping). | 
| Instance Variable | todo | None,
a string or a tuple of(errors, reason)whereerrorsis either an exception class or an iterable of 
exception classes, andreasonis a string. SeeTodoormakeTodofor 
more information. | 
| Instance Variable | suppress | Noneor a list of tuples of(args, kwargs)to be passed towarnings.filterwarnings. Use these to suppress warnings raised
in a test. Useful for testing deprecated code. See alsoutil.suppress. | 
| Method | __eq__ | No summary | 
| Method | __ne__ | Undocumented | 
| Method | __hash__ | Undocumented | 
| Method | shortDescription | Undocumented | 
| Method | getSkip | No summary | 
| Method | getTodo | No summary | 
| Method | runTest | If no methodNameargument is passed to the constructor,runwill treat this method as the thing with the actual test inside. | 
| Method | run | Run the test case, storing the results in result. | 
| Method | patch | Monkey patch an object for the duration of the test. | 
| Method | flushLoggedErrors | Remove stored errors received from the log. | 
| Method | flushWarnings | Remove stored warnings from the list of captured warnings and return them. | 
| Method | callDeprecated | 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 | mktemp | Create a new path name which can be used for a new file or directory. | 
| Method | _getSuppress | No summary | 
| Method | _getSkipReason | Return the reason to use for skipping a test method. | 
| Method | _installObserver | Undocumented | 
| Method | _removeObserver | Undocumented | 
Inherited from _Assertions (via TestCase, SynchronousTestCase):
| Method | fail | Absolutely fail the test. Do not pass go, do not collect $200. | 
| Method | assertFalse | Fail the test if conditionevaluates to True. | 
| Method | assertTrue | Fail the test if conditionevaluates to False. | 
| Method | assertRaises | Fail the test unless calling the function fwith the givenargsandkwargsraisesexception. 
The failure will report the traceback and call stack of the unexpected 
exception. | 
| Method | assertEqual | Fail the test if firstandsecondare not 
equal. | 
| Method | assertIs | Fail the test if firstis notsecond.  This is
an obect-identity-equality test, not an object equality (i.e.__eq__) test. | 
| Method | assertIsNot | Fail the test if firstissecond.  This is an 
obect-identity-equality test, not an object equality (i.e.__eq__) test. | 
| Method | assertNotEqual | Fail the test if first==second. | 
| Method | assertIn | Fail the test if containeeis not found incontainer. | 
| Method | assertNotIn | Fail the test if containeeis found incontainer. | 
| Method | assertNotAlmostEqual | 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 | assertAlmostEqual | 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 | assertApproximates | Fail if first-second>tolerance | 
| Method | assertSubstring | Fail if substringdoes not exist withinastring. | 
| Method | assertNotSubstring | Fail if astringcontainssubstring. | 
| Method | assertWarns | 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 | assertIsInstance | Fail if instanceis not an instance of the given class or 
of one of the given classes. | 
| Method | assertNotIsInstance | Fail if instanceis an instance of the given class or of 
one of the given classes. | 
| Method | successResultOf | Return the current success result of deferredor raiseself.failureException. | 
| Method | failureResultOf | Return the current failure result of deferredor raiseself.failureException. | 
| Method | assertNoResult | Assert that deferreddoes not have a result at this 
point. | 
| Method | assertRegex | Fail the test if a regexpsearch oftextfails. | 
Test that the _guessStringType method guesses string types correctly.
The keys.Key.public
method returns a public key for both public and private keys.
If key strings have trailing whitespace, it should be ignored.
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.
Test that keys are correctly generated from OpenSSH strings with Windows line endings.
BadKeyError exception is raised when public key has an 
unknown type.
BadKeyError exception is raised when private key has an 
unknown type.
keys.Key.fromString should raise BadKeyError when the key is invalid.
Test that the fingerprint method returns fingerprint in
L{FingerprintFormats.MD5-HEX} format by default.
fingerprint method generates key fingerprint in
L{FingerprintFormats.MD5-HEX} format if explicitly specified.
fingerprint method generates key fingerprint in
L{FingerprintFormats.SHA256-BASE64} format if explicitly specified.
A BadFingerPrintFormat error is raised when unsupported 
formats are requested.
A BadKeyError error is raised whey the blob has an 
unsupported key type.
BadKeyError is raised when loading a private blob with an 
unsupported type.
A private RSA key is correctly generated from a private key blob.
A private DSA key is correctly generated from a private key blob.
A private EC key is correctly generated from a private key blob.
RuntimeError is raised when the blob is requested for a Key
which is not wrapping anything.
keys.Key.privateBlob
returns the SSH protocol-level format of an RSA private key.
keys.Key.privateBlob
returns the SSH protocol-level format of a DSA private key.
keys.Key.privateBlob
returns the SSH ptotocol-level format of EC private key.
Raises RuntimeError
if the underlying key object does not exists.
keys.Key.toString
serializes an RSA key in OpenSSH's v1 format.
keys.Key.toString
serializes a DSA key in OpenSSH's v1 format.
keys.Key.toString
serializes an ECDSA key in OpenSSH's v1 format.
keys.Key.toString
raises keys.BadKeyError
when passed an invalid format type.
Some commercial SSH servers send DSA keys as 2 20-byte numbers; they are still verified as valid keys.
The repr of a keys.Key contains 
all of the RSA components for an RSA private key.
The repr of a keys.Key contains 
all of the RSA components for an RSA public key.
The repr of a keys.Key contains 
all the OpenSSH format for an ECDSA public key.
The repr of a keys.Key contains 
all the OpenSSH format for an ECDSA private key.