I am currently trying to create a secure key exchange between two parties. I have a good implementation of PGP that works well for my app, but my DH is really slow and doesn't work well; so I was thinking that maybe I could perform the key exchange with PGP.
My idea is this:
Party 1 -> public key -> Party 2
Party 2 -> public key -> Party 1
Party 1 generates random bits and sends them to party 2 with the public key
Party 2 generates random bits and sends them to party 1 with the public key
Shared key = Sha256(Party 1 random concatenated with Party 2 random)
Would this be secure? (assuming that the implementations of Sha256, PGP, and the random generator are to par.