mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 08:09:12 +01:00
Some additional decryption perf improvements.
This commit is contained in:
@@ -44,12 +44,7 @@ public class UnidentifiedAccessUtil {
|
||||
private static final byte[] UNRESTRICTED_KEY = new byte[16];
|
||||
|
||||
public static CertificateValidator getCertificateValidator() {
|
||||
try {
|
||||
ECPublicKey unidentifiedSenderTrustRoot = Curve.decodePoint(Base64.decode(BuildConfig.UNIDENTIFIED_SENDER_TRUST_ROOT), 0);
|
||||
return new CertificateValidator(unidentifiedSenderTrustRoot);
|
||||
} catch (InvalidKeyException | IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return CertificateValidatorHolder.INSTANCE.certificateValidator;
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@@ -209,4 +204,19 @@ public class UnidentifiedAccessUtil {
|
||||
|
||||
return accessKey;
|
||||
}
|
||||
|
||||
private enum CertificateValidatorHolder {
|
||||
INSTANCE;
|
||||
|
||||
final CertificateValidator certificateValidator = buildCertificateValidator();
|
||||
|
||||
private static CertificateValidator buildCertificateValidator() {
|
||||
try {
|
||||
ECPublicKey unidentifiedSenderTrustRoot = Curve.decodePoint(Base64.decode(BuildConfig.UNIDENTIFIED_SENDER_TRUST_ROOT), 0);
|
||||
return new CertificateValidator(unidentifiedSenderTrustRoot);
|
||||
} catch (InvalidKeyException | IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user