1
// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)
6
import org.xbill.DNS.utils.*;
9
* SSH Fingerprint - stores the fingerprint of an SSH host key.
11
* @author Brian Wellington
14
public class SSHFPRecord extends Record {
16
public static class Algorithm {
17
private Algorithm() {}
19
public static final int RSA = 1;
20
public static final int DSS = 2;
23
public static class Digest {
26
public static final int SHA1 = 1;
30
private int digestType;
31
private byte [] fingerprint;
37
return new SSHFPRecord();
41
* Creates an SSHFP Record from the given data.
42
* @param alg The public key's algorithm.
43
* @param digestType The public key's digest type.
44
* @param fingerprint The public key's fingerprint.
47
SSHFPRecord(Name name, int dclass, long ttl, int alg, int digestType,
50
super(name, Type.SSHFP, dclass, ttl);
51
this.alg = checkU8("alg", alg);
52
this.digestType = checkU8("digestType", digestType);
53
this.fingerprint = fingerprint;
57
rrFromWire(DNSInput in) throws IOException {
59
digestType = in.readU8();
60
fingerprint = in.readByteArray();
64
rdataFromString(Tokenizer st, Name origin) throws IOException {
66
digestType = st.getUInt8();
67
fingerprint = st.getHex(true);
72
StringBuffer sb = new StringBuffer();
75
sb.append(digestType);
77
sb.append(base16.toString(fingerprint));
81
/** Returns the public key's algorithm. */
87
/** Returns the public key's digest type. */
93
/** Returns the fingerprint */
100
rrToWire(DNSOutput out, Compression c, boolean canonical) {
102
out.writeU8(digestType);
103
out.writeByteArray(fingerprint);