33#include <com/sun/star/beans/PropertyValue.hpp>
34#include <com/sun/star/task/InteractionHandler.hpp>
35#include <com/sun/star/task/MasterPasswordRequest.hpp>
36#include <com/sun/star/task/NoMasterException.hpp>
37#include <com/sun/star/lang/XMultiServiceFactory.hpp>
39#include <osl/diagnose.h>
40#include <rtl/character.hxx>
41#include <rtl/cipher.h>
42#include <rtl/digest.h>
43#include <rtl/byteseq.hxx>
44#include <rtl/ustrbuf.hxx>
55static OUString
createIndex(
const std::vector< OUString >& lines)
57 OUStringBuffer aResult;
59 for(
size_t i = 0;
i < lines.size();
i++ )
64 const char* pLine =
line.getStr();
68 if (rtl::isAsciiAlphanumeric(
static_cast<unsigned char>(*pLine)))
70 aResult.append(*pLine);
74 aResult.append(
"_" + OUString::number(*pLine, 16) );
81 return aResult.makeStringAndClear();
87 std::vector< OUString > aResult;
91 const char* pLine =
line.getStr();
94 OUStringBuffer newItem;
100 while( *pLine && ( pLine[0] !=
'_' || pLine[1] !=
'_' ))
103 newItem.append( *pLine );
109 for(
int i = 1;
i < 3;
i++ )
112 || ( ( pLine[
i] <
'0' || pLine[
i] >
'9' )
113 && ( pLine[
i] <
'a' || pLine[
i] >
'f' )
114 && ( pLine[
i] <
'A' || pLine[
i] >
'F' ) ) )
116 OSL_FAIL(
"Wrong index syntax!" );
120 aNum += OUStringChar( pLine[
i] );
123 newItem.append(
sal_Unicode( aNum.toUInt32( 16 ) ) );
127 aResult.push_back( newItem.makeStringAndClear() );
128 }
while( pLine[0] ==
'_' && pLine[1] ==
'_' );
131 OSL_FAIL(
"Wrong index syntax!" );
139 sal_Int32 aInd =
aURL.lastIndexOf(
'/' );
140 if( aInd > 0 &&
aURL.indexOf(
"://" ) != aInd-2 )
154 ::rtl::ByteSequence outbuf( buf.getLength()*2+1 );
156 for(
int ind = 0; ind < buf.getLength(); ind++ )
158 outbuf[ind*2] = (
static_cast<sal_uInt8>(buf[ind]) >> 4 ) +
'a';
159 outbuf[ind*2+1] = (
static_cast<sal_uInt8>(buf[ind]) & 0x0f ) +
'a';
161 outbuf[buf.getLength()*2] =
'\0';
163 aResult = OUString::createFromAscii(
reinterpret_cast<char*
>(outbuf.getArray()) );
171 OSL_ENSURE(
line.size() % 2 == 0,
"Wrong syntax!" );
173 ::rtl::ByteSequence aResult(
line.size()/2);
175 for(
int ind = 0; ind < tmpLine.getLength()/2; ind++ )
177 aResult[ind] = (
static_cast<sal_uInt8>( tmpLine[ind*2] -
'a' ) << 4 ) |
static_cast<sal_uInt8>( tmpLine[ind*2+1] -
'a' );
189 sal_Int32 aNodeCount = aNodeNames.getLength();
192 std::transform(aNodeNames.begin(), aNodeNames.end(),
aPropNames.getArray(),
193 [](
const OUString& rName) -> OUString {
194 return
"Store/Passwordstorage['" + rName +
"']/Password"; });
195 std::transform(aNodeNames.begin(), aNodeNames.end(),
aPropNames.getArray() + aNodeCount,
196 [](
const OUString& rName) -> OUString {
197 return
"Store/Passwordstorage['" + rName +
"']/InitializationVector"; });
203 OSL_FAIL(
"Problems during reading" );
207 for( sal_Int32 aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd )
209 std::vector< OUString > aUrlUsr =
getInfoFromInd( aNodeNames[aNodeInd] );
211 if( aUrlUsr.size() == 2 )
213 OUString aUrl = aUrlUsr[0];
214 OUString
aName = aUrlUsr[1];
221 PasswordMap::iterator aIter = aResult.find( aUrl );
222 if( aIter != aResult.end() )
223 aIter->second.emplace_back(
aName, aEPasswd, aIV );
227 std::vector< NamePasswordRecord > listToAdd( 1, aNewRecord );
233 OSL_FAIL(
"Wrong index syntax!" );
242 ConfigItem::SetModified();
243 ConfigItem::PutProperties( {
"UseStorage" }, {
uno::Any(bUse) } );
255 OSL_FAIL(
"Problems during reading" );
259 bool aResult =
false;
274 OSL_FAIL(
"Problems during reading" );
278 sal_Int32 nResult = 0;
299 OSL_FAIL(
"Problems during reading" );
316 bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty );
318 ConfigItem::SetModified();
319 ConfigItem::PutProperties( {
"HasMaster",
"Master",
"MasterInitializationVector",
"StorageVersion" },
333 ConfigItem::ClearNodeElements(
"Store", sendSeq );
339 ConfigItem::ClearNodeSet(
"Store" );
347 OSL_FAIL(
"Unexpected storing of a record!" );
357 ConfigItem::SetModified();
358 ConfigItem::SetSetProperties(
"Store", sendSeq );
379 std::unique_lock aGuard(
mMutex );
381 mComponent.set( rxContext->getServiceManager(), UNO_QUERY );
392 std::unique_lock aGuard(
mMutex );
405 std::unique_lock aGuard(
mMutex );
416std::vector< OUString >
PasswordContainer::DecodePasswords( std::u16string_view aLine, std::u16string_view aIV, std::u16string_view aMasterPasswd, css::task::PasswordRequestMode mode )
418 if( !aMasterPasswd.empty() )
420 rtlCipher aDecoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
421 OSL_ENSURE( aDecoder,
"Can't create decoder" );
425 OSL_ENSURE( aMasterPasswd.size() == RTL_DIGEST_LENGTH_MD5 * 2,
"Wrong master password format!" );
427 unsigned char code[RTL_DIGEST_LENGTH_MD5];
428 for(
int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
429 code[ ind ] =
static_cast<char>(
o3tl::toUInt32(aMasterPasswd.substr( ind*2, 2 ), 16));
431 unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0};
434 for(
int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
436 auto tmp = aIV.substr( ind*2, 2 );
437 iv[ ind ] =
static_cast<char>(rtl_ustr_toInt64_WithLength(tmp.data(), 16, tmp.size()));
441 rtlCipherError
result = rtl_cipher_init (
442 aDecoder, rtl_Cipher_DirectionDecode,
443 code, RTL_DIGEST_LENGTH_MD5, iv, RTL_DIGEST_LENGTH_MD5 );
445 if(
result == rtl_Cipher_E_None )
449 ::rtl::ByteSequence resSeq(
aSeq.getLength() );
451 rtl_cipher_decode ( aDecoder,
aSeq.getArray(),
aSeq.getLength(),
452 reinterpret_cast<sal_uInt8*
>(resSeq.getArray()), resSeq.getLength() );
454 OUString aPasswd(
reinterpret_cast<char*
>(resSeq.getArray()), resSeq.getLength(), RTL_TEXTENCODING_UTF8 );
456 rtl_cipher_destroy (aDecoder);
461 rtl_cipher_destroy (aDecoder);
466 OSL_FAIL(
"No master password provided!" );
471 OSL_FAIL(
"Problem with decoding" );
472 throw css::task::NoMasterException(
473 "Can't decode!", css::uno::Reference<css::uno::XInterface>(),
mode);
478 if( !aMasterPasswd.empty() )
482 rtlCipher aEncoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
483 OSL_ENSURE( aEncoder,
"Can't create encoder" );
487 OSL_ENSURE( aMasterPasswd.size() == RTL_DIGEST_LENGTH_MD5 * 2,
"Wrong master password format!" );
489 unsigned char code[RTL_DIGEST_LENGTH_MD5];
490 for(
int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
491 code[ ind ] =
static_cast<char>(
o3tl::toUInt32(aMasterPasswd.substr( ind*2, 2 ), 16));
493 unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0};
496 for(
int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
498 auto tmp = aIV.substr( ind*2, 2 );
499 iv[ ind ] =
static_cast<char>(rtl_ustr_toInt64_WithLength(tmp.data(), 16, tmp.size()));
503 rtlCipherError
result = rtl_cipher_init (
504 aEncoder, rtl_Cipher_DirectionEncode,
505 code, RTL_DIGEST_LENGTH_MD5, iv, RTL_DIGEST_LENGTH_MD5 );
507 if(
result == rtl_Cipher_E_None )
509 ::rtl::ByteSequence resSeq(
aSeq.getLength()+1);
511 result = rtl_cipher_encode ( aEncoder,
aSeq.getStr(),
aSeq.getLength()+1,
512 reinterpret_cast<sal_uInt8*
>(resSeq.getArray()), resSeq.getLength() );
542 rtl_cipher_destroy (aEncoder);
544 if(
result == rtl_Cipher_E_None )
549 rtl_cipher_destroy (aEncoder);
554 OSL_FAIL(
"No master password provided!" );
559 OSL_FAIL(
"Problem with encoding" );
565 for (
auto & aNPIter : toUpdate)
566 if( aNPIter.GetUserName() == aRecord.
GetUserName() )
592 toUpdate.insert( toUpdate.begin(), aRecord );
598 ::std::vector< OUString > aPasswords;
608 aPasswords.insert( aPasswords.end(), aDecodedPasswords.begin(), aDecodedPasswords.end() );
610 catch( NoMasterException& )
613 io_bTryToDecode =
false;
624 auto aResultRange = asNonConstRange(aResult);
626 bool bTryToDecode =
true;
628 for (
auto const& aNPIter : original)
640 std::unique_lock aGuard(
mMutex );
648 std::unique_lock aGuard(
mMutex );
656 unsigned char iv[RTL_DIGEST_LENGTH_MD5];
657 rtl_random_getBytes(randomPool, iv, RTL_DIGEST_LENGTH_MD5);
661 aBuffer.append(OUString::number(
i >> 4, 16) + OUString::number(
i & 15, 16));
663 return aBuffer.makeStringAndClear();
669 ::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString> >( Passwords );
681 OSL_FAIL(
"Unexpected persistence status!" );
691 UpdateVector( aIter->first, aIter->second, aRecord,
true );
696 std::vector< NamePasswordRecord > listToAdd( 1, aRecord );
707 return find( aURL, u
"",
false, aHandler );
719 for (
auto const& aNPIter : userlist)
721 if( aNPIter.GetUserName() ==
aName )
723 bool bTryToDecode =
true;
735 const PasswordMap::iterator & rIter,
737 std::u16string_view aName,
745 if( aUsrRec.hasElements() )
747 rRec = UrlRecord( rIter->first, aUsrRec );
763 const OUString& aURL,
764 std::u16string_view aName,
768 std::unique_lock aGuard(
mMutex );
772 OUString aUrl( aURL );
779 PasswordMap::iterator aIter =
m_aContainer.find( aUrl );
788 OUString tmpUrl( aUrl );
789 if ( !tmpUrl.endsWith(
"/") )
793 if( aIter !=
m_aContainer.end() && aIter->first.match( tmpUrl ) )
801 while(
shorterUrl( aUrl ) && !aUrl.isEmpty() );
809 OUStringBuffer aResult;
810 for ( sal_Int32 nInd = 0; nInd < RTL_DIGEST_LENGTH_MD5; nInd++ )
811 aResult.append(
"aa");
813 return aResult.makeStringAndClear();
825 xHandler->handle( xRequest );
829 if ( xSelection.is() )
834 const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & xSupp
835 = xRequest->getAuthenticationSupplier();
837 aResult = xSupp->getPassword();
849 for (
int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ++ind)
851 auto tmp = rPass.substr(ind * 2, 2);
852 unsigned char i =
static_cast<char>(rtl_ustr_toInt64_WithLength(tmp.data(), 16, tmp.size()));
854 + OUStringChar(
static_cast< sal_Unicode >(
'a' + (
i & 15))));
856 return aBuffer.makeStringAndClear();
861 PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER;
867 OUString aEncodedMP, aEncodedMPIV;
868 bool bDefaultPassword =
false;
870 if( !
m_xStorageFile->getEncodedMasterPassword( aEncodedMP, aEncodedMPIV ) )
871 aRMode = PasswordRequestMode_PASSWORD_CREATE;
872 else if ( aEncodedMP.isEmpty() )
875 bDefaultPassword =
true;
878 if ( !bDefaultPassword )
880 bool bAskAgain =
false;
885 if ( !aPass.isEmpty() )
887 if( aRMode == PasswordRequestMode_PASSWORD_CREATE )
900 std::vector< OUString > aRM(
DecodePasswords( aEncodedMP, aEncodedMPIV, aPass, aRMode ) );
901 if( aRM.empty() || aPass != aRM[0] )
904 aRMode = PasswordRequestMode_PASSWORD_REENTER;
911 }
while( bAskAgain );
924 std::unique_lock aGuard(
mMutex );
926 OUString aUrl(
aURL );
930 PasswordMap::iterator aIter =
m_aContainer.find( aUrl );
934 if( aUrl.endsWith(
"/") )
935 aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
945 auto aNPIter = std::find_if(aIter->second.begin(), aIter->second.end(),
948 if (aNPIter != aIter->second.end())
954 aIter->second.erase( aNPIter );
956 if( aIter->second.empty() )
964 std::unique_lock aGuard(
mMutex );
966 OUString aUrl(
aURL );
970 PasswordMap::iterator aIter =
m_aContainer.find( aUrl );
974 if( aUrl.endsWith(
"/") )
975 aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
985 auto aNPIter = std::find_if(aIter->second.begin(), aIter->second.end(),
988 if (aNPIter == aIter->second.end())
1001 aIter->second.erase( aNPIter );
1003 if( aIter->second.empty() )
1009 std::unique_lock aGuard(
mMutex);
1020 for( std::vector< NamePasswordRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); )
1033 aNPIter = aIter->second.erase(aNPIter);
1039 if( aIter->second.empty() )
1052 std::unique_lock aGuard(
mMutex );
1056 for (
auto const& aNP : rEntry.second)
1059 sal_Int32 oldLen = aUsers.getLength();
1060 aUsers.realloc( oldLen + 1 );
1062 GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) );
1065 if( aUsers.hasElements() )
1067 sal_Int32 oldLen = aResult.getLength();
1068 aResult.realloc( oldLen + 1 );
1069 aResult.getArray()[ oldLen ] = UrlRecord( rEntry.first, aUsers );
1078 bool bResult =
false;
1079 OUString aEncodedMP, aEncodedMPIV;
1080 uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
1081 std::unique_lock aGuard(
mMutex );
1086 if ( aEncodedMP.isEmpty() )
1094 if ( !xTmpHandler.is() )
1096 uno::Reference< lang::XMultiServiceFactory >
xFactory(
mComponent, uno::UNO_QUERY_THROW );
1098 xTmpHandler.set( InteractionHandler::createWithParent(xContext,
nullptr), uno::UNO_QUERY_THROW );
1104 PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER;
1110 if (!aPass.isEmpty() &&
m_xStorageFile->getStorageVersion() == 0)
1116 aRMode = PasswordRequestMode_PASSWORD_REENTER;
1117 }
while( !bResult && !aPass.isEmpty() );
1126 catch( uno::Exception& )
1137 bool bResult =
false;
1138 uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
1139 std::unique_lock aGuard(
mMutex );
1143 if ( !xTmpHandler.is() )
1145 uno::Reference< lang::XMultiServiceFactory >
xFactory(
mComponent, uno::UNO_QUERY_THROW );
1147 xTmpHandler.set( InteractionHandler::createWithParent(xContext,
nullptr), uno::UNO_QUERY_THROW );
1150 bool bCanChangePassword =
true;
1152 OUString aEncodedMP, aEncodedMPIV;
1156 if ( bCanChangePassword )
1161 if ( !aPass.isEmpty() )
1176 for (
const auto& rURL : aPersistent )
1177 for (
const auto& rUser : rURL.UserList )
1179 uno::Reference< task::XInteractionHandler >() );
1191 std::unique_lock aGuard(
mMutex);
1203 m_xStorageFile->setEncodedMasterPassword( OUString(), OUString() );
1209 std::unique_lock aGuard(
mMutex );
1212 throw uno::RuntimeException();
1214 OUString aEncodedMP, aEncodedMPIV;
1220 std::unique_lock aGuard(
mMutex );
1223 throw uno::RuntimeException();
1237 std::unique_lock aGuard(
mMutex );
1240 throw uno::RuntimeException();
1247 bool bResult =
false;
1248 uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
1249 std::unique_lock aGuard(
mMutex );
1253 if ( !xTmpHandler.is() )
1255 uno::Reference< lang::XMultiServiceFactory >
xFactory(
mComponent, uno::UNO_QUERY_THROW );
1257 xTmpHandler.set( InteractionHandler::createWithParent(xContext,
nullptr), uno::UNO_QUERY_THROW );
1260 bool bCanChangePassword =
true;
1262 OUString aEncodedMP, aEncodedMPIV;
1263 if(
m_xStorageFile->getEncodedMasterPassword( aEncodedMP, aEncodedMPIV ) && !aEncodedMP.isEmpty() )
1266 if ( bCanChangePassword )
1270 if ( !aPass.isEmpty() )
1280 m_xStorageFile->setEncodedMasterPassword( OUString(), OUString(),
true );
1283 for (
const auto& rURL : aPersistent )
1284 for (
const auto& rUser : rURL.UserList )
1286 uno::Reference< task::XInteractionHandler >() );
1299 std::unique_lock aGuard(
mMutex );
1302 throw uno::RuntimeException();
1304 OUString aEncodedMP, aEncodedMPIV;
1305 return (
m_xStorageFile->useStorage() &&
m_xStorageFile->getEncodedMasterPassword( aEncodedMP, aEncodedMPIV ) && aEncodedMP.isEmpty() );
1332 std::unique_lock aGuard(
mMutex );
1337 for( std::vector< NamePasswordRecord >::iterator aNPIter = rEntry.second.begin(); aNPIter != rEntry.second.end(); )
1349 aNPIter = rEntry.second.erase(aNPIter);
1360 for(
const auto& rEntry : addon )
1362 PasswordMap::iterator aSearchIter =
m_aContainer.find( rEntry.first );
1364 for (
auto const& aNP : rEntry.second)
1365 UpdateVector( aSearchIter->first, aSearchIter->second, aNP,
false );
1373 return "stardiv.svl.PasswordContainer";
1383 return {
"com.sun.star.task.PasswordContainer" };
1386extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1388 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
1396 MasterPasswordRequest aRequest;
1398 aRequest.Classification = InteractionClassification_ERROR;
1399 aRequest.Mode =
Mode;
1407 = new ::ucbhelper::InteractionSupplyAuthentication(
1414 RememberAuthentication_NO,
1416 RememberAuthentication_NO,
1422 new ::ucbhelper::InteractionAbort(
this ),
1423 new ::ucbhelper::InteractionRetry(
this ),
PropertyValueVector_t aPropertyValues
MasterPasswordRequest_Impl(css::task::PasswordRequestMode Mode)
::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier
::std::vector< OUString > GetMemoryPasswords() const
bool HasPasswords(sal_Int8 nStatus) const
OUString GetPersistentPasswords() const
void SetMemoryPasswords(::std::vector< OUString > &&aMemList)
void SetPersistentPasswords(const OUString &aPersList, const OUString &aPersIV)
OUString GetPersistentIV() const
const OUString & GetUserName() const
SysCredentialsConfig mUrlContainer
css::uno::Sequence< css::task::UserRecord > CopyToUserRecordSequence(const ::std::vector< NamePasswordRecord > &original, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void PrivateAdd(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, char aMode, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
static OUString GetDefaultMasterPassword()
static OUString RequestPasswordFromUser(css::task::PasswordRequestMode aRMode, const css::uno::Reference< css::task::XInteractionHandler > &xHandler)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void UpdateVector(const OUString &url, ::std::vector< NamePasswordRecord > &toUpdate, NamePasswordRecord const &rec, bool writeFile)
std::optional< StorageItem > m_xStorageFile
bool createUrlRecord(const PasswordMap::iterator &rIter, bool bName, std::u16string_view aName, const css::uno::Reference< css::task::XInteractionHandler > &aHandler, css::task::UrlRecord &rRec)
virtual void SAL_CALL removeUrl(const OUString &Url) override
virtual void SAL_CALL removeMasterPassword() override
virtual sal_Bool SAL_CALL useDefaultMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
virtual css::uno::Sequence< OUString > SAL_CALL getUrls(sal_Bool OnlyPersistent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::lang::XComponent > mComponent
static ::std::vector< OUString > DecodePasswords(std::u16string_view aLine, std::u16string_view aIV, std::u16string_view aMasterPassword, css::task::PasswordRequestMode mode)
virtual sal_Bool SAL_CALL isDefaultMasterPasswordUsed() override
virtual OUString SAL_CALL findUrl(const OUString &Url) override
virtual void SAL_CALL removePersistent(const OUString &aUrl, const OUString &aUserName) override
virtual void SAL_CALL remove(const OUString &aUrl, const OUString &aUserName) override
PasswordContainer(const css::uno::Reference< css::uno::XComponentContext > &)
virtual sal_Bool SAL_CALL changeMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
OUString m_aMasterPassword
css::task::UserRecord CopyToUserRecord(const NamePasswordRecord &aRecord, bool &io_bTryToDecode, const css::uno::Reference< css::task::XInteractionHandler > &aHandler)
virtual void SAL_CALL removeAllPersistent() override
virtual void SAL_CALL addPersistent(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual ~PasswordContainer() override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL addUrl(const OUString &Url, sal_Bool MakePersistent) override
css::task::UrlRecord find(const OUString &aURL, std::u16string_view aName, bool bName, const css::uno::Reference< css::task::XInteractionHandler > &aHandler)
virtual sal_Bool SAL_CALL isPersistentStoringAllowed() override
OUString const & GetMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &Handler)
static OUString EncodePasswords(const std::vector< OUString > &lines, std::u16string_view aIV, std::u16string_view aMasterPassword)
virtual void SAL_CALL add(const OUString &aUrl, const OUString &aUserName, const css::uno::Sequence< OUString > &aPasswords, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual sal_Bool SAL_CALL allowPersistentStoring(sal_Bool bAllow) override
virtual sal_Bool SAL_CALL hasMasterPassword() override
css::uno::Sequence< css::task::UserRecord > FindUsr(const ::std::vector< NamePasswordRecord > &userlist, std::u16string_view name, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
virtual sal_Bool SAL_CALL authorizateWithMasterPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler) override
virtual css::uno::Sequence< css::task::UrlRecord > SAL_CALL getAllPersistent(const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
virtual css::task::UrlRecord SAL_CALL findForName(const OUString &aUrl, const OUString &aUserName, const css::uno::Reference< css::task::XInteractionHandler > &Handler) override
void setEncodedMasterPassword(const OUString &aResult, const OUString &aResultIV, bool bAcceptEmpty=false)
void remove(const OUString &url, const OUString &rec)
bool getEncodedMasterPassword(OUString &aResult, OUString &aResultIV)
void update(const OUString &url, const NamePasswordRecord &rec)
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
virtual void ImplCommit() override
PasswordContainer * mainCont
void setUseStorage(bool bUse)
sal_Int32 getStorageVersion()
OUString find(OUString const &rURL)
css::uno::Sequence< OUString > list(bool bOnlyPersistent)
void remove(OUString const &rURL)
void add(OUString const &rURL, bool bPersistent)
void setRequest(const css::uno::Any &rRequest)
void setContinuations(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &rContinuations)
Reference< XSingleServiceFactory > xFactory
Sequence< sal_Int8 > aSeq
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
static OUString ReencodeAsOldHash(std::u16string_view rPass)
static std::vector< OUString > getInfoFromInd(std::u16string_view aInd)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * svl_PasswordContainer_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static bool shorterUrl(OUString &aURL)
::rtl::ByteSequence getBufFromAsciiLine(std::u16string_view line)
static OUString createIndex(const std::vector< OUString > &lines)
static OUString getAsciiLine(const ::rtl::ByteSequence &buf)
constexpr sal_Int32 nCurrentStorageVersion
::std::pair< const OUString, ::std::vector< NamePasswordRecord > > PairUrlRecord
#define PERSISTENT_RECORD
::std::map< OUString, ::std::vector< NamePasswordRecord > > PasswordMap
const PropertyStruct aPropNames[]
std::unique_ptr< char[]> aBuffer