TrustCore SDK NanoSSH API reference  version 7.0
SFTP Client Authentication Key Functions

Functions

MOC_EXTERN MSTATUS SSHC_freeGenerateServerAuthKeyFile (ubyte **ppFreeEncodedAuthKey)
 Release an authentication key's memory. More...
 
MOC_EXTERN MSTATUS SSHC_generateServerAuthKeyFile (ubyte *pKeyBlob, ubyte4 keyBlobLen, ubyte **ppRetEncodedAuthKey, ubyte4 *pRetEncodedAuthKeyLen)
 Generate an exportable public key for an internal public key BLOB. More...
 
MOC_EXTERN MSTATUS SSHC_parsePublicKeyBuffer (ubyte *pKeyFile, ubyte4 keyFileLen, AsymmetricKey *pAsymKey)
 Parses an public key and generates an AsymmetricKey object. More...
 
MOC_EXTERN MSTATUS SSHC_parseServerAuthKeyFile (ubyte *pKeyFile, ubyte4 keyFileLen, AsymmetricKey *pAsymKey)
 Parses an exportable public key and generates an AsymmetricKey object. More...
 

Detailed Description

Function Documentation

◆ SSHC_freeGenerateServerAuthKeyFile()

MOC_EXTERN MSTATUS SSHC_freeGenerateServerAuthKeyFile ( ubyte **  ppFreeEncodedAuthKey)

This function releases the memory used to store the specified authentication key.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__

sshc.h

Parameters
ppFreeEncodedAuthKeyPointer to address of buffer containing the NULL-terminated authentication key string.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to synchronous NanoSSH clients.

sshc.h

◆ SSHC_generateServerAuthKeyFile()

MOC_EXTERN MSTATUS SSHC_generateServerAuthKeyFile ( ubyte *  pKeyBlob,
ubyte4  keyBlobLen,
ubyte **  ppRetEncodedAuthKey,
ubyte4 *  pRetEncodedAuthKeyLen 
)

This function generates an exportable public key from the specified internal public key BLOB. For exportable public key format, see the IETF Internet-Draft for SSH Public Key File Format: http://tools.ietf.org/html/draft-ietf-secsh-publickeyfile-13.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__

sshc.h

Parameters
pKeyBlobPointer to key blob.
keyBlobLenNumber of bytes in the key blob (pKeyBlob).
ppRetEncodedAuthKeyPointer to address of encoded authentication key, which on return contains the user's public key.
pRetEncodedAuthKeyLenPointer to ubyte4, which on return contains the number of bytes in the user's public key (ppRetEncodedAuthKey).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to synchronous NanoSSH clients.

sshc.h

◆ SSHC_parsePublicKeyBuffer()

MOC_EXTERN MSTATUS SSHC_parsePublicKeyBuffer ( ubyte *  pKeyFile,
ubyte4  keyFileLen,
AsymmetricKey *  pAsymKey 
)

This function takes a public key and generates a AsymmetricKey object. For public key formats, see: https://tools.ietf.org/html/rfc4253#section-6.6 for rsa and dsa. https://tools.ietf.org/html/rfc5656#section-3.1 for ecdsa https://tools.ietf.org/html/draft-ietf-curdle-ssh-ed25519-02 for ed25519

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__

sshc.h

Parameters
pKeyBlobPointer to buffer containing public key.
keyBlobLenNumber of bytes in key buffer (pKeyBlob).
pAsymKeyPointer to an AsymmetricKey object into which the key will be placed.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to synchronous NanoSSH clients.

sshc.h

◆ SSHC_parseServerAuthKeyFile()

MOC_EXTERN MSTATUS SSHC_parseServerAuthKeyFile ( ubyte *  pKeyFile,
ubyte4  keyFileLen,
AsymmetricKey *  pAsymKey 
)

This function takes a exportable public key file and generates a AsymmetricKey object. Format of file is algorithm identifier, followed by a white space, followed by the base64 encoded public key.

Since
1.41
Version
1.41 and later

To enable this function, the following flag must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_CLIENT__

sshc.h

Parameters
pKeyFilePointer to buffer containing an SSH key file.
keyFileLenNumber of bytes in key file buffer (pKeyFile).
pAsymKeyPointer to an AsymmetricKey object into which the key will be placed.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.
Remarks
This function is applicable to synchronous NanoSSH clients.

sshc.h