Symmetric Encryption 대칭 암호화 (Shared)
Asymmetric Encryption 비대칭 암호화 (RSA Keypair)
Java Cryptography Extension (JCE)
https://www.oracle.com/java/technologies/javase-jce-all-downloads.html
경로
{user.home}/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/jre/lib/security
요기에 2개의 jar를 붙혀넣는다.
키생성
keytool -genkeypair -alias apiEncryptionKey -keyalg RSA -dname "CN=LEE, OU=API Development, O=test.co.kr, L=Seoul, C=KR" -keypass "123456" -keystore apiEncrptionKey.jks -storepass "123456"
내용 확인
keytool -list -keystore apiEncrptionKey.jks -v
export
keytool -export -alias apiEncryptionKey -keystore apiEncrptionKey.jks -rfc -file trustServer.cer
임포트
keytool -import -alias trustServer -file trustServer.cer -keystore publicKey.jks
encrypt:
# key: abcdefghijklmnopqrstuvwxyz0123456789
key-store:
location: file://${user.home}/Desktop/springcloud/keystore/apiEncrptionKey.jks
password: 123456
alias: apiEncryptionKey
token:
expiration_time: 86400000
secret: '{cipher}AQCeFyPS7CrUJ54vZs+u4PQxlV2dQ8G/aFwRkxEG2IG7FlusrsBCrfCGWzD2HcuTy8jjreSLAlmc/oOtFf34ZCHkGt0xDamVopBPfJ7lWDwSxN9hq+5StlfoEhqrXHzFg+wXppYElYwvdoinPGKirog8pN6NQfCG8iKrJMtDqP7iPSdOaxwpLBF/IhJB3Yfu+KJCF8wW04OJ1Xx6t3habeFcnXu3MLmDfbnHXlLnaQY/zw7J1erDjClAeGqno2/EugiJ3Kb98KPzUC9nSXvw9O4buKFDFOeZ3sx+OH4jOdanjcu6Re88moLWPpbW/8d317WzjrhNFooYtxQDPQPmfvxbRof/2ILbXSOMh4dZGFTNcMZFYAK9qTLghFkaT5bW13X/DfBuQ78OPUaMacEZaJsF'
gateway:
ip: 192.168.0.4
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:testdb
username: sa
password: '{cipher}AQAWHi/uXKILvFO9VRjUEwRQV1ufT1w0gEbensU4Ry6gbOqzpofJgoxWybvc2yvD3ZTaoZTjnhElEmzctDAq9gRs3FqKYTbTduYxTJy11dQbGzHzlEM+Zjv1a8hzvywbId+7xnLvs0E/QYtT3mDMefOgGh1XIC1HYA+nV7T8bcPzIXOjQA493gVZNwT3meYrrsKTzLoalRCbNg+X803hPDfFFeBuQx82/bXiMHjIMJdPVSKxYmXKPyMGcoPDu3utWqRpprTqLRfI7uC0FM2H4CCcXKlMKq6/K+8jgm32rDKb9SzuNDmy5bwW+zVGQg18+N4lN2uACzIGxFLyJ1VD699rq537/yokQgT/o6L090qbwp6m57cD7UiJkWkgDm6emd8='
{cipher}를 명시해줘야 암호된 것이라고 인지함.