openssl ssl encryption

后端 未结 4 527
情话喂你
情话喂你 2021-01-22 10:10

I want to discuss about openssl write and read method.
Assume I have an data structure like below:

/-----------------------------------------------------\\
|  my_         


        
4条回答
  •  囚心锁ツ
    2021-01-22 10:45

    When you use TLS/DTLS, you have the choice : you cipher the whole frame, or nothing at all.

    If you want to have some unciphered data in the frame, then you probably don't need TLS/DTLS. You might however use OpenSSL to compute a hash of your header (using SHA or any other related hash algorithm) and adding it at the end of the frame to avoid tampering.

    For the ciphered part of the frame, you'll have to choose between symetric and asymetric cipher algorithms. But without knowing what you want to achieve, I cannot really advise on this.

    Just keep in mind that symetric algorithms are usually faster but require a key exchange at first. To do so, you might use an asymetric algorithm, but then, you're reinventing TLS/DTLS ;)

提交回复
热议问题