func()

in toolkit/certificates/certoperator/cert_operator.go [78:91]


func (o *certOperatorImp) privateKeyToPem(ctx context.Context, privateKey *rsa.PrivateKey) ([]byte, error) {
	pemBlock := &pem.Block{
		Type:  "RSA PRIVATE KEY",
		Bytes: x509.MarshalPKCS1PrivateKey(privateKey),
	}
	pemBuffer := bytes.Buffer{}
	err := encodeFunc(&pemBuffer, pemBlock)
	if err != nil {
		log.MustGetLogger(ctx).Errorf(ctx, "pem encode() return error %s", err)
		return nil, err
	}

	return pemBuffer.Bytes(), nil
}