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 7058575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:07:44+00:00 2026-05-28T04:07:44+00:00

I would like to encrypt strings of 1500-2500 characters using an Asymmetric Key. It

  • 0

I would like to encrypt strings of 1500-2500 characters using an Asymmetric Key. It seems that RSA_2048 will only encrypt up to 245 characters.

On the MSDN Article about EncryptByAsymKey() is recommends “that you not encrypt large datasets using an asymmetric key. Instead, you should encrypt the data using a strong symmetric key and encrypt the symmetric key using an asymmetric key.”

Is there a way to do this without needing the Asymmetric Key password? or Am I going at this the wrong way?

Declare @plain varchar(max), @cipher varbinary(max);
Set @plain = 'Greg';

CREATE ASYMMETRIC KEY akey WITH ALGORITHM = RSA_2048 ENCRYPTION BY PASSWORD = '123pass!';

CREATE SYMMETRIC KEY skey WITH ALGORITHM = AES_256 ENCRYPTION BY ASYMMETRIC KEY akey;

OPEN SYMMETRIC KEY skey DECRYPTION BY ASYMMETRIC KEY akey WITH PASSWORD = '123pass!';

Set @cipher = ENCRYPTBYKEY(KEY_GUID('skey'), @plain);

... write @cipher to db ...

EDIT: I still need to be able to decrypt the data from another application. I want the public facing application on our web server to encrypt customer order information and write it to a database. Then only be able to decrypt it using another application running on a server physically located in the office.

  • 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-28T04:07:45+00:00Added an answer on May 28, 2026 at 4:07 am

    I’ll try and explain what you need to do to perform this, and leave the technical implementation for now:

    You would normally create a persistent (or semi persistent – keep it for a year or so) key pair once in the back end. The private key should already be in a safe spot at that time. Then you import the public key in the front end once.

    Once you receive the data you need to create session keys (e.g. random AES-128 keys) to encrypt the data with, encrypt the session with the imported public key. Encrypt the data with the session key and try to wipe the key from memory (try to keep it out of the swap, or protect the swap file). Store the encrypted data and wipe it from memory as well as you can. Now store the session key, encrypted with the public key together with the data.

    Once you need the data, then you need to retrieve the private key, decrypt the session key and subsequently decrypt the data. If you are only interested in keeping the data confidential, then you just need to encrypt it, e.g. using AES CBC.

    If you ‘push’ the data to be decrypted by the session key, or if you also want to verify the integrity of the data, you need also to add integrity protection (e.g. another session key to perform a MAC or HMAC with).

    The private key needs to be kept safe in the backend, possibly using a password, smartcard, HSM, offline USB stick, or even stringent access control, depending on your needs.

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

Sidebar

Related Questions

I would like to encrypt strings which could potentially only be about three or
I would like to perform some encryption on client using the asymmetric key stored
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to know if I could encrypt two or more strings in
I would like to encrypt and decrypt strings with a password. I use C#
I would like to encrypt a 10 Character (alpha-numeric only) string into a 16
I would like to encrypt and decrypt a password using 128 bit AES encryption
I would like to encrypt a string ( user's email ) and always obtain
I have a dictionary object which i would like to encrypt, then put it
Would like a for loop in jquery so that: For every hover_link: show hidden

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.