本文整理汇总了Golang中github.com/miekg/dns.DNSKEY类的典型用法代码示例。如果您正苦于以下问题:Golang DNSKEY类的具体用法?Golang DNSKEY怎么用?Golang DNSKEY使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DNSKEY类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: sectionCheck
func sectionCheck(set []dns.RR, server string, tcp bool) {
var key *dns.DNSKEY
for _, rr := range set {
if rr.Header().Rrtype == dns.TypeRRSIG {
rrset := getRRset(set, rr.Header().Name, rr.(*dns.RRSIG).TypeCovered)
if dnskey == nil {
key = getKey(rr.(*dns.RRSIG).SignerName, rr.(*dns.RRSIG).KeyTag, server, tcp)
} else {
key = dnskey
}
if key == nil {
fmt.Printf(";? DNSKEY %s/%d not found\n", rr.(*dns.RRSIG).SignerName, rr.(*dns.RRSIG).KeyTag)
continue
}
where := "net"
if dnskey != nil {
where = "disk"
}
if err := rr.(*dns.RRSIG).Verify(key, rrset); err != nil {
fmt.Printf(";- Bogus signature, %s does not validate (DNSKEY %s/%d/%s) [%s]\n",
shortSig(rr.(*dns.RRSIG)), key.Header().Name, key.KeyTag(), where, err.Error())
} else {
fmt.Printf(";+ Secure signature, %s validates (DNSKEY %s/%d/%s)\n", shortSig(rr.(*dns.RRSIG)), key.Header().Name, key.KeyTag(), where)
}
}
}
}
示例2: CalcTag
func CalcTag(flags uint16, algorithm uint8, publickey string) uint16 {
key := new(dns.DNSKEY)
key.Hdr.Name = "."
key.Hdr.Rrtype = dns.TypeDNSKEY
key.Hdr.Class = dns.ClassINET
key.Hdr.Ttl = 3600
key.Flags = flags
key.Protocol = 3
key.Algorithm = algorithm
key.PublicKey = publickey
return key.KeyTag()
}
示例3: SetKeys
func (s *Server) SetKeys(k *dns.DNSKEY, p dns.PrivateKey) {
s.dnsKey = k
s.keyTag = k.KeyTag()
s.privKey = p
s.registry.DNSSEC(true)
}
示例4: setKeys
func (s *server) setKeys(k *dns.DNSKEY, p dns.PrivateKey) {
s.PubKey = k
s.KeyTag = k.KeyTag()
s.PrivKey = p
}