started with the following logic,
(based on: RSA key part is common for TLS and PGP)
tlsCert, err := tls.LoadX509KeyPair(certFilePath, keyFilePath)
if err != nil {
return
}
certx509, _ := ioutil.ReadFile(certFilePath)
block, _ := pem.Decode([]byte(certx509))
certTest, err := x509.ParseCertificate(block.Bytes)
if err != nil {
return
}
privateKeyTest := tlsCert.PrivateKey
config = &packet.Config{}
config.DefaultCompressionAlgo = 1
config.DefaultCipher = 9
config.DefaultHash = 3
entity, _ = openpgp.NewEntity("", "", "", config)
entity.PrimaryKey.PublicKey = (certTest.PublicKey).(*rsa.PublicKey)
entity.PrivateKey.PrivateKey = privateKeyTest.(*rsa.PrivateKey)
entitylist := make(openpgp.EntityList, 1)
entitylist[0] = entity
md, err := openpgp.ReadMessage(encryptedmessagebytes, entitylist , nil, config)
openpgp.ReadMessage returns the following error
openpgp: invalid data: tag byte does not have MSB set
I think I'm missing something while creating the entity. Can you please help me with this?