Correctly part pem encoded blocks

This commit is contained in:
Melon 2022-03-13 15:23:00 +00:00
parent 80469dfbd1
commit 94e345d356
Signed by: melon
GPG Key ID: B0ADD5395BCDAAB6

View File

@ -59,12 +59,14 @@ func LoadCertGen(certBytes, keyBytes []byte) (*CertGen, error) {
return nil, err return nil, err
} }
leaf := TlsLeaf(&pair) leaf := TlsLeaf(&pair)
certBlock, _ := pem.Decode(certBytes)
keyBlock, _ := pem.Decode(keyBytes)
gen := &CertGen{ gen := &CertGen{
tlsCert: pair, tlsCert: pair,
cert: leaf, cert: leaf,
key: pair.PrivateKey, key: pair.PrivateKey,
certBytes: certBytes, certBytes: certBlock.Bytes,
keyBytes: keyBytes, keyBytes: keyBlock.Bytes,
} }
err = gen.generatePem() err = gen.generatePem()
if err != nil { if err != nil {