|
Post by gadapchetvoi on Jan 8, 2014 0:28:53 GMT -5
Please view my code and suggest me with some advices please:
Dim Provider As New RSACryptoServiceProvider Provider.PersistKeyInCsp = True Provider.KeySize = 2048 MsgBox Provider.KeySize '-- this show me 1024 instead of 2048 !
Provider.FromXmlString "<RSAKeyValue><Modulus>2Y3tUbiHNGU0JhcPXrzrG63uQEQRC76QIfc1SIHph6ULRAr9A/CFGmAPWncQnX8Oy+JIeoQpys6VHVTMiAGSZiSR4hi3aTzzeTQ0HQOylI31l1plxp5oh9e2n1dDZCZIdjFxAGckLG53fAVj++NF+0gxXpiOhVZ42x/CQBPSLTgjnCEoIXc25V2n1Rm67Iam15WFgmHykaN2OtOr5oEfYVUTmFoKiKIHYfEjvYp46v8LY8zRhUWb0oVRrlAsazdzC4D0PzDJNQI9ifXmr8SLvWOnDzDt3BkBjZ3LFBuD3GiGkxoQOayixPIYD5Z4LMKxbfCi23OzA8at6wsH0qbgMw==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>" Dim Encrypted() As Byte Data = StrConv("1234567890abcdef1234567890abcdef1234567890abcdef", vbFromUnicode)
Encrypted = Provider.EncryptValue(Data)
I've tested this code successfully with a 1024-bit Public Key, but in this version, 2048 bit Public Key, the program gave me error "More data is available".
Please help ! Thanks for all suggestions !
|
|
|
Post by Kelly Ethridge on Jan 8, 2014 12:47:09 GMT -5
Hello,
Setting the KeySize property indeed does nothing. It was mimicking the original interface back when this was written.
The key size must be set through the constructor.
Dim r As RSACryptoServiceProvider Set r = Cor.NewRSACryptoServiceProvider(2048) r.PersistKeyInCsp = True
Kelly
|
|
|
Post by gadapchetvoi on Jan 8, 2014 20:52:26 GMT -5
Thank you very much! You saved my life ! My works' been stucked in this place for about 7 days. Great library for VB6 users !
|
|