make DB.calcFingerprint() return null if pubkey is null
Handling it here seems to keep the flow simple.
This commit is contained in:
parent
e063636d61
commit
711a1418b6
@ -465,6 +465,8 @@ public class DB {
|
|||||||
|
|
||||||
public static String calcFingerprint(String pubkey) {
|
public static String calcFingerprint(String pubkey) {
|
||||||
String ret = null;
|
String ret = null;
|
||||||
|
if (pubkey == null)
|
||||||
|
return null;
|
||||||
try {
|
try {
|
||||||
// keytool -list -v gives you the SHA-256 fingerprint
|
// keytool -list -v gives you the SHA-256 fingerprint
|
||||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||||
@ -1410,7 +1412,7 @@ public class DB {
|
|||||||
String calcedFingerprint = DB.calcFingerprint(pubkey);
|
String calcedFingerprint = DB.calcFingerprint(pubkey);
|
||||||
if (fingerprint == null) {
|
if (fingerprint == null) {
|
||||||
fingerprint = calcedFingerprint;
|
fingerprint = calcedFingerprint;
|
||||||
} else {
|
} else if (calcedFingerprint != null) {
|
||||||
fingerprint = fingerprint.toUpperCase();
|
fingerprint = fingerprint.toUpperCase();
|
||||||
if (!fingerprint.equals(calcedFingerprint)) {
|
if (!fingerprint.equals(calcedFingerprint)) {
|
||||||
throw new SecurityException("Given fingerprint does not match calculated one! ("
|
throw new SecurityException("Given fingerprint does not match calculated one! ("
|
||||||
|
Loading…
x
Reference in New Issue
Block a user