MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / verify

Method verify

src/main/java/core/org/xbill/DNS/DNSSEC.java:853–898  ·  view source on GitHub ↗
(PublicKey key, int alg, byte [] data, byte [] signature)

Source from the content-addressed store, hash-verified

851}
852
853private static void
854verify(PublicKey key, int alg, byte [] data, byte [] signature)
855throws DNSSECException
856{
857 if (key instanceof DSAPublicKey) {
858 try {
859 signature = DSASignaturefromDNS(signature);
860 }
861 catch (IOException e) {
862 throw new IllegalStateException();
863 }
864 } else if (key instanceof ECPublicKey) {
865 try {
866 switch (alg) {
867 case Algorithm.ECC_GOST:
868 signature = ECGOSTSignaturefromDNS(signature,
869 GOST);
870 break;
871 case Algorithm.ECDSAP256SHA256:
872 signature = ECDSASignaturefromDNS(signature,
873 ECDSA_P256);
874 break;
875 case Algorithm.ECDSAP384SHA384:
876 signature = ECDSASignaturefromDNS(signature,
877 ECDSA_P384);
878 break;
879 default:
880 throw new UnsupportedAlgorithmException(alg);
881 }
882 }
883 catch (IOException e) {
884 throw new IllegalStateException();
885 }
886 }
887
888 try {
889 Signature s = Signature.getInstance(algString(alg));
890 s.initVerify(key);
891 s.update(data);
892 if (!s.verify(signature))
893 throw new SignatureVerificationException();
894 }
895 catch (GeneralSecurityException e) {
896 throw new DNSSECException(e.toString());
897 }
898}
899
900private static boolean
901matches(SIGBase sig, KEYBase key)

Callers 1

verifyMessageMethod · 0.95

Calls 15

DSASignaturefromDNSMethod · 0.95
ECDSASignaturefromDNSMethod · 0.95
algStringMethod · 0.95
matchesMethod · 0.95
digestRRsetMethod · 0.95
getPublicKeyMethod · 0.80
getInstanceMethod · 0.45
updateMethod · 0.45
toStringMethod · 0.45
compareToMethod · 0.45
getExpireMethod · 0.45

Tested by

no test coverage detected