question: public static void updateProviderKeyInfo ( String realm , String entityID , Set < String > certAliases , boolean isSigning , boolean isIDP , String encAlgo , int keySize ) throws SAML2MetaException { SAML2MetaManager metaManager = new SAML2MetaManager ( ) ; EntityConfigElement config = metaManager . getEntityConfig ( realm , entityID ) ; if ( ! config . isHosted ( ) ) { String [ ] args = { entityID , realm } ; throw new SAML2MetaException ( "entityNotHosted" , args ) ; } EntityDescriptorElement desp = metaManager . getEntityDescriptor ( realm , entityID ) ; BaseConfigType baseConfig ; RoleDescriptorType descriptor ; if ( isIDP ) { baseConfig = SAML2MetaUtils . getIDPSSOConfig ( config ) ; descriptor = SAML2MetaUtils . getIDPSSODescriptor ( desp ) ; if ( baseConfig == null || descriptor == null ) { String [ ] args = { entityID , realm } ; throw new SAML2MetaException ( "entityNotIDP" , args ) ; } } else { baseConfig = SAML2MetaUtils . getSPSSOConfig ( config ) ; descriptor = SAML2MetaUtils . getSPSSODescriptor ( desp ) ; if ( baseConfig == null || descriptor == null ) { String [ ] args = { entityID , realm } ; throw new SAML2MetaException ( "entityNotSP" , args ) ; } } if ( CollectionUtils . isEmpty ( certAliases ) ) { removeKeyDescriptor ( descriptor , isSigning ) ; if ( isSigning ) { setExtendedAttributeValue ( baseConfig , SAML2Constants . SIGNING_CERT_ALIAS , null ) ; } else { setExtendedAttributeValue ( baseConfig , SAML2Constants . ENCRYPTION_CERT_ALIAS , null ) ; } } else { Set < KeyDescriptorType > keyDescriptors = new LinkedHashSet < > ( certAliases . size ( ) ) ; for ( String certAlias : certAliases ) { keyDescriptors . add ( getKeyDescriptor ( certAlias , isSigning , encAlgo , keySize ) ) ; } updateKeyDescriptor ( descriptor , keyDescriptors ) ; if ( isSigning ) { setExtendedAttributeValue ( baseConfig , SAML2Constants . SIGNING_CERT_ALIAS , certAliases ) ; } else { setExtendedAttributeValue ( baseConfig , SAML2Constants . ENCRYPTION_CERT_ALIAS , certAliases ) ; } } metaManager . setEntityDescriptor ( realm , desp ) ; metaManager . setEntityConfig ( realm , config ) ; }
target:  Updates signing or encryption key info for SP or IDP.  This will update both signing/encryption alias on extended metadata and certificates in standard metadata. 