diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 20:18:22 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 20:18:22 +0100 |
commit | 98ff8cc6de358bfa5f44375d0865671dba60aeb3 (patch) | |
tree | e91b886977cab0cf25cef283866cd683dce0306b /x509util/x509util.go | |
parent | d25bde66ff0a1a05e9576f0211aa4241e7c46cdc (diff) |
renamed ParseDerChainToList to ParseDerChain
The input need not be a chain: it could be any list of DER-encoded
certificates.
Diffstat (limited to 'x509util/x509util.go')
-rw-r--r-- | x509util/x509util.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/x509util/x509util.go b/x509util/x509util.go index c005bed..37688ad 100644 --- a/x509util/x509util.go +++ b/x509util/x509util.go @@ -112,7 +112,7 @@ func ParseChain(rest []byte) ([]*x509.Certificate, error) { // first (zero-index) string is interpretted as an end-entity certificate and // the remaining ones as the an intermediate CertPool. func ParseDerChain(chain [][]byte) (*x509.Certificate, *x509.CertPool, error) { - certificates, err := ParseDerChainToList(chain) + certificates, err := ParseDerList(chain) if err != nil || len(certificates) == 0 { return nil, nil, err } @@ -123,10 +123,10 @@ func ParseDerChain(chain [][]byte) (*x509.Certificate, *x509.CertPool, error) { return certificates[0], intermediatePool, nil } -// ParseDerChainToList parses a list of DER-encoded certificates -func ParseDerChainToList(chain [][]byte) ([]*x509.Certificate, error) { - ret := make([]*x509.Certificate, 0, len(chain)) - for _, der := range chain { +// ParseDerList parses a list of DER-encoded certificates +func ParseDerList(certificates [][]byte) ([]*x509.Certificate, error) { + ret := make([]*x509.Certificate, 0, len(certificates)) + for _, der := range certificates { c, err := x509.ParseCertificate(der) if err != nil { return nil, fmt.Errorf("certificate decoding failed: %v", err) |