} catch (STSException ex) {
// expected as no certificate is provided
}
// Now get a certificate and set it on the key requirements of the provider parameter
Crypto crypto = providerParameters.getStsProperties().getEncryptionCrypto();
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("myclientkey");
X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
ReceivedKey receivedKey = new ReceivedKey();
receivedKey.setX509Cert(certs[0]);
providerParameters.getKeyRequirements().setReceivedKey(receivedKey);
TokenProviderResponse providerResponse = samlTokenProvider.createToken(providerParameters);