31 lines
728 B
Java
31 lines
728 B
Java
package com.iconplus.smartproc.configuration;
|
|
|
|
import com.iconplus.smartproc.util.RSAUtil;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import java.security.KeyPair;
|
|
import java.security.PrivateKey;
|
|
import java.security.PublicKey;
|
|
|
|
@Configuration
|
|
public class KeyConfiguration {
|
|
|
|
@Value("${jwt.private-key}")
|
|
private String privateKey;
|
|
|
|
@Value("${jwt.public-key}")
|
|
private String publicKey;
|
|
|
|
@Bean
|
|
public KeyPair keypairBean() {
|
|
|
|
PublicKey pubKey = RSAUtil.getPublicKey(publicKey);
|
|
PrivateKey privKey = RSAUtil.getPrivateKey(privateKey);
|
|
|
|
return new KeyPair(pubKey, privKey);
|
|
}
|
|
|
|
}
|