private static void handleEncryptionFailure(final SamlRegisteredService service,
                                                final SamlRegisteredServiceMetadataAdaptor adaptor) {
        val entityId = adaptor.getEntityId();
        if (!service.isEncryptionOptional()) {
            throw new SamlException("Unable to encrypt assertion for " + entityId);
        }
        LOGGER.debug("Skipping to encrypt; No encrypter can be determined and encryption is optional for [{}]", entityId);
    }
This is {@link SamlIdPObjectEncrypter}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/SamlIdPObjectEncrypter.java