From 52102b0f24b03be251efa863c3b7cd657f09d5d9 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 5 Mar 2015 21:37:52 +0100 Subject: finally add certificate sign request generation This adds finally a way to create certificate sign requests. There are still some options missing, but it is coming together. With the next step, the ccertificate data container will probably be put into the pki library. --- certificate_data.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 certificate_data.go (limited to 'certificate_data.go') diff --git a/certificate_data.go b/certificate_data.go new file mode 100644 index 0000000..76f3323 --- /dev/null +++ b/certificate_data.go @@ -0,0 +1,28 @@ +package main + +import ( + "crypto/x509" + "crypto/x509/pkix" + "net" +) + +type ( + certificateData struct { + Subject pkix.Name + + DnsNames []string + EmailAddresses []string + IpAddresses []net.IP + } +) + +func (c *certificateData) GenerateCSR() *x509.CertificateRequest { + csr := &x509.CertificateRequest{} + + csr.Subject = c.Subject + csr.DNSNames = c.DnsNames + csr.IPAddresses = c.IpAddresses + csr.EmailAddresses = c.EmailAddresses + + return csr +} -- cgit v1.2.3-70-g09d2