Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6112881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:47:43+00:00 2026-05-23T14:47:43+00:00

I know, according to this article that I should Sign the message, then Encrypt

  • 0

I know, according to this article that I should Sign the message, then Encrypt the message.

My program operates like so:

  • Get the bytes of the message
  • Digitally sign the message, and store the signature in a separate byte array
  • Encrypt the message
  • Send the signature, then the encrypted message in a packet

Should I do it like so?

  • Get the bytes of the message
  • Digitally sign the message, and concatenate it with the bytes of the message
  • Encrypt the array containing the message and signature
  • Send the encrypted data

Appreciate the assistance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:47:44+00:00Added an answer on May 23, 2026 at 2:47 pm

    Digitally sign the message, and concatenate it with the bytes of the message.

    You need to know where one ends and the other starts, but sure. Some APIs just take a key and a message and produce an output of bytes, and then instead of having a separate verify (data)->boolean step, they take a single bunch of bytes and either return the verified message or fail.

    So yes, you can send

    encrypt(
        concat(
            sign(message, signerPrivateKey), message),
            encryptionKey)
    

    To get a verified message, the receiver has to have received two keys ahead of time: the signers public key and the decrypt key which is the same as the encryptionKey for symmetric crypto and which must be a guarded secret.

    If you want to use asymmetric crypto so you only need to exchange public keys, and your message is not always shorter than a key, typically you generate a one-time use symmetric key and only encrypt that asymmetrically since asymmetric algos are typically more expensive than symmetric ones.

    oneTimeUseSymmetricCryptoKey := generateKey()
    concat(
        encryptAssymetric(
            oneTimeUseSymmetricCryptoKey,
            encrypterPrivateKey),
        encryptSymmetric(
            concat(sign(message, signerPrivateKey), message),
            oneTimeUseSymmetricCryptoKey))
    

    None of this though prevents the message forwarding attack described in the link above. To do that, you need to authenticate the sender, e.g. by choosing a public key to verify the signature AND a key to decrypt based on a sender address which is arrived at independently from the exchange of encrypted bytes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i know that you could organize your files according to this structure in svn:
According to this http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html article, I defnitely should. Quote Gentle, yet insistent executive summary:
According to this article: http://subsonicproject.com/docs/3.0_Migrations Bottom line: if you're a developer that is concerned
According to this article from Herb Sutter, one should always pick Class Specializing over
according to this code i dont understand about NSClassFromString how did i know viewControllerName
We all know that you can overload a function according to the parameters: int
I was reading this article today on two different regular expression algorithms. According to
According to this article on Access Tokens , a token contains several pieces of
Does anyone know, how to capture ping's return value in c++? According to this
I have a body of text like this: According to James, we do not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.