Discuss this help topic in SecureBlackbox Forum

Generate an SSH keypair

Use TElSSHKey.Generate() method to generate an SSH keypair. Pass the desired algorithm and key length in bits as parameters:


TElSSHKey key = new TElSSHKey();
key.Generate(SBSSHKeyStorage.Unit.ALGORITHM_RSA, 1024);

Note: please get yourself familiar with legitimate key lengths before generating keys. For example, the length of DSA keys should be a multiple of 512. For ECDSA keys, the NIST P256 curve is taken for any length less or equal to 256, the NIST P384 curve is used for bit counts 257 to 384, and the NIST P521 curve is used for longer key lengths.

You can also use GenerateEC() method to generate a keypair under a different curve (use any curve from SBSSHConstants.Unit.SSH_EC_FIRST to SBSSHConstants.Unit.SSH_EC_LAST set).

Once the keypair has been generated, you can save it to files using SavePublicKey() and SavePrivateKey() methods.

How To articles about SSH keys

Discuss this help topic in SecureBlackbox Forum