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:
- It must use RSA 2048
- 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:
- p1 is the xml-encoded public/exponent values
- p2 is hashed unique user id (in my case the project is using sha1)
- bp3 is the pretty serial number
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?
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.