aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/crypto/openpgp/write_test.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2011-02-24 20:19:53 -0500
committerAdam Langley <agl@golang.org>2011-02-24 20:19:53 -0500
commit6ca009f58d0d183360cb05cbca71227a712dae53 (patch)
treea0813f480df225555156c7192ff1ee1056ef743b /src/pkg/crypto/openpgp/write_test.go
parent27ccb41c4a12e10055e6654a4b26c35040bef98c (diff)
downloadgo-6ca009f58d0d183360cb05cbca71227a712dae53.tar.xz
crypto/openpgp: add package
R=bradfitzgo CC=golang-dev https://golang.org/cl/3989052
Diffstat (limited to 'src/pkg/crypto/openpgp/write_test.go')
-rw-r--r--src/pkg/crypto/openpgp/write_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pkg/crypto/openpgp/write_test.go b/src/pkg/crypto/openpgp/write_test.go
new file mode 100644
index 0000000000..33e8809f22
--- /dev/null
+++ b/src/pkg/crypto/openpgp/write_test.go
@@ -0,0 +1,34 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package openpgp
+
+import (
+ "bytes"
+ "testing"
+)
+
+func TestSignDetached(t *testing.T) {
+ kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
+ out := bytes.NewBuffer(nil)
+ message := bytes.NewBufferString(signedInput)
+ err := DetachSign(out, kring[0], message)
+ if err != nil {
+ t.Error(err)
+ }
+
+ testDetachedSignature(t, kring, out, signedInput, "check")
+}
+
+func TestSignTextDetached(t *testing.T) {
+ kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
+ out := bytes.NewBuffer(nil)
+ message := bytes.NewBufferString(signedInput)
+ err := DetachSignText(out, kring[0], message)
+ if err != nil {
+ t.Error(err)
+ }
+
+ testDetachedSignature(t, kring, out, signedInput, "check")
+}