Suppose I have a secure channel between client and server, with proper certificate validation etc (actually, ssh session).

I want to establish a secure connection between my own application on a server and client, but don't want to implement TLS, or some sort of certificate validation, or send my data through SSH tunnel.

Is it enough to generate a strong random key, send it through ssh session, and simply use that key for symmetric encryption, say, AES?

Edit. Realized my question was not clear enough. Real question should look like so:

If I have a pre-shared one-time key, is it worth to use TLS? What problems can I encounter with my own implementation using strong symmetric encryption, like AES?

  • If you already have an SSH session, you already have a secure connection. What's the actual problem here?
    – Natanael
    Commented Mar 26, 2016 at 22:56
  • @Natanael, let's say I can't send more than X bytes over SSH, which is enough for key, but not enough for actual data.
    – deniss
    Commented Mar 26, 2016 at 23:10
  • why not make that data a public key and/or a shared secret used later to authenticate a key exchange for a new separate session using TLS or SSH?
    – Natanael
    Commented Mar 26, 2016 at 23:22
  • Without more details, your question basically seems to be if (some kind of) private key crypto is generally secure as long as the key is not leaked. This question would be rather broad, some more details would be helpful.
    – tim
    Commented Mar 26, 2016 at 23:31
  • @tim, sorry for asking unclear question. Actually, I got the answer I needed. I'll edit my question to better reflect my intentions.
    – deniss
    Commented Mar 26, 2016 at 23:37

1 Answer 1


Basically, no.

You haven't even gone half way towards describing your system. Will you be using a stream cipher or a block cipher? How will you authenticate this traffic? How will you protect it from replay attacks, bit flipping attacks, timing attacks and so on?

Once you've fixed all the vulnerabilities in your system, I think you'll find that it resembles TLS anyway. Except you will probably have missed a few things along the way. You'll end up putting a lot of effort into making a flawed implementation of something that you can already have for free.

Using TLS from the outset would seem to be the sensible thing to do here.

  • 1
    +1 "Don't roll your own crypto". And if you really can't use TLS, use something else. There's just no reason to roll your own. Commented Mar 27, 2016 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .