secret

package
v0.0.0-...-06d884a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "secret",
	Short: "示例",
	Args: func(cmd *cobra.Command, args []string) error {
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		key := new(dns.DNSKEY)
		key.Hdr = dns.RR_Header{
			Name:   "dingxiaoyu.com.",
			Rrtype: dns.TypeDNSKEY,
			Class:  dns.ClassINET,
			Ttl:    14400,
		}
		key.Flags = 256
		key.Protocol = 3
		key.Algorithm = dns.ECDSAP256SHA256

		prive := "Private-key-format: v1.3\nAlgorithm: 13 (ECDSAP256SHA256)\nPrivateKey: D8GGLJzXo/O3H16PnpGrBNZF18a+w0MTr1Mvnm/25wc=\n"

		privkey, _ := key.NewPrivateKey(prive)

		srv := new(dns.A)
		srv.Hdr = dns.RR_Header{Name: "qq.dingxiaoyu.com.", Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: 14400}
		srv.A = net.ParseIP("127.0.0.1")

		sig := new(dns.RRSIG)
		sig.Hdr = dns.RR_Header{Name: "dingxiaoyu.com.", Rrtype: dns.TypeRRSIG, Class: dns.ClassINET, Ttl: 14400}
		sig.TypeCovered = srv.Hdr.Rrtype
		sig.Labels = uint8(dns.CountLabel(srv.Hdr.Name))
		sig.OrigTtl = srv.Hdr.Ttl
		sig.Expiration = 1296534305
		sig.Inception = 1293942305
		sig.KeyTag = key.KeyTag()
		sig.SignerName = key.Hdr.Name
		sig.Algorithm = dns.ECDSAP256SHA256

		fmt.Println(key.String())
		fmt.Println(key.PrivateKeyString(privkey))
		fmt.Println(privkey)

	},
}

Cmd cmd example

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL