docs: protected Credential getKeyEncryptionCredential(final String peerEntityId,
                                                      final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
                                                      final SamlRegisteredService service) throws Exception {
          val config = DefaultSecurityConfigurationBootstrap.buildDefaultEncryptionConfiguration();
  
          val overrideDataEncryptionAlgorithms = samlIdPProperties.getAlgs().getOverrideDataEncryptionAlgorithms();
          val overrideKeyEncryptionAlgorithms = samlIdPProperties.getAlgs().getOverrideKeyEncryptionAlgorithms();
          val overrideBlackListedEncryptionAlgorithms = samlIdPProperties.getAlgs().getOverrideBlackListedEncryptionAlgorithms();
          val overrideWhiteListedAlgorithms = samlIdPProperties.getAlgs().getOverrideWhiteListedAlgorithms();
  
          if (overrideBlackListedEncryptionAlgorithms != null && !overrideBlackListedEncryptionAlgorithms.isEmpty()) {
              config.setBlacklistedAlgorithms(overrideBlackListedEncryptionAlgorithms);
          }
  
          if (overrideWhiteListedAlgorithms != null && !overrideWhiteListedAlgorithms.isEmpty()) {
              config.setWhitelistedAlgorithms(overrideWhiteListedAlgorithms);
          }
  
          if (overrideDataEncryptionAlgorithms != null && !overrideDataEncryptionAlgorithms.isEmpty()) {
              config.setDataEncryptionAlgorithms(overrideDataEncryptionAlgorithms);
          }
  
          if (overrideKeyEncryptionAlgorithms != null && !overrideKeyEncryptionAlgorithms.isEmpty()) {
              config.setKeyTransportEncryptionAlgorithms(overrideKeyEncryptionAlgorithms);
          }
  
          LOGGER.debug("Encryption blacklisted algorithms: [{}]", config.getBlacklistedAlgorithms());
          LOGGER.debug("Encryption key algorithms: [{}]", config.getKeyTransportEncryptionAlgorithms());
          LOGGER.debug("Signature data algorithms: [{}]", config.getDataEncryptionAlgorithms());
          LOGGER.debug("Encryption whitelisted algorithms: [{}]", config.getWhitelistedAlgorithms());
  
          val kekCredentialResolver = new MetadataCredentialResolver();
  
          val providers = new ArrayList<KeyInfoProvider>();
          providers.add(new RSAKeyValueProvider());
          providers.add(new DSAKeyValueProvider());
          providers.add(new InlineX509DataProvider());
          providers.add(new DEREncodedKeyValueProvider());
          providers.add(new KeyInfoReferenceProvider());
  
          val keyInfoResolver = new BasicProviderKeyInfoCredentialResolver(providers);
          kekCredentialResolver.setKeyInfoCredentialResolver(keyInfoResolver);
  
          val roleDescriptorResolver = SamlIdPUtils.getRoleDescriptorResolver(adaptor, samlIdPProperties.getMetadata().isRequireValidMetadata());
  
          kekCredentialResolver.setRoleDescriptorResolver(roleDescriptorResolver);
          kekCredentialResolver.initialize();
  
          val criteriaSet = new CriteriaSet();
          criteriaSet.add(new EncryptionConfigurationCriterion(config));
          criteriaSet.add(new EntityIdCriterion(peerEntityId));
          criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
          criteriaSet.add(new UsageCriterion(UsageType.ENCRYPTION));
  
          LOGGER.debug("Attempting to resolve the encryption key for entity id [{}]", peerEntityId);
          return kekCredentialResolver.resolveSingle(criteriaSet);
      }