code: func ConvertToECPrivateKeyPEM(inPEM []byte) ([]byte, error) {
  	block, _ := pem.Decode(inPEM)
  	if block == nil {
  		return nil, errors.New("invalid pem bytes")
  	}
  
  	var pkey privateKeyInfo
  	if _, err := asn1.Unmarshal(block.Bytes, &pkey); err != nil {
  		return nil, errors.New("invalid pkcs8 key")
  	}
  
  	var ecPrivKey ecPrivateKey
  	if _, err := asn1.Unmarshal(pkey.PrivateKey, &ecPrivKey); err != nil {
  		return nil, errors.New("invalid private key")
  	}
  
  	ecPrivKey.NamedCurveOID = pkey.PrivateKeyAlgorithm[1]
  	key, err := asn1.Marshal(ecPrivKey)
  	if err != nil {
  		return nil, err
  	}
  
  	return pem.EncodeToMemory(&pem.Block{
  		Type:  "EC PRIVATE KEY",
  		Bytes: key,
  	}), nil
  }
docs: // ConvertToECPrivateKeyPEM takes an unencrypted PKCS#8 PEM and converts it to
  // EC Private Key