0
私はちょうどデータセキュリティを明確にしたい、私はSecreteKeyFactoryオブジェクトを使用して秘密鍵を生成しています。これは、データの暗号化/復号化に使用されます。アルゴリズムを隠す必要がありますか?
はここ
private SecretKey getKey(String user_id, String salt) throws NoSuchAlgorithmException,
InvalidKeySpecException, UnsupportedEncodingException {
SecretKey secretKey = null;
String PBE_SHA256_256BitAES_CBC_BC = "PBEWithSHA256And256BitAES-CBC-BC";
String AES_ENCRYPTION = "AES";
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(PBE_SHA256_256BitAES_CBC_BC);
KeySpec keySpec = new PBEKeySpec(user_id.toCharArray(), salt.getBytes(), Constants.ITERATION_COUNT, Constants.KEY_LENGTH);
secretKey = secretKeyFactory.generateSecret(keySpec);
secretKey = new SecretKeySpec(secretKey.getEncoded(), AES_ENCRYPTION);
return secretKey;
}
私の質問は以下のようになり、私のコードです。秘密鍵の取得に使用するアルゴリズムを隠す必要がありますか?そうでなければ、我々はセキュリティを高めることができるようにアルゴリズムをどこに格納すべきですか?
ああ、あなたの答えに感謝します:)。 – shinta
@shintaこの概念は[Kirchoffs 'Principle](https://en.wikipedia.org/wiki/Kerckhoffs's_principle)として知られています。 – TheGreatContini