#92268# if a stream has its own encryption key use that one instead of the one from the ZipPackage
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: ZipPackageFolder.cxx,v $
|
* $RCSfile: ZipPackageFolder.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.49 $
|
* $Revision: 1.50 $
|
||||||
*
|
*
|
||||||
* last change: $Author: mtg $ $Date: 2001-09-14 15:14:12 $
|
* last change: $Author: mtg $ $Date: 2001-09-24 18:27:53 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@@ -307,7 +307,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
|
|||||||
pValue[1].Name = sFullPathProperty;
|
pValue[1].Name = sFullPathProperty;
|
||||||
pValue[1].Value <<= sTempName;
|
pValue[1].Value <<= sTempName;
|
||||||
|
|
||||||
rInfo.pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
|
pFolder->saveContents( sTempName, rManList, rZipOut, rEncryptionKey, rRandomPool);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -317,7 +317,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
|
|||||||
ZipPackageFolder::copyZipEntry ( *pTempEntry, pStream->aEntry );
|
ZipPackageFolder::copyZipEntry ( *pTempEntry, pStream->aEntry );
|
||||||
pTempEntry->sName = rPath + rShortName;
|
pTempEntry->sName = rPath + rShortName;
|
||||||
|
|
||||||
sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && bHaveEncryptionKey;
|
sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && (bHaveEncryptionKey || pStream->HasOwnKey());
|
||||||
sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
|
sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
|
||||||
|
|
||||||
pValue[0].Name = sMediaTypeProperty;
|
pValue[0].Name = sMediaTypeProperty;
|
||||||
@@ -333,10 +333,16 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
|
|||||||
rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
|
rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
|
||||||
sal_Int32 nIterationCount = 1024;
|
sal_Int32 nIterationCount = 1024;
|
||||||
|
|
||||||
rtl_digest_PBKDF2 ( reinterpret_cast < sal_uInt8 * > (aKey.getArray()), 16,
|
if ( pStream->HasOwnKey() )
|
||||||
reinterpret_cast < sal_uInt8 * > (rEncryptionKey.getArray()), rEncryptionKey.getLength(),
|
rtl_digest_PBKDF2 ( reinterpret_cast < sal_uInt8 * > (aKey.getArray()), 16,
|
||||||
aSalt.getConstArray(), 16,
|
reinterpret_cast < const sal_uInt8 * > (pStream->getKey().getConstArray()), pStream->getKey().getLength(),
|
||||||
nIterationCount );
|
aSalt.getConstArray(), 16,
|
||||||
|
nIterationCount );
|
||||||
|
else
|
||||||
|
rtl_digest_PBKDF2 ( reinterpret_cast < sal_uInt8 * > (aKey.getArray()), 16,
|
||||||
|
reinterpret_cast < const sal_uInt8 * > (rEncryptionKey.getConstArray()), rEncryptionKey.getLength(),
|
||||||
|
aSalt.getConstArray(), 16,
|
||||||
|
nIterationCount );
|
||||||
pStream->setInitialisationVector ( aVector );
|
pStream->setInitialisationVector ( aVector );
|
||||||
pStream->setSalt ( aSalt );
|
pStream->setSalt ( aSalt );
|
||||||
pStream->setIterationCount ( nIterationCount );
|
pStream->setIterationCount ( nIterationCount );
|
||||||
|
Reference in New Issue
Block a user