code: func ParseCSR(in []byte) (csr *x509.CertificateRequest, rest []byte, err error) {
  	in = bytes.TrimSpace(in)
  	p, rest := pem.Decode(in)
  	if p != nil {
  		if p.Type != "NEW CERTIFICATE REQUEST" && p.Type != "CERTIFICATE REQUEST" {
  			return nil, rest, cferr.New(cferr.CSRError, cferr.BadRequest)
  		}
  
  		csr, err = x509.ParseCertificateRequest(p.Bytes)
  	} else {
  		csr, err = x509.ParseCertificateRequest(in)
  	}
  
  	if err != nil {
  		return nil, rest, err
  	}
  
  	err = csr.CheckSignature()
  	if err != nil {
  		return nil, rest, err
  	}
  
  	return csr, rest, nil
  }
docs: // ParseCSR parses a PEM- or DER-encoded PKCS #10 certificate signing request.