Home
last modified time | relevance | path

Searched refs:salt (Results 1 – 25 of 37) 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.java80 public static @NonNull KeyDerivationParams createSha256Params(@NonNull byte[] salt) { in createSha256Params() argument
81 return new KeyDerivationParams(ALGORITHM_SHA256, salt); in createSha256Params()
94 @NonNull byte[] salt, int memoryDifficulty) { in createScryptParams()
95 return new KeyDerivationParams(ALGORITHM_SCRYPT, salt, memoryDifficulty); in createScryptParams()
101 private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt) { in KeyDerivationParams() argument
102 this(algorithm, salt, /*memoryDifficulty=*/ -1); in KeyDerivationParams()
108 private KeyDerivationParams(@KeyDerivationAlgorithm int algorithm, @NonNull byte[] salt, in KeyDerivationParams() argument
111 mSalt = Objects.requireNonNull(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.java53 public static SecretKey buildPasswordKey(String algorithm, String pw, byte[] salt, int rounds) { in buildPasswordKey() argument
54 return buildCharArrayKey(algorithm, pw.toCharArray(), salt, rounds); in buildPasswordKey()
67 public static String buildPasswordHash(String algorithm, String pw, byte[] salt, int rounds) { in buildPasswordHash() argument
68 SecretKey key = buildPasswordKey(algorithm, pw, salt, rounds); in buildPasswordHash()
109 public static byte[] makeKeyChecksum(String algorithm, byte[] pwBytes, byte[] salt, in makeKeyChecksum() argument
116 Key checksum = buildCharArrayKey(algorithm, mkAsChar, salt, rounds); in makeKeyChecksum()
120 private static SecretKey buildCharArrayKey(String algorithm, char[] pwArray, byte[] salt, in buildCharArrayKey() argument
124 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/packages/BackupEncryption/src/com/android/server/backup/encryption/chunking/cdc/
DHkdf.java50 static byte[] hkdf(byte[] masterKey, byte[] salt, byte[] data) throws InvalidKeyException { in hkdf() argument
52 Objects.requireNonNull(salt, "HKDF requires a salt."); in hkdf()
54 return hkdfSha256Expand(hkdfSha256Extract(masterKey, salt), data); in hkdf()
70 private static byte[] hkdfSha256Extract(byte[] inputKeyMaterial, byte[] salt) in hkdfSha256Extract() argument
81 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/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/packages/BackupEncryption/test/robolectric/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/core/java/android/os/incremental/
DV4Signature.java50 @Nullable public final byte[] salt; // used exactly as in fs-verity, 32 bytes max field in V4Signature.HashingInfo
53 HashingInfo(int hashAlgorithm, byte log2BlockSize, byte[] salt, byte[] rawRootHash) { in HashingInfo() argument
56 this.salt = salt; in HashingInfo()
68 byte[] salt = readBytes(buffer); in fromByteArray()
70 return new HashingInfo(hashAlgorithm, log2BlockSize, salt, rawRootHash); in fromByteArray()
166 hashingInfo.salt) + bytesSize(hashingInfo.rawRootHash) + bytesSize( in getSigningData()
174 writeBytes(buffer, hashingInfo.salt); in getSigningData()
/frameworks/base/services/core/java/com/android/server/locksettings/recoverablekeystore/
DKeySyncTask.java268 byte[] salt = generateSalt(); in syncKeysForAgent()
271 localLskfHash = hashCredentialsByScrypt(salt, mCredential); in syncKeysForAgent()
273 localLskfHash = hashCredentialsBySaltedSha256(salt, mCredential); in syncKeysForAgent()
355 salt, /*memoryDifficulty=*/ SCRYPT_PARAM_N); in syncKeysForAgent()
357 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in syncKeysForAgent()
481 byte[] salt = new byte[SALT_LENGTH_BYTES]; in generateSalt()
482 new SecureRandom().nextBytes(salt); in generateSalt()
483 return salt; in generateSalt()
492 static byte[] hashCredentialsBySaltedSha256(byte[] salt, byte[] credentialsBytes) { in hashCredentialsBySaltedSha256() argument
494 salt.length + credentialsBytes.length + LENGTH_PREFIX_BYTES * 2); in hashCredentialsBySaltedSha256()
[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/util/apk/
DVerityBuilder.java185 private BufferedDigester(@Nullable byte[] salt, @NonNull ByteBuffer output) in BufferedDigester() argument
187 mSalt = salt; in BufferedDigester()
283 SignatureInfo signatureInfo, byte[] salt, ByteBuffer output) in generateApkVerityDigestAtLeafLevel() argument
285 BufferedDigester digester = new BufferedDigester(salt, output); in generateApkVerityDigestAtLeafLevel()
329 @Nullable SignatureInfo signatureInfo, @Nullable byte[] salt, in generateVerityTreeInternal() argument
334 generateApkVerityDigestAtLeafLevel(apk, signatureInfo, salt, slice(output, in generateVerityTreeInternal()
343 BufferedDigester digester = new BufferedDigester(salt, outputBuffer); in generateVerityTreeInternal()
351 BufferedDigester digester = new BufferedDigester(salt, ByteBuffer.wrap(rootHash)); in generateVerityTreeInternal()
358 byte[] salt) { in generateApkVerityHeader() argument
359 if (salt.length != 8) { in generateApkVerityHeader()
[all …]
/frameworks/base/identity/java/android/security/identity/
DUtil.java95 String macAlgorithm, final byte[] ikm, final byte[] salt, final byte[] info, int size) { in computeHkdf() argument
106 if (salt == null || salt.length == 0) { in computeHkdf()
112 mac.init(new SecretKeySpec(salt, macAlgorithm)); in computeHkdf()
DCredstoreIdentityCredential.java144 byte[] salt = new byte[1]; in setReaderEphemeralPublicKey()
147 salt[0] = 0x01; in setReaderEphemeralPublicKey()
148 byte[] derivedKey = Util.computeHkdf("HmacSha256", sharedSecret, salt, info, 32); in setReaderEphemeralPublicKey()
151 salt[0] = 0x00; in setReaderEphemeralPublicKey()
152 derivedKey = Util.computeHkdf("HmacSha256", sharedSecret, salt, info, 32); in setReaderEphemeralPublicKey()
/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/core/java/com/android/internal/widget/
DLockPatternUtils.java983 long salt = getLong(LOCK_PASSWORD_SALT_KEY, 0, userId); in getSalt() local
984 if (salt == 0) { in getSalt()
986 salt = SecureRandom.getInstance("SHA1PRNG").nextLong(); in getSalt()
987 setLong(LOCK_PASSWORD_SALT_KEY, salt, userId); in getSalt()
994 return Long.toHexString(salt); in getSalt()
1016 byte[] salt = getSalt(userId).getBytes(); in legacyPasswordToHash()
1017 byte[] saltedPassword = Arrays.copyOf(password, password.length + salt.length); in legacyPasswordToHash()
1018 System.arraycopy(salt, 0, saltedPassword, password.length, salt.length); in legacyPasswordToHash()
1045 byte[] salt = getSalt(userId).getBytes(); in passwordToHistoryHash()
1047 + salt.length); in passwordToHistoryHash()
[all …]
/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()

12