fix for java 8

This commit is contained in:
anhefti 2021-05-12 09:55:17 +02:00
parent a853c02947
commit a4cb075f42

View file

@ -16,7 +16,7 @@ import java.nio.ByteOrder;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate; import java.security.cert.Certificate;
import java.util.Base64; import java.util.Base64;
import java.util.Iterator; import java.util.Enumeration;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@ -167,13 +167,11 @@ public class CertificateSymetricKeyCryptor extends AbstractCertificateCryptor im
final Certificates certs = this.certificateService final Certificates certs = this.certificateService
.getCertificates(institutionId) .getCertificates(institutionId)
.getOrThrow(); .getOrThrow();
@SuppressWarnings("unchecked")
final Iterator<String> asIterator = certs.keyStore
.engineAliases()
.asIterator();
while (asIterator.hasNext()) { @SuppressWarnings("unchecked")
final Certificate certificate = certs.keyStore.engineGetCertificate(asIterator.next()); final Enumeration<String> engineAliases = certs.keyStore.engineAliases();
while (engineAliases.hasMoreElements()) {
final Certificate certificate = certs.keyStore.engineGetCertificate(engineAliases.nextElement());
final byte[] otherPublicKeyHash = generatePublicKeyHash(certificate); final byte[] otherPublicKeyHash = generatePublicKeyHash(certificate);
if (Objects.equals(otherPublicKeyHash, publicKeyHash)) { if (Objects.equals(otherPublicKeyHash, publicKeyHash)) {
return certificate; return certificate;