From b6c44317f540dac8763e720767b0e73940a0b6c5 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Fri, 12 May 2017 15:27:44 +0200 Subject: add proper pem interface This should finally resolve the completely broken and wrong API to get a pem representation of a resource. --- types.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'types.go') 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) + } ) -- cgit v1.2.3-70-g09d2