Home
last modified time | relevance | path

Searched refs:salt (Results 1 – 25 of 34) 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/services/backup/java/com/android/server/backup/encryption/chunking/cdc/
DHkdf.java51 static byte[] hkdf(byte[] masterKey, byte[] salt, byte[] data) throws InvalidKeyException { in hkdf() argument
53 checkNotNull(salt, "HKDF requires a salt."); in hkdf()
55 return hkdfSha256Expand(hkdfSha256Extract(masterKey, salt), data); in hkdf()
71 private static byte[] hkdfSha256Extract(byte[] inputKeyMaterial, byte[] salt) in hkdfSha256Extract() argument
82 sha256.init(new SecretKeySpec(salt, AES)); in hkdfSha256Extract()
DFingerprintMixer.java59 public FingerprintMixer(SecretKey secretKey, byte[] salt) throws InvalidKeyException { in FingerprintMixer() argument
60 checkArgument(salt.length == SALT_LENGTH_BYTES, "Requires a 256-bit salt."); in FingerprintMixer()
66 Hkdf.hkdf(keyBytes, salt, DERIVED_KEY_NAME.getBytes(StandardCharsets.UTF_8)); in FingerprintMixer()
/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()
/frameworks/base/services/robotests/backup/src/com/android/server/backup/encryption/chunking/cdc/
DFingerprintMixerTest.java92 byte[] salt = randomSalt(); in getAddend_withDifferentKey_returnsDifferentResult()
95 FingerprintMixer fingerprintMixer = new FingerprintMixer(randomKey(), salt); in getAddend_withDifferentKey_returnsDifferentResult()
111 byte[] salt = randomSalt(); in getMultiplicand_withDifferentKey_returnsDifferentResult()
114 FingerprintMixer fingerprintMixer = new FingerprintMixer(randomKey(), salt); in getMultiplicand_withDifferentKey_returnsDifferentResult()
172 byte[] salt = new byte[SALT_LENGTH_BYTES]; in randomSalt()
173 mSeededRandom.nextBytes(salt); in randomSalt()
174 return salt; in randomSalt()
DContentDefinedChunkerTest.java65 byte[] salt = new byte[FingerprintMixer.SALT_LENGTH_BYTES]; in setUp()
67 random.nextBytes(salt); in setUp()
68 mFingerprintMixer = new FingerprintMixer(secretKey, salt); in setUp()
/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()
/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.java255 byte[] salt = generateSalt(); in syncKeysForAgent()
258 localLskfHash = hashCredentialsByScrypt(salt, mCredential); in syncKeysForAgent()
260 localLskfHash = hashCredentialsBySaltedSha256(salt, mCredential); in syncKeysForAgent()
342 salt, /*memoryDifficulty=*/ SCRYPT_PARAM_N); in syncKeysForAgent()
344 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in syncKeysForAgent()
469 byte[] salt = new byte[SALT_LENGTH_BYTES]; in generateSalt()
470 new SecureRandom().nextBytes(salt); in generateSalt()
471 return salt; in generateSalt()
497 static byte[] hashCredentialsBySaltedSha256(byte[] salt, byte[] credentialsBytes) { in hashCredentialsBySaltedSha256() argument
499 salt.length + credentialsBytes.length + LENGTH_PREFIX_BYTES * 2); in hashCredentialsBySaltedSha256()
[all …]
/frameworks/base/core/java/android/util/apk/
DVerityBuilder.java124 byte[] salt = skipSigningBlock ? DEFAULT_SALT : null; in generateVerityTreeInternal()
125 byte[] apkRootHash = generateVerityTreeInternal(apk, signatureInfo, salt, levelOffset, in generateVerityTreeInternal()
209 private BufferedDigester(@Nullable byte[] salt, @NonNull ByteBuffer output) in BufferedDigester() argument
211 mSalt = salt; in BufferedDigester()
307 SignatureInfo signatureInfo, byte[] salt, ByteBuffer output) in generateApkVerityDigestAtLeafLevel() argument
309 BufferedDigester digester = new BufferedDigester(salt, output); in generateApkVerityDigestAtLeafLevel()
353 @Nullable SignatureInfo signatureInfo, @Nullable byte[] salt, in generateVerityTreeInternal() argument
359 generateApkVerityDigestAtLeafLevel(apk, signatureInfo, salt, slice(output, in generateVerityTreeInternal()
372 BufferedDigester digester = new BufferedDigester(salt, outputBuffer); in generateVerityTreeInternal()
380 BufferedDigester digester = new BufferedDigester(salt, ByteBuffer.wrap(rootHash)); in generateVerityTreeInternal()
[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.java58 public byte[] salt; field in ObbInfo
88 dest.writeByteArray(salt); in writeToParcel()
107 salt = source.createByteArray(); in ObbInfo()
/frameworks/base/libs/storage/
DObbInfo.cpp26 int32_t flags, size_t saltSize, const uint8_t* salt) : mFileName(fileName), in ObbInfo() argument
28 mSalt(salt) {} 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.java278 byte[] salt = null; in readKeyDerivationParams()
297 salt = readBlobTag(parser, TAG_SALT); in readKeyDerivationParams()
309 if (salt == null) { in readKeyDerivationParams()
317 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in readKeyDerivationParams()
322 salt, memoryDifficulty); in readKeyDerivationParams()
/frameworks/base/services/tests/servicestests/src/com/android/server/locksettings/
DMockSyntheticPasswordManager.java98 protected byte[] scrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen) { in scrypt() argument
104 PBEKeySpec spec = new PBEKeySpec(passwordChars, salt, 10, outLen * 8); in scrypt()
/frameworks/base/core/java/com/android/internal/widget/
DLockPatternUtils.java1291 long salt = getLong(LOCK_PASSWORD_SALT_KEY, 0, userId); in getSalt() local
1292 if (salt == 0) { in getSalt()
1294 salt = SecureRandom.getInstance("SHA1PRNG").nextLong(); in getSalt()
1295 setLong(LOCK_PASSWORD_SALT_KEY, salt, userId); in getSalt()
1302 return Long.toHexString(salt); in getSalt()
1323 byte[] salt = getSalt(userId).getBytes(); in legacyPasswordToHash()
1324 byte[] saltedPassword = Arrays.copyOf(password, password.length + salt.length); in legacyPasswordToHash()
1325 System.arraycopy(salt, 0, saltedPassword, password.length, salt.length); in legacyPasswordToHash()
1351 byte[] salt = getSalt(userId).getBytes(); in passwordToHistoryHash()
1353 + salt.length); in passwordToHistoryHash()
[all …]
/frameworks/base/libs/storage/include/storage/
DObbInfo.h31 int32_t flags, size_t saltSize, const uint8_t* salt);
/frameworks/base/services/core/java/com/android/server/locksettings/
DSyntheticPasswordManager.java224 byte[] salt; field in SyntheticPasswordManager.PasswordData
235 result.salt = secureRandom(PASSWORD_SALT_LENGTH); in create()
249 result.salt = new byte[saltLen]; in fromBytes()
250 buffer.get(result.salt); in fromBytes()
264 + Integer.BYTES + salt.length + Integer.BYTES + in toBytes()
270 buffer.putInt(salt.length); in toBytes()
271 buffer.put(salt); in toBytes()
1175 return scrypt(password, data.salt, 1 << data.scryptN, 1 << data.scryptR, 1 << data.scryptP, in computePasswordToken()
1195 protected byte[] scrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen) { in scrypt() argument
1196 return new Scrypt().scrypt(password, salt, n, r, p, outLen); in scrypt()

12