sftp_option() =
{timeout, timeout()} |
{sftp_vsn, integer() >= 1} |
{window_size, integer() >= 1} |
{packet_size, integer() >= 1}
reason() = atom() | string() | tuple()
A description of the reason why an operation failed.
The atom()
value is formed from the sftp error codes in the protocol-level responses as defined in draft-ietf-secsh-filexfer-13
section 9.1. The codes are named as SSH_FX_*
which are transformed into lowercase of the star-part. E.g. the error code SSH_FX_NO_SUCH_FILE
will cause the reason()
to be no_such_file
.
The string()
reason is the error information from the server in case of an exit-signal. If that information is empty, the reason is the exit signal name.
The tuple()
reason are other errors like for example {exit_status,1}
.
Specifies the encryption or decryption applied to tar files when using open_tar/3
or open_tar/4
.
The encryption or decryption is applied to the generated stream of bytes prior to sending the resulting stream to the SFTP server.
For code examples see Section Example with encryption
in the ssh Users Guide.
The init_fun()
in the tar_crypto_spec
is applied once prior to any other crypto
operation. The intention is that this function initiates the encryption or decryption for example by calling crypto:crypto_init/4
or similar. The crypto_state()
is the state such a function may return.
If the selected cipher needs to have the input data partitioned into blocks of a certain size, the init_fun()
should return the second form of return value with the chunk_size()
set to the block size. If the chunk_size()
is undefined
, the size of the PlainBin
s varies, because this is intended for stream crypto, whereas a fixed chunk_size()
is intended for block crypto. A chunk_size()
can be changed in the return from the crypto_fun()
. The value can be changed between pos_integer()
and undefined
.
The initial crypto_state()
returned from the init_fun()
is folded into repeated applications of the crypto_fun()
in the tar_crypto_spec
. The binary returned from that fun is sent to the remote SFTP server and the new crypto_state()
is used in the next call of the crypto_fun()
.
If the crypto_fun()
reurns a chunk_size()
, that value is as block size for further blocks in calls to crypto_fun()
.
final_fun() =
fun((FinalTextIn :: binary(), crypto_state()) ->
{ok, FinalTextOut :: binary()})
If doing encryption, the final_fun()
in the tar_crypto_spec
is applied to the last piece of data. The final_fun()
is responsible for padding (if needed) and encryption of that last piece.