Anonymous
Anonymous

Reputation: 786

.NET RSA Sign/Verify Data Licensing Keys

Guys i was given a project (server-side c# sn generator) for whom i have to implement basic licensing system (its more of a test than actual project), however there are requirements:

  1. It must use RSA 2048
  2. It must product human-friendly 16 chars (0-F), separated by 3 dashes (19 symbols in total)

Also the client part is verifying the serial number like this:

VerifyMyKey(p1, p2, p3);

Where:

Are there any examples for SignData producing number like:

1111-1111-1111-1111

or something like that, because all i get now is base64 encoded string that is working, but its not human-friendly.

Does anyone have any ideas?

Upvotes: 0

Views: 692

Answers (1)

Seva Alekseyev
Seva Alekseyev

Reputation: 61331

You mean the signature should be exactly 16 bytes long? That's not possible with 2048 bit RSA. By definition, the length of one cyphertext block (including a digital signature) is the same as the key size, which is 2048 bits = 256 bytes. RSA works with blocks, it's not a stream cypher. Anything less won't decrypt/verify correctly.

If you want your output be of arbitrary length but consist of 16 hex digits, that's another matter. RSA outputs data as byte arrays, feel free to represent them as hex digits - two digits per byte. A 2048 bit binary data block would be 512 hex digits long.

Upvotes: 2

Related Questions