mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 06:52:18 +00:00
Reduce usage of Log.w()
This commit is contained in:
@@ -55,6 +55,8 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
public class MasterCipher {
|
||||
|
||||
private static final String TAG = MasterCipher.class.getSimpleName();
|
||||
|
||||
private final MasterSecret masterSecret;
|
||||
private final Cipher encryptingCipher;
|
||||
private final Cipher decryptingCipher;
|
||||
@@ -125,13 +127,13 @@ public class MasterCipher {
|
||||
|
||||
public boolean verifyMacFor(String content, byte[] theirMac) {
|
||||
byte[] ourMac = getMacFor(content);
|
||||
Log.w("MasterCipher", "Our Mac: " + Hex.toString(ourMac));
|
||||
Log.w("MasterCipher", "Thr Mac: " + Hex.toString(theirMac));
|
||||
Log.i(TAG, "Our Mac: " + Hex.toString(ourMac));
|
||||
Log.i(TAG, "Thr Mac: " + Hex.toString(theirMac));
|
||||
return Arrays.equals(ourMac, theirMac);
|
||||
}
|
||||
|
||||
public byte[] getMacFor(String content) {
|
||||
Log.w("MasterCipher", "Macing: " + content);
|
||||
Log.w(TAG, "Macing: " + content);
|
||||
try {
|
||||
Mac mac = getMac(masterSecret.getMacKey());
|
||||
return mac.doFinal(content.getBytes());
|
||||
|
||||
@@ -47,6 +47,8 @@ import java.security.Security;
|
||||
*/
|
||||
public final class PRNGFixes {
|
||||
|
||||
private static final String TAG = PRNGFixes.class.getSimpleName();
|
||||
|
||||
private static final int VERSION_CODE_JELLY_BEAN = 16;
|
||||
private static final int VERSION_CODE_JELLY_BEAN_MR2 = 18;
|
||||
private static final byte[] BUILD_FINGERPRINT_AND_DEVICE_SERIAL =
|
||||
@@ -226,8 +228,7 @@ public final class PRNGFixes {
|
||||
} catch (IOException e) {
|
||||
// On a small fraction of devices /dev/urandom is not writable.
|
||||
// Log and ignore.
|
||||
Log.w(PRNGFixes.class.getSimpleName(),
|
||||
"Failed to mix seed into " + URANDOM_FILE);
|
||||
Log.w(TAG, "Failed to mix seed into " + URANDOM_FILE);
|
||||
} finally {
|
||||
mSeeded = true;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class PublicKey {
|
||||
|
||||
private static final String TAG = PublicKey.class.getSimpleName();
|
||||
|
||||
public static final int KEY_SIZE = 3 + ECPublicKey.KEY_SIZE;
|
||||
|
||||
private final ECPublicKey publicKey;
|
||||
@@ -48,7 +50,7 @@ public class PublicKey {
|
||||
}
|
||||
|
||||
public PublicKey(byte[] bytes, int offset) throws InvalidKeyException {
|
||||
Log.w("PublicKey", "PublicKey Length: " + (bytes.length - offset));
|
||||
Log.i(TAG, "PublicKey Length: " + (bytes.length - offset));
|
||||
|
||||
if ((bytes.length - offset) < KEY_SIZE)
|
||||
throw new InvalidKeyException("Provided bytes are too short.");
|
||||
@@ -95,7 +97,7 @@ public class PublicKey {
|
||||
byte[] keyIdBytes = Conversions.mediumToByteArray(id);
|
||||
byte[] serializedPoint = publicKey.serialize();
|
||||
|
||||
Log.w("PublicKey", "Serializing public key point: " + Hex.toString(serializedPoint));
|
||||
Log.i(TAG, "Serializing public key point: " + Hex.toString(serializedPoint));
|
||||
|
||||
return Util.combine(keyIdBytes, serializedPoint);
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ public class TextSecureIdentityKeyStore implements IdentityKeyStore {
|
||||
Optional<IdentityRecord> identityRecord = identityDatabase.getIdentity(signalAddress);
|
||||
|
||||
if (!identityRecord.isPresent()) {
|
||||
Log.w(TAG, "Saving new identity...");
|
||||
Log.i(TAG, "Saving new identity...");
|
||||
identityDatabase.saveIdentity(signalAddress, identityKey, VerifiedStatus.DEFAULT, true, System.currentTimeMillis(), nonBlockingApproval);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!identityRecord.get().getIdentityKey().equals(identityKey)) {
|
||||
Log.w(TAG, "Replacing existing identity...");
|
||||
Log.i(TAG, "Replacing existing identity...");
|
||||
VerifiedStatus verifiedStatus;
|
||||
|
||||
if (identityRecord.get().getVerifiedStatus() == VerifiedStatus.VERIFIED ||
|
||||
@@ -75,7 +75,7 @@ public class TextSecureIdentityKeyStore implements IdentityKeyStore {
|
||||
}
|
||||
|
||||
if (isNonBlockingApprovalRequired(identityRecord.get())) {
|
||||
Log.w(TAG, "Setting approval status...");
|
||||
Log.i(TAG, "Setting approval status...");
|
||||
identityDatabase.setApproval(signalAddress, nonBlockingApproval);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user