static void
checkAlgorithm(PrivateKey key, int alg) throws UnsupportedAlgorithmException
{
	switch (alg) {
	case Algorithm.RSAMD5:
	case Algorithm.RSASHA1:
	case Algorithm.RSA_NSEC3_SHA1:
	case Algorithm.RSASHA256:
	case Algorithm.RSASHA512:
		if (! (key instanceof RSAPrivateKey))
			throw new IncompatibleKeyException();
		break;
	case Algorithm.DSA:
	case Algorithm.DSA_NSEC3_SHA1:
		if (! (key instanceof DSAPrivateKey))
			throw new IncompatibleKeyException();
		break;
	case Algorithm.ECC_GOST:
	case Algorithm.ECDSAP256SHA256:
	case Algorithm.ECDSAP384SHA384:
		if (! (key instanceof ECPrivateKey))
			throw new IncompatibleKeyException();
		break;
	default:
		throw new UnsupportedAlgorithmException(alg);
	}
}
Verify a DNSSEC signature.
@param rrset The data to be verified.
@param rrsig The RRSIG record containing the signature.
@param key The DNSKEY record to verify the signature with.
@throws UnsupportedAlgorithmException The algorithm is unknown
@throws MalformedKeyException The key is malformed
@throws KeyMismatchException The key and signature do not match
@throws SignatureExpiredException The signature has expired
@throws SignatureNotYetValidException The signature is not yet valid
@throws SignatureVerificationException The signature does not verify.
@throws DNSSECException Some other error occurred.
src/main/java/core/org/xbill/DNS/DNSSEC.java