aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-03-15 20:06:47 +0100
committerGibheer <gibheer@gmail.com>2015-03-15 20:06:47 +0100
commit09a8380b7a4165bb4004f4d3efe87ac1fa151be9 (patch)
tree10d251d1932a954629e515363888ca318c2eccd3
parent4157d8e07abed02ff4b3dd5575e70252331b2d67 (diff)
first draft of a certificate system
-rw-r--r--certificate.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/certificate.go b/certificate.go
new file mode 100644
index 0000000..6537173
--- /dev/null
+++ b/certificate.go
@@ -0,0 +1,45 @@
+package pki
+
+import (
+// "crypto/x509/pkix"
+ "errors"
+ "net"
+)
+
+var (
+ ErrTypeMisMatch = errors.New("types mismatched")
+)
+
+type (
+ CertificateData struct {
+ // required fields
+ SerialNumber string
+ CommonName string
+
+ // alternative data
+ DNSNames []string
+ EmailAddresses []string
+ IPAddresses []net.IP
+
+ // address data
+ Country []string
+ Province []string
+ Locality []string
+ PostalCode []string
+ StreetAddress []string
+ Organization []string
+ OrganizationalUnit []string
+ }
+)
+
+// create a certificate sign request with the certificate data
+//func (c *CertificateData) CreateCertificateRequest(priv PrivateKey) (*Certificate, error) {
+// csr := x509.CertificateRequest{}
+// csr.Subject := c.createSubject()
+//}
+//
+//// create a pkix.Name for the subject of a cert or csr
+//func (c *CertificateData) createSubject() (pkix.Name) {
+// name := pkix.Name{}
+// errors := make([]error, 0)
+//}