Can I use the same key pair for authentication and Diffie-Hellman? Assume Alice has a key pair $(A, a)$ and Bob has a key pair $(B, b)$, where $A = Ga$ and $B = Gb$. In general, the basic rule of crypto says that we should not use the same key for different operations, like in signing and encryption, but I wonder whether in my use case it would be actually possible to use it. Below, I describe the simplified version of my use case.
So Alice and Bob are communicating over an anonymous network, like for example Tor. Also, Alice and Bob from time to time publish (independently of course) some data signed with their private keys.
Alice doesn't know Bob, and Bob doesn't know Alice. They only are aware of their advertised identity keys A and B. Alice when sending the message $m$ to Bob uses Diffie Hellman to derive a shared key. First, for each new message, she generates a new ephemeral key $x$ and computes the key shared with Bob as $k = KDF(B^x)$ (alternatively, maybe she could first apply some Hash function on B, i.e., h = H(B) and compute $k = KDF(h^x)$, not sure? ). Next, Alice encrypts $m$ as $c = AES_k(m)$. She concatenates $g^x$ and $c$ as $v = g^x || c$ and sends it to Bob.
So, in my use case, Alice doesn't reveal any information about herself due to the freshly generated ephemeral key and the anonymous channel (which I assume is secure). She doesn't learn anything about Bob others done his identity public key $B$. Also, as long as Bob's secret key is kept safely no one should be able to decrypt the content of $c$ except for Alice and Bob, which is crucial.
So, is there anything that can go wrong here? If for example Bob published let's say a document signed with his private key $b$, does this allow anyone to infer any information about $m$? In general, my question is whether I'm missing any attack which might compromise the confidentiality of the communication between Alice and Bob? Many thanks in advance!
While it's technically not (probably) an issue, you should definitely avoid sharing keys between different purposes. RSA uses separate keys for signing and encryption, for example, since an encrypted-and-signed message would cancel out. RSA only signs a hash of the original message, negating this issue, but it still avoids sharing keys because it's simply better not to use the same keys for different purposes.