Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions cmd/ceremony/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"io"
"math/big"
"slices"
"strconv"
"strings"
"time"
)

Expand Down Expand Up @@ -163,21 +161,6 @@ func (profile *certProfile) verifyProfile(ct certType) error {
return nil
}

func parseOID(oidStr string) (asn1.ObjectIdentifier, error) {
var oid asn1.ObjectIdentifier
for a := range strings.SplitSeq(oidStr, ".") {
i, err := strconv.Atoi(a)
if err != nil {
return nil, err
}
if i <= 0 {
return nil, errors.New("OID components must be >= 1")
}
oid = append(oid, i)
}
return oid, nil
}

var stringToKeyUsage = map[string]x509.KeyUsage{
"Digital Signature": x509.KeyUsageDigitalSignature,
"CRL Sign": x509.KeyUsageCRLSign,
Expand Down
13 changes: 0 additions & 13 deletions cmd/ceremony/cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"encoding/asn1"
"encoding/hex"
"errors"
"fmt"
Expand Down Expand Up @@ -39,18 +38,6 @@ func realRand(_ pkcs11.SessionHandle, length int) ([]byte, error) {
return r, err
}

func TestParseOID(t *testing.T) {
_, err := parseOID("")
test.AssertError(t, err, "parseOID accepted an empty OID")
_, err = parseOID("a.b.c")
test.AssertError(t, err, "parseOID accepted an OID containing non-ints")
_, err = parseOID("1.0.2")
test.AssertError(t, err, "parseOID accepted an OID containing zero")
oid, err := parseOID("1.2.3")
test.AssertNotError(t, err, "parseOID failed with a valid OID")
test.Assert(t, oid.Equal(asn1.ObjectIdentifier{1, 2, 3}), "parseOID returned incorrect OID")
}

func TestMakeSubject(t *testing.T) {
profile := &certProfile{
CommonName: "common name",
Expand Down