diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-05-01 19:36:40 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-05-01 19:36:40 +0400 |
commit | a4bc7e162c37039dd4592359ee823db012a6146e (patch) | |
tree | 29cd9e33f2c49970629801c014cc5517ee7180c3 /mcs/class/Mono.Security | |
parent | 1b298ca6d114bab3b117d64b0e096f14aeb7acea (diff) |
2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
* CryptoConvertTest.cs: Added test case where a strongname key pair
(RSA 1024 bits) was truncated in the last parameter (D) (i.e. the
private key) but saved by the use of CRT (Chinese Remainder Theorem).
svn path=/trunk/mcs/; revision=26508
Diffstat (limited to 'mcs/class/Mono.Security')
-rw-r--r-- | mcs/class/Mono.Security/Test/Mono.Security.Cryptography/ChangeLog | 6 | ||||
-rwxr-xr-x | mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs | 56 |
2 files changed, 62 insertions, 0 deletions
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/ChangeLog index cf21306bf7f..cda87ac5e8c 100644 --- a/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/ChangeLog +++ b/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/ChangeLog @@ -1,3 +1,9 @@ +2004-05-01 Sebastien Pouliot <sebastien@ximian.com> + + * CryptoConvertTest.cs: Added test case where a strongname key pair + (RSA 1024 bits) was truncated in the last parameter (D) (i.e. the + private key) but saved by the use of CRT (Chinese Remainder Theorem). + 2004-03-23 Sebastien Pouliot <sebastien@ximian.com> * CryptoConvertTest.cs: Added test case where the public key structure diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs index 0f1eab90444..eac11613622 100755 --- a/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs +++ b/mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs @@ -115,6 +115,49 @@ namespace MonoTests.Mono.Security.Cryptography { static string strongNamePublicKeyString = "<RSAKeyValue><Modulus>4BJuBsSD00ITyjZPp/wnTeCGa8s0o8/bq8mnSJNJgC1Ey5dhgXykESWP1ynEq2wmSeuxNk1qGi4DvszoQ7YTicQwJQDb/bkIjYF1+uS3mDIHYpnzwYUrchY0HclBk5DFPcSSWnKCpWTnT/VITARpPQ0wuxGRhpCGPNgzKErqfH8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"; + static byte[] strongNameNUnit = { + 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32, + 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xCF, 0x4A, 0x0B, 0xBF, + 0x35, 0x4B, 0x6D, 0x8D, 0x0C, 0x39, 0xE7, 0xBC, 0x40, 0xDD, 0x0B, 0xE1, + 0x6A, 0x32, 0xBA, 0x9D, 0x76, 0x3E, 0x8D, 0x04, 0xFD, 0x95, 0x91, 0xB9, + 0x2D, 0x72, 0x69, 0xDD, 0x09, 0xC2, 0xC6, 0x5E, 0xC7, 0x56, 0x3C, 0xE3, + 0x93, 0xAC, 0xA7, 0x19, 0x13, 0xBE, 0xA1, 0x3D, 0xD6, 0xA2, 0x0D, 0x67, + 0x6E, 0xD7, 0xDD, 0xC7, 0x26, 0xF8, 0x46, 0xFC, 0xE6, 0x68, 0x00, 0xBB, + 0x03, 0x49, 0x03, 0x61, 0x9A, 0x1B, 0xAA, 0x52, 0x0F, 0x5F, 0x75, 0x89, + 0x46, 0xCF, 0x2B, 0x4A, 0xF6, 0xBA, 0x7C, 0x31, 0x0D, 0x02, 0xD0, 0x92, + 0xA5, 0xCF, 0x51, 0xBE, 0x6D, 0x52, 0xE8, 0x86, 0x33, 0xF5, 0x02, 0x47, + 0x4B, 0x4F, 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6A, 0xFD, 0x87, 0x01, 0xD2, 0x34, 0x0C, 0xEC }; + [Test] public void FromCapiKeyBlob () { @@ -299,5 +342,18 @@ namespace MonoTests.Mono.Security.Cryptography { byte[] data = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; AssertEquals ("0123456789abcdef", "0123456789ABCDEF", CryptoConvert.ToHex (data)); } + + [Test] + public void NUnitKey_Broken () + { + // for some strange reason nunit.snk hasn't the same + // size as other strongname. I wonder how it was + // generated ? + RSA rsa = CryptoConvert.FromCapiKeyBlob (strongNameNUnit, 0); + // note the bad D parameters !!! + // this only works because CRT is being used + AssertEquals ("KeyPair", "<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent><P>2d4pGForvc792ztFxhNuzxIihDnXp+qK9F8t/NduhRBdu+JXK4d8a9EGwzpMxLUPlHjCZfXRraZiSQszkH+nzQ==</P><Q>yj9BeGmOrucOUCNZYTtXI0ykzz+1g+cVMSxi+6xzoLEOqmdE4gjcWaxak4MF1+pIR6UycnNa/jg1LBl7MKxpCw==</Q><DP>cMkAjznG4Sjx4/dIRKU0vP/PXJIxIR1bN+y5+uVvsnTpgWVH6SHneE0qahCZQ0/UM/Fb+bqLBJFY2iVxWUGslQ==</DP><DQ>gz6TXPGbLzMv3Z9i5C8e+ABHv1pHj6ZI4VU9kraxfmkH7FsBn3FClUq8qJdRFnGpoBy65Pyo4upUzx5mDAsGSw==</DQ><InverseQ>x+UShV+0d9cicoiB9fkSLqpLDyF4dYzVu0uqX0eCcoGJpk19jtSaMI3Eo8VN6MJAW1zrRy+MA1Fqb9qeThLqZQ==</InverseQ><D>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</D></RSAKeyValue>", rsa.ToXmlString (true)); + AssertEquals ("PublicKey", "<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>", rsa.ToXmlString (false)); + } } } |