From a4cb075f427b7b3c5821b80009955c22f5c2e1dc Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 12 May 2021 09:55:17 +0200 Subject: [PATCH] fix for java 8 --- .../impl/CertificateSymetricKeyCryptor.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/CertificateSymetricKeyCryptor.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/CertificateSymetricKeyCryptor.java index 5fc443b8..74d89588 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/CertificateSymetricKeyCryptor.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/CertificateSymetricKeyCryptor.java @@ -16,7 +16,7 @@ import java.nio.ByteOrder; import java.security.NoSuchAlgorithmException; import java.security.cert.Certificate; import java.util.Base64; -import java.util.Iterator; +import java.util.Enumeration; import java.util.Objects; import java.util.Set; @@ -167,13 +167,11 @@ public class CertificateSymetricKeyCryptor extends AbstractCertificateCryptor im final Certificates certs = this.certificateService .getCertificates(institutionId) .getOrThrow(); - @SuppressWarnings("unchecked") - final Iterator asIterator = certs.keyStore - .engineAliases() - .asIterator(); - while (asIterator.hasNext()) { - final Certificate certificate = certs.keyStore.engineGetCertificate(asIterator.next()); + @SuppressWarnings("unchecked") + final Enumeration engineAliases = certs.keyStore.engineAliases(); + while (engineAliases.hasMoreElements()) { + final Certificate certificate = certs.keyStore.engineGetCertificate(engineAliases.nextElement()); final byte[] otherPublicKeyHash = generatePublicKeyHash(certificate); if (Objects.equals(otherPublicKeyHash, publicKeyHash)) { return certificate;