Home
last modified time | relevance | path

Searched refs:salt (Results 1 – 25 of 32) sorted by relevance

12

/frameworks/base/services/backup/java/com/android/server/backup/
DBackupPasswordManager.java134 byte[] salt = randomSalt(); in setBackupPassword()
136 PBKDF_CURRENT, newPassword, salt, PasswordUtils.PBKDF2_HASH_ROUNDS); in setBackupPassword()
138 getPasswordHashFileCodec().serialize(new BackupPasswordHash(newPwHash, salt)); in setBackupPassword()
140 mPasswordSalt = salt; in setBackupPassword()
189 mPasswordSalt = hash.salt; in loadStateFromFilesystem()
253 public byte[] salt; field in BackupPasswordManager.BackupPasswordHash
255 BackupPasswordHash(String hash, byte[] salt) { in BackupPasswordHash() argument
257 this.salt = salt; in BackupPasswordHash()
292 dataOutputStream.writeInt(backupPasswordHash.salt.length); in serialize()
293 dataOutputStream.write(backupPasswordHash.salt); in serialize()
[all …]
/frameworks/base/core/java/android/security/keystore/recovery/
DKeyDerivationParams.java81 public static @NonNull KeyDerivationParams createSha256Params(@NonNull byte[] salt) { in createSha256Params() argument
82 return new KeyDerivationParams(ALGORITHM_SHA256, salt); in createSha256Params()
95 @NonNull byte[] salt, int memoryDifficulty) { in createScryptParams()
96 return new KeyDerivationParams(ALGORITHM_SCRYPT, salt, memoryDifficulty); in createScryptParams()
102 private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { in KeyDerivationParams() argument
103 this(algorithm, salt, /*memoryDifficulty=*/ -1); in KeyDerivationParams()
109 private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt, in KeyDerivationParams() argument
112 mSalt = Preconditions.checkNotNull(salt); in KeyDerivationParams()
/frameworks/base/libs/androidfw/tests/
DObbFile_test.cpp68 unsigned char salt[SALT_SIZE] = {0x01, 0x10, 0x55, 0xAA, 0xFF, 0x00, 0x5A, 0xA5}; in TEST_F() local
69 EXPECT_TRUE(mObbFile->setSalt(salt, SALT_SIZE)) in TEST_F()
89 EXPECT_EQ(sizeof(salt), saltLen) in TEST_F()
92 for (size_t i = 0; i < sizeof(salt); i++) { in TEST_F()
93 EXPECT_EQ(salt[i], newSalt[i]) in TEST_F()
96 EXPECT_TRUE(memcmp(newSalt, salt, sizeof(salt)) == 0) in TEST_F()
/frameworks/base/services/backup/java/com/android/server/backup/utils/
DPasswordUtils.java51 public static SecretKey buildPasswordKey(String algorithm, String pw, byte[] salt, int rounds) { in buildPasswordKey() argument
52 return buildCharArrayKey(algorithm, pw.toCharArray(), salt, rounds); in buildPasswordKey()
65 public static String buildPasswordHash(String algorithm, String pw, byte[] salt, int rounds) { in buildPasswordHash() argument
66 SecretKey key = buildPasswordKey(algorithm, pw, salt, rounds); in buildPasswordHash()
111 public static byte[] makeKeyChecksum(String algorithm, byte[] pwBytes, byte[] salt, in makeKeyChecksum() argument
118 Key checksum = buildCharArrayKey(algorithm, mkAsChar, salt, rounds); in makeKeyChecksum()
122 private static SecretKey buildCharArrayKey(String algorithm, char[] pwArray, byte[] salt, in buildCharArrayKey() argument
126 KeySpec ks = new PBEKeySpec(pwArray, salt, rounds, PBKDF2_KEY_SIZE); in buildCharArrayKey()
/frameworks/base/core/jni/
Dandroid_security_Scrypt.cpp34 …Scrypt_nativeScrypt(JNIEnv* env, jobject, jbyteArray password, jbyteArray salt, jint N, jint r, ji… in android_security_Scrypt_nativeScrypt() argument
35 if (!password || !salt) { in android_security_Scrypt_nativeScrypt()
40 int saltLen = env->GetArrayLength(salt); in android_security_Scrypt_nativeScrypt()
44 jbyte* saltPtr = (jbyte*)env->GetByteArrayElements(salt, NULL); in android_security_Scrypt_nativeScrypt()
51 env->ReleaseByteArrayElements(salt, saltPtr, JNI_ABORT); in android_security_Scrypt_nativeScrypt()
Dandroid_content_res_ObbScanner.cpp38 jfieldID salt; member
68 const unsigned char* salt = obb->getSalt(&saltLen); in android_content_res_ObbScanner_getObbInfo() local
71 env->SetByteArrayRegion(saltArray, 0, saltLen, (jbyte*)salt); in android_content_res_ObbScanner_getObbInfo()
72 env->SetObjectField(obbInfo, gObbInfoClassInfo.salt, saltArray); in android_content_res_ObbScanner_getObbInfo()
93 gObbInfoClassInfo.salt = GetFieldIDOrDie(env, clazz, "salt", "[B"); in register_android_content_res_ObbScanner()
/frameworks/base/tools/obbtool/
DMain.cpp57 memset(&salt, 0, sizeof(salt)); in PackageInfo()
64 unsigned char salt[SALT_LEN]; member in PackageInfo
103 obb->setSalt(info->salt, SALT_LEN); in doAdd()
145 const unsigned char* salt = obb->getSalt(&saltLen); in doInfo() local
146 if (salt != NULL) { in doInfo()
148 printf("%02x", salt[i]); in doInfo()
234 package_info.salt[i] = b; in main()
Dpbkdf2gen.cpp51 unsigned char salt[SALT_LEN]; in main() local
53 if (read(fd, &salt, SALT_LEN) != SALT_LEN) { in main()
62 if (PKCS5_PBKDF2_HMAC_SHA1(argv[1], strlen(argv[1]), salt, SALT_LEN, in main()
70 printf("%02x", salt[i]); in main()
Dmkobb.sh263 echo "${salt}"
/frameworks/base/services/core/jni/
Dcom_android_server_locksettings_SyntheticPasswordManager.cpp51 …anager_nativeScrypt(JNIEnv* env, jobject, jbyteArray password, jbyteArray salt, jint N, jint r, ji… in android_server_SyntheticPasswordManager_nativeScrypt() argument
52 if (!password || !salt) { in android_server_SyntheticPasswordManager_nativeScrypt()
57 int saltLen = env->GetArrayLength(salt); in android_server_SyntheticPasswordManager_nativeScrypt()
61 jbyte* saltPtr = (jbyte*)env->GetByteArrayElements(salt, NULL); in android_server_SyntheticPasswordManager_nativeScrypt()
68 env->ReleaseByteArrayElements(salt, saltPtr, JNI_ABORT); in android_server_SyntheticPasswordManager_nativeScrypt()
/frameworks/base/services/tests/servicestests/src/com/android/server/locksettings/recoverablekeystore/
DMockScrypt.java31 public byte[] scrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen) { in scrypt() argument
35 password.length + salt.length + Integer.BYTES * 6); in scrypt()
39 byteBuffer.putInt(salt.length); in scrypt()
40 byteBuffer.put(salt); in scrypt()
DKeySyncTaskTest.java178 byte[] salt = randomBytes(16); in hashCredentialsBySaltedSha256_returnsSameHashForSameCredentialsAndSalt()
181 KeySyncTask.hashCredentialsBySaltedSha256(salt, credentials), in hashCredentialsBySaltedSha256_returnsSameHashForSameCredentialsAndSalt()
182 KeySyncTask.hashCredentialsBySaltedSha256(salt, credentials)); in hashCredentialsBySaltedSha256_returnsSameHashForSameCredentialsAndSalt()
187 byte[] salt = randomBytes(16); in hashCredentialsBySaltedSha256_returnsDifferentHashForDifferentCredentials()
191 KeySyncTask.hashCredentialsBySaltedSha256(salt, "password1234"), in hashCredentialsBySaltedSha256_returnsDifferentHashForDifferentCredentials()
192 KeySyncTask.hashCredentialsBySaltedSha256(salt, "password12345"))); in hashCredentialsBySaltedSha256_returnsDifferentHashForDifferentCredentials()
/frameworks/base/core/java/android/security/
DScrypt.java26 native byte[] nativeScrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen); in nativeScrypt() argument
29 public byte[] scrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen) { in scrypt() argument
30 return nativeScrypt(password, salt, n, r, p, outLen); in scrypt()
/frameworks/base/services/core/java/com/android/server/locksettings/recoverablekeystore/
DKeySyncTask.java253 byte[] salt = generateSalt(); in syncKeysForAgent()
256 localLskfHash = hashCredentialsByScrypt(salt, mCredential); in syncKeysForAgent()
258 localLskfHash = hashCredentialsBySaltedSha256(salt, mCredential); in syncKeysForAgent()
338 salt, /*memoryDifficulty=*/ SCRYPT_PARAM_N); in syncKeysForAgent()
340 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in syncKeysForAgent()
464 byte[] salt = new byte[SALT_LENGTH_BYTES]; in generateSalt()
465 new SecureRandom().nextBytes(salt); in generateSalt()
466 return salt; in generateSalt()
492 static byte[] hashCredentialsBySaltedSha256(byte[] salt, String credentials) { in hashCredentialsBySaltedSha256() argument
495 salt.length + credentialsBytes.length + LENGTH_PREFIX_BYTES * 2); in hashCredentialsBySaltedSha256()
[all …]
DSecureBox.java301 private static SecretKey hkdfDeriveKey(byte[] secret, byte[] salt, byte[] info) in hkdfDeriveKey() argument
305 mac.init(new SecretKeySpec(salt, MAC_ALG)); in hkdfDeriveKey()
/frameworks/base/core/java/android/util/apk/
DApkVerityBuilder.java183 private BufferedDigester(byte[] salt, ByteBuffer output) throws NoSuchAlgorithmException { in BufferedDigester() argument
184 mSalt = salt; in BufferedDigester()
256 SignatureInfo signatureInfo, byte[] salt, ByteBuffer output) in generateApkVerityDigestAtLeafLevel() argument
258 BufferedDigester digester = new BufferedDigester(salt, output); in generateApkVerityDigestAtLeafLevel()
301 byte[] salt, int[] levelOffset, ByteBuffer output) in generateApkVerityTree() argument
304 generateApkVerityDigestAtLeafLevel(apk, signatureInfo, salt, slice(output, in generateApkVerityTree()
313 BufferedDigester digester = new BufferedDigester(salt, outputBuffer); in generateApkVerityTree()
321 BufferedDigester digester = new BufferedDigester(salt, ByteBuffer.wrap(rootHash)); in generateApkVerityTree()
328 byte[] salt) { in generateFsverityHeader() argument
329 if (salt.length != 8) { in generateFsverityHeader()
[all …]
/frameworks/base/services/tests/servicestests/src/com/android/server/backup/
DBackupPasswordManagerTest.java193 private void writeV1HashToFile(String password, byte[] salt) throws Exception { in writeV1HashToFile() argument
195 V1_HASH_ALGORITHM, password, salt, PasswordUtils.PBKDF2_HASH_ROUNDS); in writeV1HashToFile()
196 writeHashAndSaltToFile(hash, salt); in writeV1HashToFile()
199 private void writeHashAndSaltToFile(String hash, byte[] salt) throws Exception { in writeHashAndSaltToFile() argument
207 dos.writeInt(salt.length); in writeHashAndSaltToFile()
208 dos.write(salt); in writeHashAndSaltToFile()
/frameworks/base/core/java/android/content/res/
DObbInfo.java56 public byte[] salt; field in ObbInfo
85 dest.writeByteArray(salt); in writeToParcel()
104 salt = source.createByteArray(); in ObbInfo()
/frameworks/base/libs/androidfw/include/androidfw/
DObbFile.h84 bool setSalt(const unsigned char* salt, size_t length) { in setSalt() argument
89 memcpy(mSalt, salt, sizeof(mSalt)); in setSalt()
/frameworks/base/services/core/java/com/android/server/locksettings/recoverablekeystore/serialization/
DKeyChainSnapshotDeserializer.java275 byte[] salt = null; in readKeyDerivationParams()
294 salt = readBlobTag(parser, TAG_SALT); in readKeyDerivationParams()
306 if (salt == null) { in readKeyDerivationParams()
314 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in readKeyDerivationParams()
319 salt, memoryDifficulty); in readKeyDerivationParams()
/frameworks/base/services/tests/servicestests/src/com/android/server/locksettings/
DMockSyntheticPasswordManager.java96 protected byte[] scrypt(String password, byte[] salt, int N, int r, int p, int outLen) { in scrypt() argument
98 PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 10, outLen * 8); in scrypt()
DSyntheticPasswordTests.java490 data.salt = PAYLOAD; in testPasswordData_serializeDeserialize()
499 assertArrayEquals(PAYLOAD, deserialized.salt); in testPasswordData_serializeDeserialize()
522 assertArrayEquals(PAYLOAD, deserialized.salt); in testPasswordData_deserialize()
/frameworks/base/services/core/java/com/android/server/locksettings/
DSyntheticPasswordManager.java208 byte[] salt; field in SyntheticPasswordManager.PasswordData
219 result.salt = secureRandom(PASSWORD_SALT_LENGTH); in create()
233 result.salt = new byte[saltLen]; in fromBytes()
234 buffer.get(result.salt); in fromBytes()
248 + Integer.BYTES + salt.length + Integer.BYTES + in toBytes()
254 buffer.putInt(salt.length); in toBytes()
255 buffer.put(salt); in toBytes()
1131 return scrypt(password, data.salt, 1 << data.scryptN, 1 << data.scryptR, 1 << data.scryptP, in computePasswordToken()
1151 protected byte[] scrypt(String password, byte[] salt, int N, int r, int p, int outLen) { in scrypt() argument
1152 return nativeScrypt(password.getBytes(), salt, N, r, p, outLen); in scrypt()
[all …]
/frameworks/base/core/java/com/android/internal/widget/
DLockPatternUtils.java1126 long salt = getLong(LOCK_PASSWORD_SALT_KEY, 0, userId); in getSalt() local
1127 if (salt == 0) { in getSalt()
1129 salt = SecureRandom.getInstance("SHA1PRNG").nextLong(); in getSalt()
1130 setLong(LOCK_PASSWORD_SALT_KEY, salt, userId); in getSalt()
1137 return Long.toHexString(salt); in getSalt()
/frameworks/base/services/core/java/com/android/server/
DStorageManagerService.java3301 KeySpec ks = new PBEKeySpec(mKey.toCharArray(), obbInfo.salt, in handleExecute()

12