FIPS に準拠するよう C/C++test を設定できます。
このセクションの内容
前提条件
https://www.bouncycastle.org/download/bouncy-castle-java-fips/ から以下の BouncyCastle FIPS ライブラリをダウンロードする必要があります。
- bc-fips-<VERSION>.jar (バージョン 2.1.1 でテスト済み)
- bctls-fips-<VERSION>.jar (バージョン 2.1.20 でテスト済み)
- bcutil-fips-<VERSION>.jar (バージョン 2.1.4 でテスト済み)
C/C++test での FIPS モードの設定
bc-fips-<VERSION>.jar、bctls-fips-<VERSION>.jar および bcutil-fips-<VERSION>.jar を
<CPPTEST_INSTALL_DIR>/libディレクトリにコピーします。<CPPTEST_INSTALL_DIR>/etcディレクトリにある cpptestcli.jvm ファイルを開き、FIPS の classpath エントリのコメントを解除します。#Uncomment to enable FIPS libraries. See the documentation for details. java.classpath=$INSTALL_DIR/lib;.fips.\.jar
keytoolを使用して、cacerts ファイルを FIPS 準拠 BCFKS フォーマットに変換します。- コンソールを開いて次のコマンドを実行します。
cd <CPPTEST_INSTALL_DIR> mv bin/jre/lib/security/cacerts bin/jre/lib/security/cacerts.pkcs12 ./bin/jre/bin/keytool -importkeystore -srckeystore bin/jre/lib/security/cacerts.pkcs12 -srcstoretype PKCS12 -destkeystore bin/jre/lib/security/cacerts -deststoretype BCFKS -providername BCFIPS -providerclass org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider -providerpath bin/jars/bc-fips-<VERSION>.jar -srcstorepass changeit -deststorepass changeit
- コンソールを開いて次のコマンドを実行します。
- 変更を保存します。
<CPPTEST_INSTALL_DIR>/bin/jre/conf/security/ディレクトリにある java.security ファイルを開いて以下の変更を行います。security.provider.<number>という名前の既存のプロパティをすべてコメント アウトし、以下の行を挿入することでセキュリティ プロバイダーのリストを設定します。security.provider.1=org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider fips:BCFIPS security.provider.3=SUN
javax.net.ssl package のキー マネージャー ファクトリおよびトラスト マネージャー ファクトリのアルゴリズムを PKIX に変更します。
ssl.KeyManagerFactory.algorithm=PKIX ssl.TrustManagerFactory.algorithm=PKIX
デフォルトのキーストア タイプを fips に変更し、JKS および PKCS12 キーストア タイプの互換モードを無効にします。
keystore.type=fips keystore.type.compat=false
(Linux の場合のみ) 既知の強力な SecureRandom 実装のリストに NativePRNGNonBlocking アルゴリズムを追加します。
securerandom.strongAlgorithms=NativePRNGNonBlocking:SUN,NativePRNGBlocking:SUN,DRBG:SUN
FIPS 認証済みのアルゴリズムだけを許可します。
org.bouncycastle.fips.approved_only=true
- 変更を保存します。
<CPPTEST_INSTALL_DIR>/bin/jre/conf/security/ディレクトリにある java.policy ファイルを開き、デフォルト ドメインに次のパーミッションを挿入します。permission java.lang.RuntimePermission "accessClassInPackage.sun.security.internal.spec"; permission org.bouncycastle.crypto.CryptoServicesPermission "tlsAlgorithmsEnabled";
- 変更を保存します。
<CPPTEST_INSTALL_DIR>/bin/jre/conf/ディレクトリにある logging.properties ファイルを開き、Bouncy Castle のロガー設定を挿入します。org.bouncycastle.jsse.provider.DisabledAlgorithmConstraints.level=SEVERE org.bouncycastle.jsse.provider.PropertyUtils.level=SEVERE org.bouncycastle.jsse.provider.ProvTlsClient.level=SEVERE
変更を保存します。