mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-16 20:15:46 -06:00
Use PrivateKey directly when decrypting SAML
Closes #44289 Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
@@ -17,9 +17,6 @@
|
||||
|
||||
package org.keycloak.protocol.saml;
|
||||
|
||||
|
||||
|
||||
import java.security.Key;
|
||||
import java.security.PrivateKey;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -28,7 +25,6 @@ import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.keycloak.common.util.DerUtils;
|
||||
import org.keycloak.crypto.KeyUse;
|
||||
import org.keycloak.crypto.KeyWrapper;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
@@ -155,14 +151,7 @@ public class SAMLDecryptionKeysLocator implements XMLEncryptionUtil.DecryptionKe
|
||||
return keysStream
|
||||
.map(KeyWrapper::getPrivateKey)
|
||||
.filter(Objects::nonNull)
|
||||
.map(Key::getEncoded)
|
||||
.map(encoded -> {
|
||||
try {
|
||||
return DerUtils.decodePrivateKey(encoded);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not decode private key.", e);
|
||||
}
|
||||
})
|
||||
.map(PrivateKey.class::cast)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user