refactor getVerifier()
This commit is contained in:
parent
31f35a17f8
commit
15eb319b26
@ -264,19 +264,22 @@ public class DnsKeyPair {
|
|||||||
* @throws NoSuchAlgorithmException
|
* @throws NoSuchAlgorithmException
|
||||||
*/
|
*/
|
||||||
public Signature getVerifier() {
|
public Signature getVerifier() {
|
||||||
if (mVerifier == null) {
|
if (mVerifier != null) return mVerifier;
|
||||||
|
|
||||||
mVerifier = getSignature();
|
mVerifier = getSignature();
|
||||||
PublicKey pk = getPublic();
|
PublicKey pk = getPublic();
|
||||||
if (mVerifier != null && pk != null) {
|
|
||||||
|
if (mVerifier == null || pk == null) {
|
||||||
|
log.warning("Could not get a Signature object for this key pair" + this);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mVerifier.initVerify(pk);
|
mVerifier.initVerify(pk);
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
}
|
log.warning("Key pair cannot initialize with public key: " + this);
|
||||||
} else {
|
|
||||||
// do not return an uninitialized verifier
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return mVerifier;
|
return mVerifier;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user