aboutsummaryrefslogtreecommitdiff
path: root/types.go
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-02-15 21:04:59 +0100
committerGibheer <gibheer@gmail.com>2015-02-15 21:04:59 +0100
commitf9164f3f99edf4ae8343d6c67b915e788a5624f8 (patch)
treec3a7029eeb1392bcb73d3bbedec837ff46652591 /types.go
initial commit for pki
pki is a small library to make building some of the crypto stuff easier in go.
Diffstat (limited to 'types.go')
-rw-r--r--types.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/types.go b/types.go
new file mode 100644
index 0000000..e9326ee
--- /dev/null
+++ b/types.go
@@ -0,0 +1,31 @@
+package pkilib
+
+import (
+ "crypto"
+)
+
+// this file holds all the interfaces used in the program until it can be split
+// properly
+
+type (
+ // interface for any private key
+ PrivateKey interface {
+ // derive a public key from the private key
+ Public() PublicKey
+ // sign a message with the private key
+ Sign(message []byte) ([]byte, error)
+
+ // return the private key structure
+ privateKey() crypto.PrivateKey
+ }
+
+ // interface for any public key
+ PublicKey interface {
+ // use the public key to verify a message against a signature
+ Verify(message []byte, signature []byte) (bool, error)
+ }
+
+ Pemmer interface {
+ MarshalPem() (marshalledPemBlock, error)
+ }
+)