X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Fencryption%2Fimpl%2FEncrypter.cpp;h=b3dfb93b2a182c414d9a97b804771a8d680d56cf;hb=10f9e25bb2f29ec48303b02352166754157100e5;hp=45e9e073351981af31348a2f9580bdbdd7445985;hpb=6505807a62569ce65803b448b07a6872c6af2512;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/encryption/impl/Encrypter.cpp b/xmltooling/encryption/impl/Encrypter.cpp index 45e9e07..b3dfb93 100644 --- a/xmltooling/encryption/impl/Encrypter.cpp +++ b/xmltooling/encryption/impl/Encrypter.cpp @@ -186,15 +186,17 @@ EncryptedData* Encrypter::decorateAndUnmarshall(EncryptionParams& encParams, Key xmlEncData->releaseThisAndChildrenDOM(); // KeyInfo? - const KeyInfo* kinfo = encParams.m_credential ? encParams.m_credential->getKeyInfo(encParams.m_compact) : NULL; + KeyInfo* kinfo = encParams.m_credential ? encParams.m_credential->getKeyInfo(encParams.m_compact) : NULL; if (kinfo) - xmlEncData->setKeyInfo(kinfo->cloneKeyInfo()); + xmlEncData->setKeyInfo(kinfo); // Are we doing a key encryption? if (kencParams) { XSECCryptoKey* kek = kencParams->m_credential.getPublicKey(); if (!kek) throw EncryptionException("Credential in KeyEncryptionParams structure did not supply a public key."); + if (!kencParams->m_algorithm) + kencParams->m_algorithm = getKeyTransportAlgorithm(encParams.m_algorithm); m_cipher->setKEK(kek->clone()); // ownership of this belongs to us, for some reason... @@ -215,7 +217,7 @@ EncryptedData* Encrypter::decorateAndUnmarshall(EncryptionParams& encParams, Key // KeyInfo? kinfo = kencParams->m_credential.getKeyInfo(encParams.m_compact); if (kinfo) - xmlEncKey->setKeyInfo(kinfo->cloneKeyInfo()); + xmlEncKey->setKeyInfo(kinfo); // Add the EncryptedKey inline. if (!xmlEncData->getKeyInfo()) @@ -262,9 +264,9 @@ EncryptedKey* Encrypter::encryptKey(const unsigned char* keyBuffer, unsigned int xmlEncKey->setRecipient(kencParams.m_recipient); // KeyInfo? - const KeyInfo* kinfo = kencParams.m_credential.getKeyInfo(compact); + KeyInfo* kinfo = kencParams.m_credential.getKeyInfo(compact); if (kinfo) - xmlEncKey->setKeyInfo(kinfo->cloneKeyInfo()); + xmlEncKey->setKeyInfo(kinfo); xmlObjectKey.release(); return xmlEncKey;