1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_package.hxx" 26 27 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> 28 #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 29 #include <com/sun/star/xml/sax/XAttributeList.hpp> 30 #include <com/sun/star/xml/crypto/DigestID.hpp> 31 #include <com/sun/star/xml/crypto/CipherID.hpp> 32 #include <com/sun/star/beans/PropertyValue.hpp> 33 #include <com/sun/star/uno/RuntimeException.hpp> 34 35 #include <ManifestDefines.hxx> 36 #include <ManifestExport.hxx> 37 #include <Base64Codec.hxx> 38 39 #include <rtl/ustrbuf.hxx> 40 #include <comphelper/documentconstants.hxx> 41 #include <comphelper/attributelist.hxx> 42 43 using namespace ::com::sun::star; 44 45 ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHandler, const uno::Sequence< uno::Sequence < beans::PropertyValue > >& rManList ) 46 { 47 const ::rtl::OUString sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) ); 48 const ::rtl::OUString sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) ); 49 const ::rtl::OUString sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) ); 50 const ::rtl::OUString sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) ); 51 const ::rtl::OUString sStartKeyGenerationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) ); 52 const ::rtl::OUString sKeyDerivationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) ); 53 54 const ::rtl::OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) ); 55 const ::rtl::OUString sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) ); 56 const ::rtl::OUString sVersionAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) ); 57 const ::rtl::OUString sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) ); 58 const ::rtl::OUString sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) ); 59 const ::rtl::OUString sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) ); 60 const ::rtl::OUString sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) ); 61 const ::rtl::OUString sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) ); 62 const ::rtl::OUString sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) ); 63 const ::rtl::OUString sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) ); 64 const ::rtl::OUString sStartKeyGenerationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) ); 65 const ::rtl::OUString sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) ); 66 const ::rtl::OUString sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) ); 67 const ::rtl::OUString sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM) ); 68 69 const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) ); 70 const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) ); 71 const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) ); 72 const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) ); 73 const ::rtl::OUString sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) ); 74 const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) ); 75 const ::rtl::OUString sInitialisationVectorProperty( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) ); 76 const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) ); 77 const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) ); 78 const ::rtl::OUString sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) ); 79 const ::rtl::OUString sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) ); 80 const ::rtl::OUString sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) ); 81 82 const ::rtl::OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) ); 83 84 const ::rtl::OUString sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) ); 85 const ::rtl::OUString sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) ); 86 87 const ::rtl::OUString sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) ); 88 const ::rtl::OUString sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) ); 89 90 const ::rtl::OUString sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) ); 91 const ::rtl::OUString sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) ); 92 93 const ::rtl::OUString sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) ); 94 95 ::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList; 96 const uno::Sequence < beans::PropertyValue > *pSequence = rManList.getConstArray(); 97 const sal_uInt32 nManLength = rManList.getLength(); 98 99 // find the mediatype of the document if any 100 ::rtl::OUString aDocMediaType; 101 ::rtl::OUString aDocVersion; 102 for (sal_uInt32 nInd = 0; nInd < nManLength ; nInd++ ) 103 { 104 ::rtl::OUString aMediaType; 105 ::rtl::OUString aPath; 106 ::rtl::OUString aVersion; 107 108 const beans::PropertyValue *pValue = pSequence[nInd].getConstArray(); 109 for (sal_uInt32 j = 0, nNum = pSequence[nInd].getLength(); j < nNum; j++, pValue++) 110 { 111 if (pValue->Name.equals (sMediaTypeProperty) ) 112 { 113 pValue->Value >>= aMediaType; 114 } 115 else if (pValue->Name.equals (sFullPathProperty) ) 116 { 117 pValue->Value >>= aPath; 118 } 119 else if (pValue->Name.equals (sVersionProperty) ) 120 { 121 pValue->Value >>= aVersion; 122 } 123 124 if ( aPath.getLength() && aMediaType.getLength() && aVersion.getLength() ) 125 break; 126 } 127 128 if ( aPath.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) ) 129 { 130 aDocMediaType = aMediaType; 131 aDocVersion = aVersion; 132 break; 133 } 134 } 135 136 sal_Bool bProvideDTD = sal_False; 137 sal_Bool bAcceptNonemptyVersion = sal_False; 138 sal_Bool bStoreStartKeyGeneration = sal_False; 139 if ( aDocMediaType.getLength() ) 140 { 141 if ( aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) ) 142 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) ) 143 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) ) 144 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) ) 145 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) ) 146 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) ) 147 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) ) 148 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) ) 149 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) ) 150 151 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) ) 152 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) ) 153 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) ) 154 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) ) 155 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) ) 156 || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) ) 157 158 { 159 // oasis format 160 pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ), 161 sCdataAttribute, 162 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) ); 163 bAcceptNonemptyVersion = sal_True; 164 if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 ) 165 { 166 // this is ODF12 generation, let encrypted streams contain start-key-generation entry 167 bStoreStartKeyGeneration = sal_True; 168 169 // starting from ODF12 the version should be also in manifest:manifest element 170 pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) ), 171 sCdataAttribute, 172 aDocVersion ); 173 } 174 } 175 else 176 { 177 // even if it is no SO6 format the namespace must be specified 178 // thus SO6 format is used as default one 179 pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ), 180 sCdataAttribute, 181 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_NAMESPACE ) ) ); 182 183 bProvideDTD = sal_True; 184 } 185 } 186 187 uno::Reference < xml::sax::XAttributeList > xRootAttrList (pRootAttrList); 188 189 xHandler->startDocument(); 190 uno::Reference < xml::sax::XExtendedDocumentHandler > xExtHandler ( xHandler, uno::UNO_QUERY ); 191 if ( xExtHandler.is() && bProvideDTD ) 192 { 193 ::rtl::OUString aDocType ( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_DOCTYPE ) ); 194 xExtHandler->unknown ( aDocType ); 195 xHandler->ignorableWhitespace ( sWhiteSpace ); 196 } 197 xHandler->startElement( sManifestElement, xRootAttrList ); 198 199 for (sal_uInt32 i = 0 ; i < nManLength ; i++) 200 { 201 ::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList; 202 const beans::PropertyValue *pValue = pSequence[i].getConstArray(); 203 ::rtl::OUString aString; 204 const uno::Any *pVector = NULL, *pSalt = NULL, *pIterationCount = NULL, *pDigest = NULL, *pDigestAlg = NULL, *pEncryptAlg = NULL, *pStartKeyAlg = NULL, *pDerivedKeySize = NULL; 205 for (sal_uInt32 j = 0, nNum = pSequence[i].getLength(); j < nNum; j++, pValue++) 206 { 207 if (pValue->Name.equals (sMediaTypeProperty) ) 208 { 209 pValue->Value >>= aString; 210 pAttrList->AddAttribute ( sMediaTypeAttribute, sCdataAttribute, aString ); 211 } 212 else if (pValue->Name.equals (sVersionProperty) ) 213 { 214 pValue->Value >>= aString; 215 // the version is stored only if it is not empty 216 if ( bAcceptNonemptyVersion && aString.getLength() ) 217 pAttrList->AddAttribute ( sVersionAttribute, sCdataAttribute, aString ); 218 } 219 else if (pValue->Name.equals (sFullPathProperty) ) 220 { 221 pValue->Value >>= aString; 222 pAttrList->AddAttribute ( sFullPathAttribute, sCdataAttribute, aString ); 223 } 224 else if (pValue->Name.equals (sSizeProperty) ) 225 { 226 sal_Int32 nSize = 0; 227 pValue->Value >>= nSize; 228 ::rtl::OUStringBuffer aBuffer; 229 aBuffer.append ( nSize ); 230 pAttrList->AddAttribute ( sSizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 231 } 232 else if (pValue->Name.equals (sInitialisationVectorProperty) ) 233 pVector = &pValue->Value; 234 else if (pValue->Name.equals (sSaltProperty) ) 235 pSalt = &pValue->Value; 236 else if (pValue->Name.equals (sIterationCountProperty) ) 237 pIterationCount = &pValue->Value; 238 else if (pValue->Name.equals ( sDigestProperty ) ) 239 pDigest = &pValue->Value; 240 else if (pValue->Name.equals ( sDigestAlgProperty ) ) 241 pDigestAlg = &pValue->Value; 242 else if (pValue->Name.equals ( sEncryptionAlgProperty ) ) 243 pEncryptAlg = &pValue->Value; 244 else if (pValue->Name.equals ( sStartKeyAlgProperty ) ) 245 pStartKeyAlg = &pValue->Value; 246 else if (pValue->Name.equals ( sDerivedKeySizeProperty ) ) 247 pDerivedKeySize = &pValue->Value; 248 } 249 250 xHandler->ignorableWhitespace ( sWhiteSpace ); 251 uno::Reference < xml::sax::XAttributeList > xAttrList ( pAttrList ); 252 xHandler->startElement( sFileEntryElement , xAttrList); 253 if ( pVector && pSalt && pIterationCount && pDigest && pDigestAlg && pEncryptAlg && pStartKeyAlg && pDerivedKeySize ) 254 { 255 // ==== Encryption Data 256 ::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; 257 uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList); 258 ::rtl::OUStringBuffer aBuffer; 259 uno::Sequence < sal_Int8 > aSequence; 260 261 xHandler->ignorableWhitespace ( sWhiteSpace ); 262 263 // ==== Digest 264 ::rtl::OUString sChecksumType; 265 sal_Int32 nDigestAlgID = 0; 266 *pDigestAlg >>= nDigestAlgID; 267 if ( nDigestAlgID == xml::crypto::DigestID::SHA256_1K ) 268 sChecksumType = sSHA256_1k_URL; 269 else if ( nDigestAlgID == xml::crypto::DigestID::SHA1_1K ) 270 sChecksumType = sSHA1_1k_Name; 271 else 272 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected digest algorithm is provided!" ) ), uno::Reference< uno::XInterface >() ); 273 274 pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType ); 275 *pDigest >>= aSequence; 276 Base64Codec::encodeBase64( aBuffer, aSequence ); 277 pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 278 279 xHandler->startElement( sEncryptionDataElement , xNewAttrList); 280 281 // ==== Algorithm 282 pNewAttrList = new ::comphelper::AttributeList; 283 xNewAttrList = pNewAttrList; 284 285 sal_Int32 nEncAlgID = 0; 286 sal_Int32 nDerivedKeySize = 0; 287 *pEncryptAlg >>= nEncAlgID; 288 *pDerivedKeySize >>= nDerivedKeySize; 289 290 ::rtl::OUString sEncAlgName; 291 if ( nEncAlgID == xml::crypto::CipherID::AES_CBC_W3C_PADDING ) 292 { 293 OSL_ENSURE( nDerivedKeySize, "Unexpected key size is provided!" ); 294 if ( nDerivedKeySize != 32 ) 295 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected key size is provided!" ) ), uno::Reference< uno::XInterface >() ); 296 297 sEncAlgName = sAES256_URL; 298 } 299 else if ( nEncAlgID == xml::crypto::CipherID::BLOWFISH_CFB_8 ) 300 { 301 sEncAlgName = sBlowfish_Name; 302 } 303 else 304 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpecte encryption algorithm is provided!" ) ), uno::Reference< uno::XInterface >() ); 305 306 pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName ); 307 308 *pVector >>= aSequence; 309 Base64Codec::encodeBase64 ( aBuffer, aSequence ); 310 pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 311 312 xHandler->ignorableWhitespace ( sWhiteSpace ); 313 xHandler->startElement( sAlgorithmElement , xNewAttrList); 314 xHandler->ignorableWhitespace ( sWhiteSpace ); 315 xHandler->endElement( sAlgorithmElement ); 316 317 // ==== Key Derivation 318 pNewAttrList = new ::comphelper::AttributeList; 319 xNewAttrList = pNewAttrList; 320 321 pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2_Name ); 322 323 if ( bStoreStartKeyGeneration ) 324 { 325 aBuffer.append( nDerivedKeySize ); 326 pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 327 } 328 329 sal_Int32 nCount = 0; 330 *pIterationCount >>= nCount; 331 aBuffer.append (nCount); 332 pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 333 334 *pSalt >>= aSequence; 335 Base64Codec::encodeBase64 ( aBuffer, aSequence ); 336 pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); 337 338 xHandler->ignorableWhitespace ( sWhiteSpace ); 339 xHandler->startElement( sKeyDerivationElement , xNewAttrList); 340 xHandler->ignorableWhitespace ( sWhiteSpace ); 341 xHandler->endElement( sKeyDerivationElement ); 342 343 // we have to store start-key-generation element as the last one to workaround the parsing problem 344 // in OOo3.1 and older versions 345 if ( bStoreStartKeyGeneration ) 346 { 347 // ==== Start Key Generation 348 pNewAttrList = new ::comphelper::AttributeList; 349 xNewAttrList = pNewAttrList; 350 351 ::rtl::OUString sStartKeyAlg; 352 ::rtl::OUString sStartKeySize; 353 sal_Int32 nStartKeyAlgID = 0; 354 *pStartKeyAlg >>= nStartKeyAlgID; 355 if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 ) 356 { 357 sStartKeyAlg = sSHA256_URL; 358 aBuffer.append( (sal_Int32)32 ); 359 sStartKeySize = aBuffer.makeStringAndClear(); 360 } 361 else if ( nStartKeyAlgID == xml::crypto::DigestID::SHA1 ) 362 { 363 sStartKeyAlg = sSHA1_Name; 364 aBuffer.append( (sal_Int32)20 ); 365 sStartKeySize = aBuffer.makeStringAndClear(); 366 } 367 else 368 throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key algorithm is provided!" ) ), uno::Reference< uno::XInterface >() ); 369 370 pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sStartKeyAlg ); 371 pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize ); 372 373 xHandler->ignorableWhitespace ( sWhiteSpace ); 374 xHandler->startElement( sStartKeyGenerationElement , xNewAttrList); 375 xHandler->ignorableWhitespace ( sWhiteSpace ); 376 xHandler->endElement( sStartKeyGenerationElement ); 377 } 378 379 xHandler->ignorableWhitespace ( sWhiteSpace ); 380 xHandler->endElement( sEncryptionDataElement ); 381 } 382 xHandler->ignorableWhitespace ( sWhiteSpace ); 383 xHandler->endElement( sFileEntryElement ); 384 } 385 xHandler->ignorableWhitespace ( sWhiteSpace ); 386 xHandler->endElement( sManifestElement ); 387 xHandler->endDocument(); 388 } 389