pkg/util/pki: fix dropped errors

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
Lars Lehtonen 2020-09-03 19:32:24 -07:00
parent 41ff2ef053
commit ae8afe2257
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
2 changed files with 7 additions and 0 deletions

View File

@ -203,6 +203,10 @@ func GenerateCSR(crt *v1.Certificate) (*x509.CertificateRequest, error) {
}
ku, ekus, err := BuildKeyUsages(crt.Spec.Usages, crt.Spec.IsCA)
if err != nil {
return nil, fmt.Errorf("failed to build key usages: %w", err)
}
usage, err := buildASN1KeyUsageRequest(ku)
if err != nil {
return nil, fmt.Errorf("failed to asn1 encode usages: %w", err)

View File

@ -375,6 +375,9 @@ func TestRemoveDuplicates(t *testing.T) {
func TestGenerateCSR(t *testing.T) {
// 0xa0 = DigitalSignature and Encipherment usage
asn1KeyUsage, err := asn1.Marshal(asn1.BitString{Bytes: []byte{0xa0}, BitLength: asn1BitLength([]byte{0xa0})})
if err != nil {
t.Fatal(err)
}
asn1ExtKeyUsage, err := asn1.Marshal([]asn1.ObjectIdentifier{})
if err != nil {
t.Fatal(err)