aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer+git@zero-knowledge.org>2016-09-18 17:39:29 +0200
committerGibheer <gibheer+git@zero-knowledge.org>2016-09-18 17:39:29 +0200
commit2ad03c8f80e048138581229bab76c481292847b4 (patch)
treee858a94049f9eb673a626778dbefbb25658a40de
parentf004403281635b9c86f7c0289f5544be19e389a5 (diff)
move certificate and certificate request to pemmer
This makes them use the Pemmer interface and therefore doesn't require any weird control code to handle these two special cases.
-rw-r--r--certificate.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/certificate.go b/certificate.go
index 424d39a..b8849d2 100644
--- a/certificate.go
+++ b/certificate.go
@@ -6,6 +6,7 @@ import (
"crypto/x509/pkix"
"encoding/pem"
"fmt"
+ "io"
"math/big"
"net"
"time"
@@ -81,9 +82,9 @@ func LoadCertificateSignRequest(raw []byte) (*CertificateRequest, error) {
}
// Return the certificate sign request as a pem block.
-func (c *CertificateRequest) MarshalPem() (marshalledPemBlock, error) {
+func (c *CertificateRequest) MarshalPem() (io.WriterTo, error) {
block := &pem.Block{Type: PemLabelCertificateRequest, Bytes: c.Raw}
- return pem.EncodeToMemory(block), nil
+ return marshalledPemBlock(pem.EncodeToMemory(block)), nil
}
// Convert the certificate sign request to a certificate using the private key
@@ -152,7 +153,7 @@ func LoadCertificate(raw []byte) (*Certificate, error) {
// marshal the certificate to a pem block
func (c *Certificate) MarshalPem() (marshalledPemBlock, error) {
block := &pem.Block{Type: PemLabelCertificate, Bytes: c.Raw}
- return pem.EncodeToMemory(block), nil
+ return marshalledPemBlock(pem.EncodeToMemory(block)), nil
}
// Check if the certificate options have the required fields set.