Function setPassword

Summary

#include <include/bitarchivecreator.hpp>

(1) void setPassword(const wstring &password) override

(2) void setPassword(const wstring &password, bool crypt_headers)

Function overload

Synopsis

#include <include/bitarchivecreator.hpp>

void setPassword(const wstring &password) override

Description

Sets up a password for the output archive.

When setting a password, the produced archive will be encrypted using the default cryptographic method of the output format. The option "crypt headers" remains unchanged, in contrast with what happens when calling the setPassword(wstring, bool) method.

Note
Calling setPassword when the output format doesn't support archive encryption (e.g. GZip, BZip2, etc...) does not have any effects (in other words, it doesn't throw exceptions and it has no effects on compression operations).
Note
After a password has been set, it will be used for every subsequent operation. To disable the use of the password, you need to call the clearPassword method (inherited from BitArchiveHandler), which is equivalent to setPassword(L"").
Parameters

password -

Source

Lines 164-166 in src/bitarchivecreator.cpp. Line 108 in include/bitarchivecreator.hpp.

void BitArchiveCreator::setPassword( const wstring& password ) {
    setPassword( password, mCryptHeaders );
}

Synopsis

#include <include/bitarchivecreator.hpp>

void setPassword(const wstring &password, bool crypt_headers)

Description

Sets up a password for the output archive.

When setting a password, the produced archive will be encrypted using the default cryptographic method of the output format. If the format is 7z and the option "crypt_headers" is set to true, also the headers of the archive will be encrypted, resulting in a password request everytime the output file will be opened.

Note
Calling setPassword when the output format doesn't support archive encryption (e.g. GZip, BZip2, etc...) does not have any effects (in other words, it doesn't throw exceptions and it has no effects on compression operations).
Note
Calling setPassword with "crypt_headers" set to true does not have effects on formats different from 7z.
Note
After a password has been set, it will be used for every subsequent operation. To disable the use of the password, you need to call the clearPassword method (inherited from BitArchiveHandler), which is equivalent to setPassword(L"").
Parameters

password - the password desired.

crypt_headers - if true, the headers of the output archive will be encrypted (valid only with 7z format).

Source

Lines 168-171 in src/bitarchivecreator.cpp. Line 133 in include/bitarchivecreator.hpp.

void BitArchiveCreator::setPassword( const wstring& password, bool crypt_headers ) {
    mPassword = password;
    mCryptHeaders = ( password.length() > 0 ) && crypt_headers;
}





Add Discussion as Guest

Log in