use of org.opensaml.security.credential.UsageType in project verify-hub by alphagov.
the class HubIdentityProviderMetadataDtoToEntityDescriptorTransformerTest method assertCertificateIsPresent.
private void assertCertificateIsPresent(List<KeyDescriptor> keyDescriptors, Certificate encryptionCert) {
for (KeyDescriptor keyDescriptor : keyDescriptors) {
String keyEntityId = keyDescriptor.getKeyInfo().getKeyNames().get(0).getValue();
String x509Value = keyDescriptor.getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue();
UsageType keyUse = keyDescriptor.getUse();
if (keyEntityId.equals(encryptionCert.getIssuerId()) && x509Value.equals(encryptionCert.getCertificate()) && keyUse == UsageType.ENCRYPTION) {
return;
}
}
Assertions.fail("Certificate is not present.");
}
Aggregations