Home
last modified time | relevance | path

Searched refs:salt (Results 1 – 25 of 42) 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/java/com/android/internal/widget/
DLockscreenCredential.java265 public String passwordToHistoryHash(byte[] salt, byte[] hashFactor) { in passwordToHistoryHash() argument
266 return passwordToHistoryHash(mCredential, salt, hashFactor); in passwordToHistoryHash()
273 byte[] passwordToHash, byte[] salt, byte[] hashFactor) { in passwordToHistoryHash() argument
275 || hashFactor == null || salt == null) { in passwordToHistoryHash()
282 + salt.length); in passwordToHistoryHash()
283 System.arraycopy(salt, 0, saltedPassword, passwordToHash.length, salt.length); in passwordToHistoryHash()
299 public String legacyPasswordToHash(byte[] salt) { in legacyPasswordToHash() argument
300 return legacyPasswordToHash(mCredential, salt); in legacyPasswordToHash()
312 public static String legacyPasswordToHash(byte[] password, byte[] salt) { in legacyPasswordToHash() argument
313 if (password == null || password.length == 0 || salt == null) { in legacyPasswordToHash()
[all …]
/frameworks/base/core/tests/coretests/src/com/android/internal/widget/
DLockscreenCredentialTest.java184 String salt = "6d5331dd120077a0"; in testPasswordToHistoryHash() local
188 credential.passwordToHistoryHash(salt.getBytes(), hashFactor.getBytes())) in testPasswordToHistoryHash()
192 password.getBytes(), salt.getBytes(), hashFactor.getBytes())) in testPasswordToHistoryHash()
200 String salt = "6d5331dd120077a0"; in testPasswordToHistoryHashInvalidInput() local
211 credential.passwordToHistoryHash(salt.getBytes(), /* hashFactor= */ null)) in testPasswordToHistoryHashInvalidInput()
215 password.getBytes(), salt.getBytes(), /* hashFactor= */ null)) in testPasswordToHistoryHashInvalidInput()
220 /* password= */ null, salt.getBytes(), hashFactor.getBytes())) in testPasswordToHistoryHashInvalidInput()
227 String salt = "6d5331dd120077a0"; in testLegacyPasswordToHash() local
232 credential.legacyPasswordToHash(salt.getBytes())) in testLegacyPasswordToHash()
236 password.getBytes(), salt.getBytes())) in testLegacyPasswordToHash()
[all …]
/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[] mainKey, byte[] salt, byte[] data) throws InvalidKeyException { in hkdf() argument
52 Objects.requireNonNull(salt, "HKDF requires a salt."); in hkdf()
54 return hkdfSha256Expand(hkdfSha256Extract(mainKey, 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/core/java/android/util/apk/
DVerityBuilder.java131 public static byte[] generateFsVerityRootHash(@NonNull String apkPath, byte[] salt, in generateFsVerityRootHash() argument
143 return generateFsVerityTreeInternal(apk, salt, levelOffset, tree); in generateFsVerityRootHash()
194 private BufferedDigester(@Nullable byte[] salt, @NonNull ByteBuffer output) in BufferedDigester() argument
196 mSalt = salt; in BufferedDigester()
272 @Nullable byte[] salt, ByteBuffer output) in generateFsVerityDigestAtLeafLevel() argument
274 BufferedDigester digester = new BufferedDigester(salt, output); in generateFsVerityDigestAtLeafLevel()
293 SignatureInfo signatureInfo, byte[] salt, ByteBuffer output) in generateApkVerityDigestAtLeafLevel() argument
295 BufferedDigester digester = new BufferedDigester(salt, output); in generateApkVerityDigestAtLeafLevel()
339 @Nullable byte[] salt, @NonNull int[] levelOffset, @NonNull ByteBuffer output) in generateFsVerityTreeInternal() argument
342 generateFsVerityDigestAtLeafLevel(apk, salt, in generateFsVerityTreeInternal()
[all …]
/frameworks/base/core/java/android/service/displayhash/
DDisplayHashingService.java99 public abstract void onGenerateDisplayHash(@NonNull byte[] salt, in onGenerateDisplayHash() argument
122 public abstract VerifiedDisplayHash onVerifyDisplayHash(@NonNull byte[] salt, in onVerifyDisplayHash() argument
125 private void verifyDisplayHash(byte[] salt, DisplayHash displayHash, in verifyDisplayHash() argument
127 VerifiedDisplayHash verifiedDisplayHash = onVerifyDisplayHash(salt, in verifyDisplayHash()
160 public void generateDisplayHash(byte[] salt, HardwareBuffer buffer, Rect bounds, in generateDisplayHash() argument
164 DisplayHashingService.this, salt, buffer, bounds, in generateDisplayHash()
184 public void verifyDisplayHash(byte[] salt, DisplayHash displayHash, in verifyDisplayHash() argument
188 DisplayHashingService.this, salt, displayHash, callback)); in verifyDisplayHash()
DIDisplayHashingService.aidl41 void generateDisplayHash(in byte[] salt, in HardwareBuffer buffer, in Rect bounds, in generateDisplayHash() argument
53 void verifyDisplayHash(in byte[] salt, in DisplayHash displayHash, in RemoteCallback callback); in verifyDisplayHash() argument
/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()
/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.java266 byte[] salt = generateSalt(); in syncKeysForAgent()
269 localLskfHash = hashCredentialsByScrypt(salt, mCredential); in syncKeysForAgent()
271 localLskfHash = hashCredentialsBySaltedSha256(salt, mCredential); in syncKeysForAgent()
353 salt, /*memoryDifficulty=*/ SCRYPT_PARAM_N); in syncKeysForAgent()
355 keyDerivationParams = KeyDerivationParams.createSha256Params(salt); in syncKeysForAgent()
479 byte[] salt = new byte[SALT_LENGTH_BYTES]; in generateSalt()
480 new SecureRandom().nextBytes(salt); in generateSalt()
481 return salt; in generateSalt()
490 static byte[] hashCredentialsBySaltedSha256(byte[] salt, byte[] credentialsBytes) { in hashCredentialsBySaltedSha256() argument
492 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/os/incremental/
DV4Signature.java53 @Nullable public final byte[] salt; // used exactly as in fs-verity, 32 bytes max field in V4Signature.HashingInfo
56 HashingInfo(int hashAlgorithm, byte log2BlockSize, byte[] salt, byte[] rawRootHash) { in HashingInfo() argument
59 this.salt = salt; in HashingInfo()
71 byte[] salt = readBytes(buffer); in fromByteArray()
73 return new HashingInfo(hashAlgorithm, log2BlockSize, salt, rawRootHash); in fromByteArray()
231 hashingInfo.salt) + bytesSize(hashingInfo.rawRootHash) + bytesSize( in getSignedData()
239 writeBytes(buffer, hashingInfo.salt); in getSignedData()
/frameworks/base/core/java/android/content/res/
DObbInfo.java59 public byte[] salt; field in ObbInfo
89 dest.writeByteArray(salt); in writeToParcel()
108 salt = source.createByteArray(); in ObbInfo()
/frameworks/base/identity/java/android/security/identity/
DUtil.java123 @NonNull String macAlgorithm, @NonNull final byte[] ikm, @NonNull final byte[] salt, in computeHkdf() argument
135 if (salt == null || salt.length == 0) { in computeHkdf()
141 mac.init(new SecretKeySpec(salt, macAlgorithm)); in computeHkdf()
/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/services/core/java/com/android/server/pm/
DPackageManagerShellCommandDataLoader.java171 private Metadata(byte mode, String data, String salt) { in Metadata() argument
174 this.mSalt = salt; in Metadata()
185 final String salt; in fromByteArray() local
193 salt = new String(bytes, offset, bytes.length - offset, in fromByteArray()
200 salt = null; in fromByteArray()
203 return new Metadata(mode, data, salt); in fromByteArray()

12