protected static void populateKeyInfoGeneratorManager(BasicSecurityConfiguration config) {
NamedKeyInfoGeneratorManager namedManager = new NamedKeyInfoGeneratorManager();
config.setKeyInfoGeneratorManager(namedManager);
namedManager.setUseDefaultManager(true);
KeyInfoGeneratorManager defaultManager = namedManager.getDefaultManager();
// Generator for basic Credentials
BasicKeyInfoGeneratorFactory basicFactory = new BasicKeyInfoGeneratorFactory();
basicFactory.setEmitPublicKeyValue(true);
// Generator for X509Credentials
X509KeyInfoGeneratorFactory x509Factory = new X509KeyInfoGeneratorFactory();
x509Factory.setEmitEntityCertificate(true);
defaultManager.registerFactory(basicFactory);
defaultManager.registerFactory(x509Factory);
}