Commit fc8e77ca authored by Kyle Isom's avatar Kyle Isom Committed by Adam Langley

crypto/x509: Add certificate signature request (CSR) support.

This change adds support for parsing and serialisation of PKCS #10,
certificate signature requests.

LGTM=agl
R=golang-codereviews, agl
CC=agl, golang-codereviews, nick
https://golang.org/cl/49830048
parent eea28f67
......@@ -30,6 +30,13 @@ type AttributeTypeAndValue struct {
Value interface{}
}
// AttributeTypeAndValueSET represents a set of ASN.1 sequences of
// AttributeTypeAndValue sequences from RFC 2986 (PKCS #10).
type AttributeTypeAndValueSET struct {
Type asn1.ObjectIdentifier
Value [][]AttributeTypeAndValue `asn1:"set"`
}
// Extension represents the ASN.1 structure of the same name. See RFC
// 5280, section 4.2.
type Extension struct {
......
This diff is collapsed.
This diff is collapsed.
......@@ -23,6 +23,7 @@ import (
"fmt"
"math/big"
"reflect"
"strconv"
"time"
)
......@@ -197,6 +198,19 @@ func (oi ObjectIdentifier) Equal(other ObjectIdentifier) bool {
return true
}
func (oi ObjectIdentifier) String() string {
var s string
for i, v := range oi {
if i > 0 {
s += "."
}
s += strconv.Itoa(v)
}
return s
}
// parseObjectIdentifier parses an OBJECT IDENTIFIER from the given bytes and
// returns it. An object identifier is a sequence of variable length integers
// that are assigned in a hierarchy.
......
......@@ -232,6 +232,10 @@ func TestObjectIdentifier(t *testing.T) {
}
}
}
if s := ObjectIdentifier([]int{1, 2, 3, 4}).String(); s != "1.2.3.4" {
t.Errorf("bad ObjectIdentifier.String(). Got %s, want 1.2.3.4", s)
}
}
type timeTest struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment