com.nimbusds.jose.jwk.loader.JWKSetMerge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nimbus-jwkset-loader Show documentation
Show all versions of nimbus-jwkset-loader Show documentation
JWK set loader with PKCS#11 support for Hardware Security Modules (HSM)
and smart cards.
package com.nimbusds.jose.jwk.loader;
import java.util.LinkedList;
import java.util.List;
import com.nimbusds.jose.jwk.JWK;
import com.nimbusds.jose.jwk.JWKSet;
/**
* JWK set merge routine.
*/
public class JWKSetMerge {
/**
* Merges the specified JWK sets by prefixing any PKCS#11 keys to the
* file-based JWK set.
*
* @param fileJWKSet The file-based JWK set. Must not be
* {@code null}.
* @param pkcs11JWKSet The PKCS#11 JWK set, {@code null} if none.
*
* @return The JWK set.
*/
public static JWKSet merge(final JWKSet fileJWKSet, final JWKSet pkcs11JWKSet) {
List keys = new LinkedList<>();
if (pkcs11JWKSet != null) {
// Prepend the HSM keys
keys.addAll(pkcs11JWKSet.getKeys());
}
keys.addAll(fileJWKSet.getKeys());
return new JWKSet(keys);
}
/**
* Prevents public instantiation.
*/
private JWKSetMerge() {}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy