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

Class TSIG

src/main/java/core/org/xbill/DNS/TSIG.java:20–661  ·  view source on GitHub ↗

Transaction signature handling. This class generates and verifies TSIG records on messages, which provide transaction security. @see TSIGRecord @author Brian Wellington

Source from the content-addressed store, hash-verified

18 */
19
20public class TSIG {
21
22/** The domain name representing the HMAC-MD5 algorithm. */
23public static final Name HMAC_MD5 =
24 Name.fromConstantString("HMAC-MD5.SIG-ALG.REG.INT.");
25
26/** The domain name representing the HMAC-MD5 algorithm (deprecated). */
27public static final Name HMAC = HMAC_MD5;
28
29/** The domain name representing the HMAC-SHA1 algorithm. */
30public static final Name HMAC_SHA1 = Name.fromConstantString("hmac-sha1.");
31
32/**
33 * The domain name representing the HMAC-SHA224 algorithm.
34 * Note that SHA224 is not supported by Java out-of-the-box, this requires use
35 * of a third party provider like BouncyCastle.org.
36 */
37public static final Name HMAC_SHA224 = Name.fromConstantString("hmac-sha224.");
38
39/** The domain name representing the HMAC-SHA256 algorithm. */
40public static final Name HMAC_SHA256 = Name.fromConstantString("hmac-sha256.");
41
42/** The domain name representing the HMAC-SHA384 algorithm. */
43public static final Name HMAC_SHA384 = Name.fromConstantString("hmac-sha384.");
44
45/** The domain name representing the HMAC-SHA512 algorithm. */
46public static final Name HMAC_SHA512 = Name.fromConstantString("hmac-sha512.");
47
48private static Map algMap;
49
50static {
51 Map out = new HashMap();
52 out.put(HMAC_MD5, "HmacMD5");
53 out.put(HMAC_SHA1, "HmacSHA1");
54 out.put(HMAC_SHA224, "HmacSHA224");
55 out.put(HMAC_SHA256, "HmacSHA256");
56 out.put(HMAC_SHA384, "HmacSHA384");
57 out.put(HMAC_SHA512, "HmacSHA512");
58 algMap = Collections.unmodifiableMap(out);
59}
60
61public static Name
62algorithmToName(String alg)
63{
64 Iterator it = algMap.entrySet().iterator();
65 while (it.hasNext()) {
66 Map.Entry entry = (Map.Entry) it.next();
67 if (alg.equalsIgnoreCase((String)entry.getValue()))
68 return (Name) entry.getKey();
69 }
70 throw new IllegalArgumentException("Unknown algorithm");
71}
72public static String
73nameToAlgorithm(Name name)
74{
75 String alg = (String) algMap.get(name);
76 if (alg != null)
77 return alg;

Callers

nothing calls this directly

Calls 2

fromConstantStringMethod · 0.95
putMethod · 0.45

Tested by

no test coverage detected