Change the PEM block type to use the constant

This commit is contained in:
Jacob Simpson 2017-03-09 16:48:11 -08:00
parent 5e442a3f61
commit 515987db3f
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ func MakeCSRFromTemplate(privateKey interface{}, template *x509.CertificateReque
} }
csrPemBlock := &pem.Block{ csrPemBlock := &pem.Block{
Type: "CERTIFICATE REQUEST", Type: CertificateRequestBlockType,
Bytes: csrDER, Bytes: csrDER,
} }

View File

@ -52,7 +52,7 @@ func TestMakeCSR(t *testing.T) {
if len(rest) != 0 { if len(rest) != 0 {
t.Error("Found more than one PEM encoded block in the result.") t.Error("Found more than one PEM encoded block in the result.")
} }
if csrBlock.Type != "CERTIFICATE REQUEST" { if csrBlock.Type != CertificateRequestBlockType {
t.Errorf("Found block type %q, wanted 'CERTIFICATE REQUEST'", csrBlock.Type) t.Errorf("Found block type %q, wanted 'CERTIFICATE REQUEST'", csrBlock.Type)
} }
csr, err := x509.ParseCertificateRequest(csrBlock.Bytes) csr, err := x509.ParseCertificateRequest(csrBlock.Bytes)