cloudflare / cloudflare/cfssl

gencrl uses base10 instead of base16

Open
#979 0 comments 5 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hey there, I was trying to use this alongside `openssl` to generate a revocation certificate. Mostly because I didn't want to deal with openssl's config file. I noticed however that it was using base16 for displaying the certificate serial. OpenSSL outputs it in this manner:

```
Serial Number:
28:35:69:0a:72:61:0b:22:bc:17:5e:3d:7f:35:97:95:57:99:64:02
```

This means that even if you delete the colons you still are left an input that's not suitable for use with `gencrl`. I understand that base 10 `big.Int` is how the x509 library throws things around, but maybe for input there could be some detection for this format? Didn't want to make a PR because I have a feeling that there's a reason for this that I'm missing. Here's a diff that made things better for my one use case :p

```diff
diff --git a/crl/crl.go b/crl/crl.go
index b578a58..014537f 100644
--- a/crl/crl.go
+++ b/crl/crl.go
@@ -48,9 +48,10 @@ func NewCRLFromFile(serialList, issuerFile, keyFile []byte, expiryTime string) (
if len(strings.TrimSpace(value)) == 0 {
continue
}
+ value = strings.Replace(value, ":", "", -1)

tempBigInt := new(big.Int)
- tempBigInt.SetString(value, 10)
+ tempBigInt.SetString(value, 16)
tempCert := pkix.RevokedCertificate{
SerialNumber: tempBigInt,
RevocationTime: time.Now(),
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.