CryptoSys PKI Toolkit Manual

RSA2 Signing

The RSA2 method of signing is described in ANSI X9.31 and IEEE P1363. It is also known as the Rabin method. We only offer the variant for an odd exponent. The method saves one bit in output compared to the PKCS#1v.15 method - even a whole byte if the key is say, 1025 bits. Yes!

For an input message representative, f, with private key (n,d) and f < n, the output signature, s, is the minimum of fd mod n and n - (fd mod n). The last nibble of the message representative must be either 0x6 or 0xC (12) depending on the scheme, i.e. f ≡ 6 (mod 16) or f ≡ 12 (mod 16).

' Sign block with RSA private key to create signature
' -- use special ISO9796/X9.31/P1363 RSA2 method with magic value 0x6
r = RSA_RawPrivate(abBlock(0), blen, strPrivateKey, &H6)
Debug.Print "RSA_RawPrivate returns " & r & " (expecting 0)"
If (r <> 0) Then Exit Function
' Convert to hex encoding
strHexSig = cnvHexStrFromBytes(abBlock)

In C# and VB.NET/VB200x, use the Rsa.RawPrivate and Rsa.RawPublic methods respectively to sign and verify the encoded block. Use the overload with the specialist option to pass the value of the "magic nibble".

// Sign block with RSA private key
// -- use special RSA2 method with magic nibble value 6
b = Rsa.RawPrivate(b, keyStr, 0x6);
// Convert to hex encoding
s = Cnv.ToHex(b);

[Contents] [Index]

[HOME]   [NEXT: CMS Content Types...]

Copyright © 2004-14 D.I. Management Services Pty Ltd. All rights reserved.