Source:
<code>private void decryptEncryptedAssertions(org.opensaml.saml.saml2.core.Response responseObject, FedizContext config) throws ProcessingException { if (responseObject.getEncryptedAssertions() != null && !responseObject.getEncryptedAssertions().isEmpty()) { KeyManager decryptionKeyManager = config.getDecryptionKey(); if (decryptionKeyManager == null || decryptionKeyManager.getCrypto() == null) { LOG.debug("We must have a decryption Crypto instance configured to decrypt encrypted tokens"); throw new ProcessingException(TYPE.BAD_REQUEST); } String keyPassword = decryptionKeyManager.getKeyPassword(); if (keyPassword == null) { LOG.debug("We must have a decryption key password to decrypt encrypted tokens"); throw new ProcessingException(TYPE.BAD_REQUEST); } String keyAlias = decryptionKeyManager.getKeyAlias(); if (keyAlias == null) { LOG.debug("No alias configured for decrypt"); throw new ProcessingException(TYPE.BAD_REQUEST); } try { PrivateKey privateKey = decryptionKeyManager.getCrypto().getPrivateKey(keyAlias, keyPassword); if (privateKey == null) { LOG.debug("No private key available"); throw new ProcessingException(TYPE.BAD_REQUEST); } BasicX509Credential cred = new BasicX509Credential( CertsUtils.getX509CertificateFromCrypto(decryptionKeyManager.getCrypto(), keyAlias)); cred.setPrivateKey(privateKey); StaticKeyInfoCredentialResolver resolver = new StaticKeyInfoCredentialResolver(cred); ChainingEncryptedKeyResolver keyResolver = new ChainingEncryptedKeyResolver( Arrays.<EncryptedKeyResolver>asList( new InlineEncryptedKeyResolver(), new EncryptedElementTypeEncryptedKeyResolver(), new SimpleRetrievalMethodEncryptedKeyResolver(), new SimpleKeyInfoReferenceEncryptedKeyResolver())); Decrypter decrypter = new Decrypter(null, resolver, keyResolver); for (EncryptedAssertion encryptedAssertion : responseObject.getEncryptedAssertions()) { Assertion decrypted = decrypter.decrypt(encryptedAssertion); <START> LOG.debug("Decrypted:" + DOM2Writer.nodeToString(decrypted.getDOM())); <END> responseObject.getAssertions().add(decrypted); } } catch (Exception e) { LOG.debug("Cannot decrypt assertions", e); throw new ProcessingException(TYPE.BAD_REQUEST); } } }</code><technical_language>wrap this in a LOG.isDebugEnabled() if statement, a performance problem calling nodeToString debug is enabled</technical_language>

Target:
private void decryptEncryptedAssertions(org.opensaml.saml.saml2.core.Response responseObject, FedizContext config) throws ProcessingException { if (responseObject.getEncryptedAssertions() != null && !responseObject.getEncryptedAssertions().isEmpty()) { KeyManager decryptionKeyManager = config.getDecryptionKey(); if (decryptionKeyManager == null || decryptionKeyManager.getCrypto() == null) { LOG.debug("We must have a decryption Crypto instance configured to decrypt encrypted tokens"); throw new ProcessingException(TYPE.BAD_REQUEST); } String keyPassword = decryptionKeyManager.getKeyPassword(); if (keyPassword == null) { LOG.debug("We must have a decryption key password to decrypt encrypted tokens"); throw new ProcessingException(TYPE.BAD_REQUEST); } String keyAlias = decryptionKeyManager.getKeyAlias(); if (keyAlias == null) { LOG.debug("No alias configured for decrypt"); throw new ProcessingException(TYPE.BAD_REQUEST); } try { PrivateKey privateKey = decryptionKeyManager.getCrypto().getPrivateKey(keyAlias, keyPassword); if (privateKey == null) { LOG.debug("No private key available"); throw new ProcessingException(TYPE.BAD_REQUEST); } BasicX509Credential cred = new BasicX509Credential( CertsUtils.getX509CertificateFromCrypto(decryptionKeyManager.getCrypto(), keyAlias)); cred.setPrivateKey(privateKey); StaticKeyInfoCredentialResolver resolver = new StaticKeyInfoCredentialResolver(cred); ChainingEncryptedKeyResolver keyResolver = new ChainingEncryptedKeyResolver( Arrays.<EncryptedKeyResolver>asList( new InlineEncryptedKeyResolver(), new EncryptedElementTypeEncryptedKeyResolver(), new SimpleRetrievalMethodEncryptedKeyResolver(), new SimpleKeyInfoReferenceEncryptedKeyResolver())); Decrypter decrypter = new Decrypter(null, resolver, keyResolver); for (EncryptedAssertion encryptedAssertion : responseObject.getEncryptedAssertions()) { Assertion decrypted = decrypter.decrypt(encryptedAssertion); if (LOG.isDebugEnabled()) { LOG.debug("Decrypted assertion: {}", DOM2Writer.nodeToString(decrypted.getDOM())); } responseObject.getAssertions().add(decrypted); } } catch (Exception e) { LOG.debug("Cannot decrypt assertions", e); throw new ProcessingException(TYPE.BAD_REQUEST); } } }