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

com.thebund1st.daming.jwt.key.JwtPublicKeyLoader Maven / Gradle / Ivy

There is a newer version: 0.9.6
Show newest version
package com.thebund1st.daming.jwt.key;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;

import java.security.Key;
import java.security.KeyFactory;
import java.security.spec.X509EncodedKeySpec;

@RequiredArgsConstructor
public class JwtPublicKeyLoader implements JwtKeyLoader {

    private final KeyBytesLoader keyBytesLoader;

    @SneakyThrows
    @Override
    public Key getKey() {
        byte[] keyBytes = keyBytesLoader.getBytes();
        X509EncodedKeySpec spec =
                new X509EncodedKeySpec(keyBytes);
        KeyFactory kf = KeyFactory.getInstance("RSA");
        return kf.generatePublic(spec);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy