![]() |
NetBurner 3.4.0
PDF Version |
Modules | |
SSH Error Codes | |
Typedefs | |
typedef int(* | sshUserAuthenticateFn) (const char *usernamePtr, const char *passwordPtr) |
[DEPRECATED] User provided SSH username and password authenticate routine for a server. Please consider sshUserAuthenticateWithTypeFn. More... | |
typedef int(* | sshUserAuthenticateWithTypeFn) (const char *usernamePtr, const char *authValPtr, AuthType authType) |
User provided SSH user authenticate routine for a server. More... | |
typedef int(* | sshGetUserPwFn) (const NBString &usernamePtr, NBString &passwordPtr) |
User provided SSH user password authentication routine for clients. More... | |
typedef int(* | sshGetUserKeyFn) (const NBString &usernamePtr, NBString &publicKey, NBString &privateKey, NBString &keyType) |
User provided SSH user key authenticate routine for clients. More... | |
typedef int(* | sshUserGetKeyFn) (int keyRequested, const unsigned char **keyBufferPtr, int *keyLengthPtr) |
The user defined callback to get the server key used during the initial SSH negotiation. More... | |
Functions | |
void | SshSetUserAuthenticate (sshUserAuthenticateFn sshUserAuthenticateFnPtr) |
[DEPRECATED] Sets the user defined server authentication function. Please consider sshUserAuthenticateWithTypeFn. More... | |
sshUserAuthenticateFn | SshGetUserAuthenticate (void) |
[DEPRECATED] Gets the user defined server authentication function. Please consider SshGetUserAuthenticateWithType. More... | |
void | SshSetUserAuthenticateWithType (sshUserAuthenticateWithTypeFn sshUserAuthenticateFnPtr) |
Sets the user defined server authentication function. More... | |
sshUserAuthenticateWithTypeFn | SshGetUserAuthenticateWithType (void) |
Gets the user defined server authentication function.. More... | |
void | SshClientSetGetUserPaswordFn (sshGetUserPwFn sshGetUserPwFnPtr) |
Sets the user defined client authentication function for getting user passwords during SSH authentication. More... | |
sshGetUserPwFn | SshClientGetUserPaswordFn (void) |
Gets the user defined client authentication function for getting a user password during authentication. More... | |
void | SshClientSetGetUserKeyFn (sshGetUserKeyFn sshGetUserKeyFnPtr) |
Sets the user defined client authentication function for getting user keys during SSH authentication. More... | |
sshGetUserKeyFn | SshClientGetUserKeyFn (void) |
Gets the user defined client authentication function for getting a user key during authentication. More... | |
void | SshSetUserGetKey (sshUserGetKeyFn sshUserGetKeyFnPtr) |
Sets the user defined callback method to provide the server key. More... | |
sshUserGetKeyFn | SshGetUserGetKey (void) |
Gets the user defined callback method to provide the server key. More... | |
bool | SshValidateKey (const char *candidateKey, int candidateKeySize, int *keyTypePtr, int keyFormat=WOLFSSH_FORMAT_ASN1) |
Takes a key and returns if it's valid or not. More... | |
bool | SshWritePublicKey (int publicKeyFd, unsigned char *candidateKey, int candidateKeySize) |
Write public key to file descriptor. Takes both PEM and ANS1 formats. More... | |
int | NbSshInit () |
Initializes the underlying SSH framework. This will start a background task used to handle negotiations and SSH traffic. This is automatically called by SshAccept and SshConnect, and doesn't need to be called directly except in special circumstances. More... | |
int | SshAccept (int listenFd, IPADDR *clientAddress, uint16_t *securePort, uint16_t timeout) |
Accepts and negotiates SSH session. Automatically calls NbSshInit() if required. More... | |
int | SshConnect (IPADDR clientAddress, uint16_t securePort, uint16_t localPort, uint16_t timeout, const char *username) |
Issues a connect request to negotiates an SSH session. Automatically calls NbSshInit() if required. More... | |
SshSocket * | SshNegotiateSession (int fd) |
Negotiates an SSH server session on an open file descriptor. More... | |
SshSocket * | SshNegotiateSessionClient (int secureFd, const char *username) |
Negotiates an SSH client session on an open file descriptor. More... | |
void | SshPrintStatistics (int secureFd) |
Negotiates an SSH client session on an open file descriptor. More... | |
int | SshGetKeySize () |
Determins and returns SSH's installed key size. More... | |
int | SshSetBannerText (const char *banner) |
Sets the banner text displayed by the SSH server on connection. More... | |
int | SshSetSockOption (int fd, int option) |
Set SSH TCP socket options. More... | |
int | SshClrSockOption (int fd, int option) |
Clear SSH TCP socket options. More... | |
int | SshGetSockOption (int fd) |
Returns the options for the specified SSH TCP socket. More... | |
The NetBurner SSH Library
typedef int(* sshGetUserKeyFn) (const NBString &usernamePtr, NBString &publicKey, NBString &privateKey, NBString &keyType) |
User provided SSH user key authenticate routine for clients.
usernamePtr | Username in plain text | |
[out] | publicKey | Used to return the corresponding public key for the user |
[out] | privateKey | Used to return the corresponding pviate key for the user |
[out] | keyType | Used to return the corresponding key type (ECC or RSA) for the user |
>0 | Pasword available for the user |
<=0 | Authentication failed |
User provided SSH user password authentication routine for clients.
usernamePtr | Username in plain text | |
[out] | passwordPtr | Used to return the corresponding password for the user |
>0 | Pasword available for the user |
<=0 | Authentication failed |
typedef int(* sshUserAuthenticateFn) (const char *usernamePtr, const char *passwordPtr) |
[DEPRECATED] User provided SSH username and password authenticate routine for a server. Please consider sshUserAuthenticateWithTypeFn.
usernamePtr | Username in plain text |
passwordPtr | Password in plain text |
1 | Authentication passed |
!1 | Authentication failed |
typedef int(* sshUserAuthenticateWithTypeFn) (const char *usernamePtr, const char *authValPtr, AuthType authType) |
User provided SSH user authenticate routine for a server.
usernamePtr | Username in plain text |
authValPtr | The value that is being passed in for authentication |
authType | Either a password or a key |
1 | Authentication passed |
!1 | Authentication failed |
typedef int(* sshUserGetKeyFn) (int keyRequested, const unsigned char **keyBufferPtr, int *keyLengthPtr) |
The user defined callback to get the server key used during the initial SSH negotiation.
keyRequested | Type key requested (ECC or RSA) |
keyBufferPtr | Buffer containing the key (ASN1 or PEM format supported) |
keyLengthPtr | Size of the key in 8 bit bytes |
0 | Key and length are valid |
-1 | Key requested is not available |
int NbSshInit | ( | ) |
Initializes the underlying SSH framework. This will start a background task used to handle negotiations and SSH traffic. This is automatically called by SshAccept and SshConnect, and doesn't need to be called directly except in special circumstances.
SSH_SUCCESS | if SSH system has been correctly initialized. |
Other | SSH error code if initialization was unsuccessful. |
int SshAccept | ( | int | listenFd, |
IPADDR * | clientAddress, | ||
uint16_t * | securePort, | ||
uint16_t | timeout | ||
) |
Accepts and negotiates SSH session. Automatically calls NbSshInit() if required.
listenFd | File descriptor of listening socket |
clientAddress | Address of client |
securePort | Secure port of negotiated socket |
timeout | Ticks to wait for connection, 0 is infinite |
>0 | The secure file descriptor if successful. |
Other | A TCP or SSH error code, depending on the error.. |
sshGetUserKeyFn SshClientGetUserKeyFn | ( | void | ) |
Gets the user defined client authentication function for getting a user key during authentication.
sshGetUserPwFnPtr | Sets the user defined server authentication function. |
sshGetUserPwFn SshClientGetUserPaswordFn | ( | void | ) |
Gets the user defined client authentication function for getting a user password during authentication.
A | pointer to the fuction that is currently set for passing in a user's password during authentication. |
void SshClientSetGetUserKeyFn | ( | sshGetUserKeyFn | sshGetUserKeyFnPtr | ) |
Sets the user defined client authentication function for getting user keys during SSH authentication.
sshGetUserKeyFnPtr | Sets the user defined server authentication function. |
void SshClientSetGetUserPaswordFn | ( | sshGetUserPwFn | sshGetUserPwFnPtr | ) |
Sets the user defined client authentication function for getting user passwords during SSH authentication.
sshGetUserPwFnPtr | Sets the user defined client authentication function. |
int SshClrSockOption | ( | int | fd, |
int | option | ||
) |
Clear SSH TCP socket options.
fd | Socket file descriptor. |
option | Socket option to clear: TCP Socket Options. |
int SshConnect | ( | IPADDR | clientAddress, |
uint16_t | securePort, | ||
uint16_t | localPort, | ||
uint16_t | timeout, | ||
const char * | username | ||
) |
Issues a connect request to negotiates an SSH session. Automatically calls NbSshInit() if required.
clientAddress | Address of client |
securePort | Secure port of negotiated socket |
localPort | Optional parameter to specify a Local port number. Recommend this always be set to a value of 0 so a random local port number is used. |
timeout | Ticks to wait for connection, 0 is infinite |
username | Username to use in negotiation process of secure connection |
>0 | The secure file descriptor if successful. |
0 | Request timed out. |
<0 | A TCP or SSH error code, depending on the error.. |
int SshGetKeySize | ( | ) |
Determins and returns SSH's installed key size.
int SshGetSockOption | ( | int | fd | ) |
Returns the options for the specified SSH TCP socket.
fd | Socket file descriptor. |
sshUserAuthenticateFn SshGetUserAuthenticate | ( | void | ) |
[DEPRECATED] Gets the user defined server authentication function. Please consider SshGetUserAuthenticateWithType.
Returns | a pointer to the function fuction that is currently set for server user authentication. |
sshUserAuthenticateWithTypeFn SshGetUserAuthenticateWithType | ( | void | ) |
Gets the user defined server authentication function..
A | pointer to the fuction that is currently set for server user authentication. |
sshUserGetKeyFn SshGetUserGetKey | ( | void | ) |
Gets the user defined callback method to provide the server key.
sshUserGetKeyFn | The user defined callback |
SshSocket * SshNegotiateSession | ( | int | fd | ) |
Negotiates an SSH server session on an open file descriptor.
fd | File descriptor to use in the SSN negotiation, usually obtained with a call to accept() |
SshSocket * SshNegotiateSessionClient | ( | int | secureFd, |
const char * | username | ||
) |
Negotiates an SSH client session on an open file descriptor.
secureFd | File descriptor to use in the SSN negotiation |
username | Username to use in negotiation process of secure connection |
void SshPrintStatistics | ( | int | secureFd | ) |
Negotiates an SSH client session on an open file descriptor.
secureFd | Secure file descriptor |
int SshSetBannerText | ( | const char * | banner | ) |
Sets the banner text displayed by the SSH server on connection.
banner | The text to display to any connected clients |
SSH_SUCCESS | If successful |
<0 | Error code on failure |
int SshSetSockOption | ( | int | fd, |
int | option | ||
) |
Set SSH TCP socket options.
fd | Socket file descriptor. |
option | Socket option to set: TCP Socket Options. |
void SshSetUserAuthenticate | ( | sshUserAuthenticateFn | sshUserAuthenticateFnPtr | ) |
[DEPRECATED] Sets the user defined server authentication function. Please consider sshUserAuthenticateWithTypeFn.
sshUserAuthenticateFnPtr | Fuction to set |
void SshSetUserAuthenticateWithType | ( | sshUserAuthenticateWithTypeFn | sshUserAuthenticateFnPtr | ) |
Sets the user defined server authentication function.
sshUserAuthenticateFnPtr | Fuction to set |
void SshSetUserGetKey | ( | sshUserGetKeyFn | sshUserGetKeyFnPtr | ) |
Sets the user defined callback method to provide the server key.
sshUserGetKeyFnPtr | The user defined callback |
bool SshValidateKey | ( | const char * | candidateKey, |
int | candidateKeySize, | ||
int * | keyTypePtr, | ||
int | keyFormat = WOLFSSH_FORMAT_ASN1 |
||
) |
Takes a key and returns if it's valid or not.
candidateKey | A pointer to a buffer containing the key | |
candidateKeySize | The size of the key in bytes | |
[out] | keyTypePtr | Is set to what kind of key is passed it (ECC and RSA are valid) |
keyFormat | The key format (ASN1 or PEM) |
true | The key is valid |
false | The key is not valid |
bool SshWritePublicKey | ( | int | publicKeyFd, |
unsigned char * | candidateKey, | ||
int | candidateKeySize | ||
) |
Write public key to file descriptor. Takes both PEM and ANS1 formats.
publicKeyFd | Open target file descriptor |
candidateKey | key in buffer |
candidateKeySize | Size of key in bytes |
true | A valid key was written to the file descriptor |
false | An error occurred |