aboutsummaryrefslogtreecommitdiff
path: root/types.go
diff options
context:
space:
mode:
authorGibheer <gibheer+git@zero-knowledge.org>2017-05-12 15:27:44 +0200
committerGibheer <gibheer+git@zero-knowledge.org>2017-05-12 15:27:44 +0200
commitb6c44317f540dac8763e720767b0e73940a0b6c5 (patch)
treefac6e911056ba12da589dac4ad1f32aa63430f78 /types.go
parentfd88bca2872e589b451cde3767dbc59d82bd1c83 (diff)
add proper pem interface
This should finally resolve the completely broken and wrong API to get a pem representation of a resource.
Diffstat (limited to 'types.go')
-rw-r--r--types.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/types.go b/types.go
index 47fe31a..53db1a9 100644
--- a/types.go
+++ b/types.go
@@ -16,6 +16,7 @@ package pki
import (
"crypto"
+ "encoding/pem"
"io"
)
@@ -35,6 +36,9 @@ type (
// Return the original go structure of the private key.
PrivateKey() crypto.PrivateKey
+
+ // ToPem must return a pem block of the private key.
+ ToPem() (pem.Block, error)
}
// PublicKey is used by the different crypto implementations to provide the
@@ -52,4 +56,10 @@ type (
Pemmer interface {
MarshalPem() (io.WriterTo, error)
}
+
+ // ToPem returns the raw pem block to make it possible to write the result to
+ // any place.
+ PemOutput interface {
+ ToPem() (pem.Block, error)
+ }
)