Skip to main content

tsNetGenerateKey

Type​

function

Summary​

Generates an RSA public/private key for use with SFTP transfers.

Syntax​

tsNetGenerateKey(<pKeyLength>, <rPrivateKey>, <rPublicKey>, <pPassphrase>, [<pFormat])

Description​

Generates an RSA public/private key for use with SFTP transfers.

Parameters​

NameTypeDescription

pKeyLength

The length of the RSA key to generate.

rPrivateKey

A variable to store the RSA private key in.

rPublicKey

A variable to store the RSA public key in.

pPassphrase

The passphrase to protect the RSA private key with. Can be blank.

pFormat

Specifies the format that the generated keys are returned it. Accepts "PKCS#8" or "PKCS#1", the default is "PKCS#1".

Examples​

local tPrivKey, tPubKey, tResult
put tsNetGenerateKey(2048, tPrivKey, tPubKey, "secretkey", "PKCS#8") into tResult
if tResult is not empty then
answer "Failed to generate RSA key"
end if

Value​

NameTypeDescription

return

The tsNetGenerateKey function returns an empty string if successful, otherwise an error string will be returned.

library: tsNet

Compatibility and Support​

Introduced

LiveCode 8.1

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?