Go to the latest version of this document.

# ``twisted`.`conch`.`scripts`.`ckeygen``

module documentation
(source)

Implementation module for the `ckeygen` command.

Class | `GeneralOptions` | Undocumented
Function | `changePassPhrase` | Undocumented
Function | `displayPublicKey` | Undocumented
Function | `enumrepresentation` | Undocumented
Function | `generateDSAkey` | Undocumented
Function | `generateECDSAkey` | Undocumented
Function | `generateEd25519key` | Undocumented
Function | `generateRSAkey` | Undocumented
Function | `handleError` | Undocumented
Function | `printFingerprint` | Undocumented
Function | `run` | Undocumented
Variable | `supportedKeyTypes` | Undocumented
Function | `_defaultPrivateKeySubtype` | Return a reasonable default private key subtype for a given key type.
Function | `_getKeyOrDefault` | If `options["filename"]` is None, prompt the user to enter a path or attempt to set it to .ssh/id_rsa
Function | `_inputSaveFile` | Ask the user where to save the key.
Function | `_keyGenerator` | Undocumented
Function | `_saveKey` | Persist a SSH key on local filesystem.

def changePassPhrase(options): (source)

Undocumented

def displayPublicKey(options): (source)

Undocumented

def enumrepresentation(options): (source)

Undocumented

@_keyGenerator('dsa')
def generateDSAkey(options): (source)

Undocumented

@_keyGenerator('ecdsa')
def generateECDSAkey(options): (source)

Undocumented

@_keyGenerator('ed25519')
def generateEd25519key(options): (source)

Undocumented

@_keyGenerator('rsa')
def generateRSAkey(options): (source)

Undocumented

def handleError(): (source)

Undocumented

def printFingerprint(options: `dict[Any, Any]`): (source)

Undocumented

def run(): (source)

Undocumented

supportedKeyTypes = (source)

Undocumented

def _defaultPrivateKeySubtype(keyType): (source)

Return a reasonable default private key subtype for a given key type.

Parameters
keyType:`str` | A key type, as returned by `twisted.conch.ssh.keys.Key.type`.

Returns
`str` | A private OpenSSH key subtype (`'PEM'` or `'v1'`).

def _getKeyOrDefault(options: `dict[Any, Any]`, inputCollector: `Callable[[str], str] | None` = None, keyTypeName: `str` = 'rsa') -> `str`: (source)

If `options["filename"]` is None, prompt the user to enter a path or attempt to set it to .ssh/id_rsa

Parameters
options:`dict[Any, Any]` | command line options
inputCollector:`Callable[[str], str] | None` | dependency injection for testing
keyTypeName:`str` | key type or "rsa"

Returns
`str` | Undocumented

def _inputSaveFile(prompt: `str`) -> `str`: (source)

Ask the user where to save the key.

This needs to be a separate function so the unit test can patch it.

def _keyGenerator(keyType): (source)

Undocumented

def _saveKey(key: `keys.Key`, options: `dict[Any, Any]`, inputCollector: `Callable[[str], str] | None` = None): (source)

Persist a SSH key on local filesystem.

Parameters
key:`keys.Key` | Key which is persisted on local filesystem.
options:`dict[Any, Any]` |
inputCollector:`Callable[[str], str] | None` | Dependency injection for testing.