equal
deleted
inserted
replaced
29 import java.security.*; |
29 import java.security.*; |
30 import java.security.cert.Certificate; |
30 import java.security.cert.Certificate; |
31 import java.security.cert.CertificateFactory; |
31 import java.security.cert.CertificateFactory; |
32 import java.security.cert.CertificateException; |
32 import java.security.cert.CertificateException; |
33 import java.util.*; |
33 import java.util.*; |
|
34 |
|
35 import static java.nio.charset.StandardCharsets.UTF_8; |
34 |
36 |
35 import sun.security.pkcs.EncryptedPrivateKeyInfo; |
37 import sun.security.pkcs.EncryptedPrivateKeyInfo; |
36 import sun.security.pkcs12.PKCS12KeyStore; |
38 import sun.security.pkcs12.PKCS12KeyStore; |
37 import sun.security.util.Debug; |
39 import sun.security.util.Debug; |
38 import sun.security.util.IOUtils; |
40 import sun.security.util.IOUtils; |
803 /** |
805 /** |
804 * To guard against tampering with the keystore, we append a keyed |
806 * To guard against tampering with the keystore, we append a keyed |
805 * hash with a bit of whitener. |
807 * hash with a bit of whitener. |
806 */ |
808 */ |
807 private MessageDigest getPreKeyedHash(char[] password) |
809 private MessageDigest getPreKeyedHash(char[] password) |
808 throws NoSuchAlgorithmException, UnsupportedEncodingException |
810 throws NoSuchAlgorithmException |
809 { |
811 { |
810 |
812 |
811 MessageDigest md = MessageDigest.getInstance("SHA"); |
813 MessageDigest md = MessageDigest.getInstance("SHA"); |
812 byte[] passwdBytes = convertToBytes(password); |
814 byte[] passwdBytes = convertToBytes(password); |
813 md.update(passwdBytes); |
815 md.update(passwdBytes); |
814 Arrays.fill(passwdBytes, (byte) 0x00); |
816 Arrays.fill(passwdBytes, (byte) 0x00); |
815 md.update("Mighty Aphrodite".getBytes("UTF8")); |
817 md.update("Mighty Aphrodite".getBytes(UTF_8)); |
816 return md; |
818 return md; |
817 } |
819 } |
818 |
820 |
819 /** |
821 /** |
820 * Helper method to convert char[] to byte[] |
822 * Helper method to convert char[] to byte[] |