---
# System prepended metadata

title: 憑證
tags: [JAVA]

---

憑證下載(單一憑證)
openssl s_client -connect uatapi.ice.com.tw:443 -servername uatapi.ice.com.tw -showcerts < /dev/null | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' > /d/ca/uatapi.ice.com.tw.crt
openssl s_client -connect cuf-uat.everprobks.com:443 -servername cuf-uat.everprobks.com -showcerts < /dev/null | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p' > /d/Users/CE050/Desktop/2025_SSO各家憑證/cuf-uat.everprobks.com.crt


https://cuf-uat.everprobks.com:9202/baztokenserviceTLG.asmx/CheckToken 永達

解析憑證內容
openssl x509 -in /d/ca/g-insurance.crt -noout -text
openssl x509 -in /d/Users/CE050/Desktop/2025_SSO各家憑證/uatapi.ice.com.tww.crt -text -noout -nameopt RFC2253

把憑證加入到信任庫
keytool -import -alias www.t-hh.com.tw -file "/d/Users/CE050/Desktop/2025_SSO各家憑證/華瀚/www.t-hh.com.tw.crt" -keystore "/d/Users/CE050/Desktop/2025_SSO各家憑證/b2b-cacerts.jks"
keytool -importcert -alias feishou -file feishou-20250731.crt -keystore cacerts.jks


查看jks內容
(特定要某一間)
keytool -list -alias feishou -keystore cacerts.jks

keytool -list -v -keystore "D:\Users\CE050\Desktop\2025_SSO各家憑證\cacerts.jks"
keytool -list -v -keystore cacerts.jks > cacerts.log -storepass changeit

將憑證加到uat
D:\ca>keytool -import -alias goldennet.com.tw.20250429.crt -file "D:\ca\_.goldennet.com.tw.crt" -keystore "D:\ca\cacerts.jks" -storepass changeit
完成後須重啟

匯出憑證
(特定要某一間)
keytool -exportcert -alias feishou-202507312025-07-31-07-42-02 -keystore cacerts.jks -file feishou.crt  

刪除憑證
(特定要某一間)
keytool -delete -alias everprobks -keystore b2b-cacerts.jks -storepass changeit

合併憑證庫
keytool -importkeystore -srckeystore jdk8-cacerts.jks -destkeystore cacerts.jks -srcstorepass changeit -deststorepass changeit -noprompt

# 步驟1：先將 jdk8-cacerts.jks 複製到 cacerts.jks
keytool -importkeystore -srckeystore jdk8-cacerts.jks -destkeystore cacerts.jks -srcstorepass changeit -deststorepass changeit -noprompt

# 步驟2：再將 b2b-cacerts.jks 合併到 cacerts.jks
keytool -importkeystore -srckeystore b2b-cacerts.jks -destkeystore cacerts.jks -srcstorepass changeit -deststorepass changeit -noprompt

