1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 "golang.org/x/mod/sumdb/note"
16 skey := "PRIVATE+KEY+PeterNeumann+c74f20a3+AYEKFALVFGyNhPJEMzD1QIDr+Y7hfZx09iUvxdXHKDFz"
17 text := "If you think cryptography is the answer to your problem,\n" +
18 "then you don't know what your problem is.\n"
20 signer, err := note.NewSigner(skey)
26 msg, err := note.Sign(¬e.Note{Text: text}, signer)
34 // If you think cryptography is the answer to your problem,
35 // then you don't know what your problem is.
37 // — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=
41 vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW"
42 msg := []byte("If you think cryptography is the answer to your problem,\n" +
43 "then you don't know what your problem is.\n" +
45 "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n")
47 verifier, err := note.NewVerifier(vkey)
52 verifiers := note.VerifierList(verifier)
54 n, err := note.Open(msg, verifiers)
59 fmt.Printf("%s (%08x):\n%s", n.Sigs[0].Name, n.Sigs[0].Hash, n.Text)
62 // PeterNeumann (c74f20a3):
63 // If you think cryptography is the answer to your problem,
64 // then you don't know what your problem is.
73 type zeroReader struct{}
75 func (zeroReader) Read(buf []byte) (int, error) {
82 func ExampleSign_add_signatures() {
83 vkey := "PeterNeumann+c74f20a3+ARpc2QcUPDhMQegwxbzhKqiBfsVkmqq/LDE4izWy10TW"
84 msg := []byte("If you think cryptography is the answer to your problem,\n" +
85 "then you don't know what your problem is.\n" +
87 "— PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=\n")
89 verifier, err := note.NewVerifier(vkey)
94 verifiers := note.VerifierList(verifier)
96 n, err := note.Open([]byte(msg), verifiers)
102 skey, vkey, err := note.GenerateKey(rand.Reader, "EnochRoot")
107 _ = vkey // give to verifiers
109 me, err := note.NewSigner(skey)
115 msg, err = note.Sign(n, me)
123 // If you think cryptography is the answer to your problem,
124 // then you don't know what your problem is.
126 // — PeterNeumann x08go/ZJkuBS9UG/SffcvIAQxVBtiFupLLr8pAcElZInNIuGUgYN1FFYC2pZSNXgKvqfqdngotpRZb6KE6RyyBwJnAM=
127 // — EnochRoot rwz+eBzmZa0SO3NbfRGzPCpDckykFXSdeX+MNtCOXm2/5n2tiOHp+vAF1aGrQ5ovTG01oOTGwnWLox33WWd1RvMc+QQ=