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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:46:20+00:00 2026-06-01T23:46:20+00:00

When generating a symmetric key to encrypt a message, you create a byte array

  • 0

When generating a symmetric key to encrypt a message, you create a byte array in your process’s memory.

Next you instantiate a SymmetricAlgorithm such as AesCryptoServiceProvider. Then typically you set the key property to your in-memory key.

You then create an ICryptoTransform, typically by calling SymmetricAlgorithm.CreateEncryptor() or CreateDecryptor(). You can also skip setting the Key property above and pass the key and IV directly to CreateEncryptor(byte[], byte[]) or CreateDecryptor(byte[], byte[]).

  1. Is it safer to zero the byte array as soon as the ICryptoTransform is created to prevent rogue software reading it? While the byte array is in use generating cryptographic random data and initializing the transform, does pinning provide any security?

  2. If you set the SymmetricAlgorithm.Key property, is there an additional copy somewhere or just a pointer back to your secret byte array? Is it safer to dispose the SymmetricAlgorithm immediately after creating the transform?

  3. When the ICryptoTransform is created, I’m assuming there is an additional copy now in the RAM. So for the duration of the life of the ICryptoTransform object, is the key readable by rogue software? How about after disposal?

    In other words if I have a stream to which my software intermittently writes encrypted data, is it better to encrypt each little bit with a separate key and destroy/dispose everything I can in between to minimize the time during which the key could be stolen?

Someone may say that once there is rogue software on a computer, nothing is safe, therefore it’s useless to worry about it. I’d still rather take steps to minimize potential damage caused by an attacker gaining access to encryption keys for personal data.

  • 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-06-01T23:46:22+00:00Added an answer on June 1, 2026 at 11:46 pm
    1. No, it’s no safer.

    2. It doesn’t matter, and no, it’s no safer.

    3. Yes, it is readable by any software with the privileges to do so. After disposal it probably can’t be read, since Dispose() in .Net crypto generally zeros the memory.

    There have been many religious arguments about this, however I’ll just make the answer as clear as possible from a practical sense: if ‘rogue software’, ie malware, is running with the privileges to access the memory space of your decryption program, it can not only read the keys, but the data that you decrypt. Surely that’s more of an issue – since that’s what the key protects, after all. You’re not going to stop the user from viewing their own data, are you? So then you’re not adding any security.

    To put it another way, the tennets of computability are supplementing, not replacing, the rules of security on the host platform. The two add together, and both are needed for security. Without host security on the decrypting machine, you can’t have cryptographic security. Attempts to add it just add more complexity and increase the likelihood that you’ll introduce a real bug (although .NET does your memory management for you, so that’s less of an issue here).

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

Sidebar

Related Questions

In Java, I'm generating and serializing a symmetric key for encryption purposes: KeyGenerator keyGen
After generating a type dynamically and calling TypeBuilder.CreateType, I want to create a delegate
CREATE ASYMMETRIC KEY asymmetrickey FROM EXECUTABLE FILE = 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll' Why can't I use the
Generating subclasses for 2 Entities with the option Create NSManagedObject SubClass Xcode creates 4
When generating dynamic content, which way is better to simply create the HTML and
While generating charts using RS 2008 betas, RC0 and such., I never specified any
When generating public key and then reading it with function openssl_pkey_get_public - $publicKeyResource =
Generating normal columnar data in excel file is quite easy but does any one
Im generating a file to present to the user for download, but the server
when generating python wrappers with swig the python wrapper classes in the generated python

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.