protected AbstractCredential getResolvedSigningCredential(final Credential credential,
                                                              final PrivateKey privateKey,
                                                              final SamlRegisteredService service) {
        try {
            val samlIdp = casProperties.getAuthn().getSamlIdp();
            val credType = SamlIdPResponseProperties.SignatureCredentialTypes.valueOf(
                StringUtils.defaultIfBlank(service.getSigningCredentialType(),
                    samlIdp.getResponse().getCredentialType().name()).toUpperCase(Locale.ENGLISH));
            LOGGER.trace("Requested credential type [{}] is found for service [{}]", credType, service.getName());

            switch (credType) {
                case BASIC -> {
                    LOGGER.debug("Building credential signing key [{}] based on requested credential type", credType);
                    if (credential.getPublicKey() == null) {
                        throw new IllegalArgumentException("Unable to identify the public key from the signing credential");
                    }
                    return finalizeSigningCredential(new BasicCredential(credential.getPublicKey(), privateKey), credential);
                }
                case X509 -> {
                    if (credential instanceof final BasicX509Credential value) {
                        val certificate = value.getEntityCertificate();
                        LOGGER.debug("Locating signature signing certificate from credential [{}]", CertUtils.toString(certificate));
                        return finalizeSigningCredential(new BasicX509Credential(certificate, privateKey), credential);
                    }
                    val signingCert = samlIdPMetadataLocator.resolveSigningCertificate(Optional.of(service));
                    LOGGER.debug("Locating signature signing certificate file from [{}]", signingCert);
                    val certificate = SamlUtils.readCertificate(signingCert);
                    return finalizeSigningCredential(new BasicX509Credential(certificate, privateKey), credential);
                }
            }
        } catch (final Throwable e) {
            LoggingUtils.error(LOGGER, e);
        }
        return null;
    }
Gets signing private key.

@param registeredService the registered service
@return the signing private key
@throws Throwable the throwable
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/DefaultSamlIdPObjectSigner.java