All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.adorsys.psd2.pop.JwkExport Maven / Gradle / Ivy

There is a newer version: 2.2.3
Show newest version
package org.adorsys.psd2.pop;

import java.security.KeyStore;
import java.security.KeyStoreException;

import com.nimbusds.jose.jwk.JWKSet;
import com.nimbusds.jose.jwk.PasswordLookup;

public class JwkExport {
	
	public static JWKSet exportPrivateKeys(KeyStore keyStore, char[] keypass){
		PasswordLookup pwLookup = new PasswordLookup() {
			@Override
			public char[] lookupPassword(String name) {
				return keypass;
			}
		};
		try {
			return JWKSet.load(keyStore, pwLookup);
		} catch (KeyStoreException e) {
			throw new IllegalStateException(e);
		}
	}

	public static JWKSet exportPublicKeys(KeyStore keyStore, char[] keypass){
		JWKSet exportKeys = exportPrivateKeys(keyStore, keypass);
		return exportKeys.toPublicJWKSet();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy