ablog

不器用で落着きのない技術者のメモ

JREに同梱されている証明書を確認する

  • Javaのバージョンを確認
$ JAVA_HOME/bin/java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
  • 証明書をリスト表示する
$ keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts > cacerts_list.txt
Enter keystore password: changeit
  • Amazon の証明書を確認する
$ grep amazon cacerts_list.txt
amazonrootca4, Nov 16, 2018, trustedCertEntry,
amazonrootca3, Nov 16, 2018, trustedCertEntry,
amazonrootca2, Nov 16, 2018, trustedCertEntry,
amazonrootca1, Nov 16, 2018, trustedCertEntry,
  • cacerts の実体のある場所を確認する
$ ls -l $JAVA_HOME/jre/lib/security/cacerts
lrwxrwxrwx 1 root root 41 Feb 27 12:44 /usr/lib/jvm/java/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts
$ ls -l /etc/pki/java/cacerts
lrwxrwxrwx 1 root root 40 Nov 16  2018 /etc/pki/java/cacerts -> /etc/pki/ca-trust/extracted/java/cacerts
$ ls -l /etc/pki/ca-trust/extracted/java/cacerts
-r--r--r-- 1 root root 197507 Nov 16  2018 /etc/pki/ca-trust/extracted/java/cacerts
  • cacerts をバックアップ。
$ sudo cp -p cacerts cacerts.org
  • AWS SDK for Java v1.11 をダウンロードする。
$ wget https://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip
$ unzip aws-java-sdk.zip


$ git clone https://github.com/awsdocs/aws-doc-sdk-examples.git
$ cd aws-doc-sdk-examples/java/example_code/s3

$ javac -classpath .:/home/ec2-user/aws-java-sdk-1.11.568/lib/aws-java-sdk-1.11.568.jar ListBuckets.java