📄 sshfprecord.java
字号:
// Copyright (c) 2004 Brian Wellington (bwelling@xbill.org)package org.xbill.DNS;import java.io.*;import org.xbill.DNS.utils.*;/** * SSH Fingerprint - stores the fingerprint of an SSH host key. * * @author Brian Wellington */public class SSHFPRecord extends Record {public static class Algorithm { private Algorithm() {} public static final int RSA = 1; public static final int DSS = 2;}public static class Digest { private Digest() {} public static final int SHA1 = 1;}private int alg;private int digestType;private byte [] fingerprint;SSHFPRecord() {} RecordgetObject() { return new SSHFPRecord();}/** * Creates an SSHFP Record from the given data. * @param alg The public key's algorithm. * @param digestType The public key's digest type. * @param fingerprint The public key's fingerprint. */publicSSHFPRecord(Name name, int dclass, long ttl, int alg, int digestType, byte [] fingerprint){ super(name, Type.SSHFP, dclass, ttl); this.alg = checkU8("alg", alg); this.digestType = checkU8("digestType", digestType); this.fingerprint = fingerprint;}voidrrFromWire(DNSInput in) throws IOException { alg = in.readU8(); digestType = in.readU8(); fingerprint = in.readByteArray();}voidrdataFromString(Tokenizer st, Name origin) throws IOException { alg = st.getUInt8(); digestType = st.getUInt8(); fingerprint = st.getHex(true);}StringrrToString() { StringBuffer sb = new StringBuffer(); sb.append(alg); sb.append(" "); sb.append(digestType); sb.append(" "); sb.append(base16.toString(fingerprint)); return sb.toString();}/** Returns the public key's algorithm. */public intgetAlgorithm() { return alg;}/** Returns the public key's digest type. */public intgetDigestType() { return digestType;}/** Returns the fingerprint */public byte []getFingerPrint() { return fingerprint;}voidrrToWire(DNSOutput out, Compression c, boolean canonical) { out.writeU8(alg); out.writeU8(digestType); out.writeByteArray(fingerprint);}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -