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

  • Home
  • SEARCH
  • 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 481395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:59:24+00:00 2026-05-13T00:59:24+00:00

Signing an assembly in .NET involves a public/private key pair. As far as I

  • 0

Signing an assembly in .NET involves a public/private key pair. As far as I can tell from what I’ve read .NET uses the RSA algorithm and the private key to sign the assembly, checking it with the embedded public key.

I know how to retrieve the public key (Assembly.PublicKey). I was wondering, if that key could be used to decrypt a short string that contains some data encrypted with the private key.

The docs I’ve read so far (e.g.) seem to imply that only the other way round is possible: That I would have to use the public key to encrypt and the private key to decrypt – but I don’t really want to include that in the assembly, do I.

I guess it would be ok, if I just signed the string. But how?

I’m a bit at a loss how to start this. Does anybody have a code snippet?

Also, encrypting / signing of the small string would ideally happen in PHP, since I want to offload that to a web server and all we have so far is your generic PHP/MySQL hosted website.

Use Case: I’m trying to come up with a lightweight licensing scheme for a software we are about to release to beta testers. Since the software will probably be freeware, all we really want to achieve is

  1. know who has the software installed (email address)
  2. let the software expire after a given period, after which the user will have to get a new license
    • this is as easy as filling out a form and waiting for an automated email with the key to arrive
    • we are trying to reduce the likelyhood of old versions coming back to bite our reputation / haunt us

Being able to encrypt a tuple (expiry date, fingerprint) and decrypt that at startup would make an easy licensing module: The first time the application is started, the user is asked for email address, name, organisation. This information is posted to the webserver along with an md5 fingerprint of some system info (nic, computer name, assembly major and minor version). The webserver answers by email (checks validity of email address) with an encrypted version of the tuple (expiry date, fingerprint) that is then saved to disk. On startup, this can be decrypted and compared with current date and regenerated fingerprint.

EDIT: OK, so I don’t have all the answers to my question yet. But it looks like .NET won’t make it easy to use the private key for encryption (if that is at all possible, the answers don’t really agree on that).

The route I will take is this (based on my use case):

  • I will use the private key to sign the license.
  • I will use the public key to verify the license was signed by the private key
  • I will post another question aimed at PHP devs on how to use the .NET keys (produced by sn.exe) to sign some text
  • I am not really worried about the user seeing the license, as it is a hash anyway and computed from stuff he allready knows. All I want is to make it too hard to be worth any bother for your typical building architect to copy my software without me knowing (remember, the software will be freeware – all I want is a paper trail of who has it installed…)

Thank you very much for your answers.

  • 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-13T00:59:24+00:00Added an answer on May 13, 2026 at 12:59 am

    Not in .NET.

    In many traditional public-key encryption algorithm, like RSA, you can encrypt and decrypt both ways, typically one way is called “encryption” and the other “signing”, even though you actually end up with an encrypted version of something both ways.

    However, in .NET the RSA implementation has been crippled, and when signing will only produce digests of the input, not the full processed information.

    It seems there’s some disagreement about what can and cannot be done with RSA, so let me edit my answer to be more specific.

    I’m talking about RSA math, not any particular RSA implementation.

    RSA math allows you to encode information either of the two keys (private or public), and the encoded data can only be decoded with the other of the two keys.

    Typically, you encode with a public key, encrypting the information, and decode it with the private key, decrypting the information. Or, you take a hash of the information, encode it with the private key, signing the hash, and decode the hash with the public key, in order to compare and verify the signature.

    Typical implementations does not allow one to do full encoding of data from private to public, only by hashing the data, but the math behind RSA fully allows this.

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

Sidebar

Related Questions

I see tool like SN which generates private/public key pair for signing an assembly.
Related to my previous posts I'm moving to .NET 4. I've found that using
I am not a .NET developer, so there might be some basic things I
I am trying to use NAnt in order to compile and sign an assembly
So basically we have an strong-names (strongly signed) assembly x.dll which is used by
When buying a code-signing certificate, what are the merits of starting with a PKCS12
Client purchased a code-signing certificate, and it came with a .pvk file and a
The situation is as follows: I want to release the full source to a
I am about to deploy a ClickOnce application for internal use. I will be
I have been struggling for days trying to get a simple ActiveX DLL to

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.