Re: RSA Encrypt/Decrypt Problems

From: Cantelmo Software (info_at_cantelmosoftware.com)
Date: 03/19/05


Date: Sat, 19 Mar 2005 01:55:01 +0100

in kind, for who it does not have much practical one of encryption, it can
use RSA in order to crypt KEY and IV of an algorithm to symmetrical key DES,
3DES, etc. in this way you resolve the problems of 127 the greater blocks of
byte

good job,
Marcello

"Cantelmo Software" <info@cantelmosoftware.com> ha scritto nel messaggio
news:OSrikyBLFHA.3928@TK2MSFTNGP09.phx.gbl...
> Hi Joseph,
> as I have already suggested (in second message) to you uses "default"
> instead of "unicode" also in phase of decrypt!
>
> attention! since it is possible to gain the public key from that private
> key, I in my programs encrypt with the private key and decrypt with the
> public key. :-o
>
> in this way even if someone crack my program cannot sign of new the
> keys...why it does not know that private key! ;-)
>
> HTH
> Marcello
> www.cantelmosoftware.com
>
> p.s.: sorry for my bad english. i'm italian
>
> "Joseph MCAD" <JosephMCAD@discussions.microsoft.com> ha scritto nel
> messaggio news:5E4D3B47-B809-43A3-A8AC-D7E461BB5E61@microsoft.com...
>>
>> March 18, 2005
>>
>> Thanks! I have looked for a very long time for those byte length
>> numbers! One problem though. :( If I am right,
>> Encoding.Unicode.Getbytes()
>> converts each character to two bytes. That means that I cannot evenly
>> feed
>> the bytes to RSA without splitting characters. Will this be a problem,
>> and am
>> I right that .GetBytes() converts chars to two bytes? Also do you know of
>> a
>> way to split the UnEncrypted() byte array into blocks of 127? Right now,
>> I
>> have tried to input the message into a stringreader and then read back
>> blocks
>> of 50 chars at a time. I then convert the block of chars to bytes and
>> feed
>> the block of bytes to the encryptor. This works, but I for some reason
>> cannot
>> decrypt it. (I just realized that I encrypted using the private key and
>> then
>> decrypted using the private key. Do I have to create another rsa object
>> with
>> JUST the public key, or can I decrypt using the same RSA since it has
>> both
>> the private and public key?) I guess I am just really confused and I
>> Really
>> Appreciate your help!
>>
>>
>> Joseph MCAD
>>
>>
>>
>> "Cantelmo Software" wrote:
>>
>>> Hi Joseph MCAD,
>>> the size limit is: 128-11=117 bytes for PKCS#1 v 1.5 padding. output is
>>> always 128 byte
>>>
>>> other details:
>>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemSecurityCryptographyRSACryptoServiceProviderClassEncryptTopic.asp
>>>
>>> HTH
>>> Marcello
>>> www.cantelmosoftware.com
>>>
>>> try my Goliath.NET obfuscator (pre-release version) & send me your
>>> opinion
>>> ;-)
>>> http://xoomer.virgilio.it/cantelmosoftware/net/TryMe.zip
>>>
>>>
>>> "Joseph MCAD" <JosephMCAD@discussions.microsoft.com> ha scritto nel
>>> messaggio news:4CD6D9DF-D97A-444C-81D5-7FD2C57FFD21@microsoft.com...
>>> >
>>> > March 18, 2005
>>> >
>>> > I am trying to encrypt messages typed in a textbox by encrypting
>>> > them
>>> > using RSACryptoServiceProvider. If the text is shorter than about 1/2
>>> > a
>>> > sentence, then it works fine. If it is longer, say: "This is my
>>> > message.
>>> > It
>>> > is not very long, however.", then RSA.Encrypt(MessageBytes, False)
>>> > fails
>>> > with
>>> > "Bad Length". I know that RSA is usually used for encrypting small
>>> > amounts
>>> > of
>>> > data, such as symmetric keys, but all the examples I have seen haven't
>>> > mention this. Even Microsoft's Training Kit for their Microsoft
>>> > Certified
>>> > Professional Exam 70-330 (Implementing Application Security) asks you
>>> > to
>>> > build a program that encrypts entire files using RSA. Can anyone
>>> > provide a
>>> > definite answer as to whether I can use RSA for what I am doing?
>>> > Thanks a
>>> > lot
>>> > for any response, as I have worked about 10 hours on this!
>>> >
>>> > dim message as string = "A longer string than an encryption
>>> > key.......MessageText"
>>> > dim unencryptedbytes() as byte = encoding.unicode.getbytes(message)
>>> > dim RSA as new RSACryptoServiceProvider()
>>> > RSA.FromXMLString(MyPrivateKey)
>>> > dim encrypted() as byte = rsa.encrypt(unencryptedbytes, false) 'Errors
>>> > here
>>> >
>>> >
>>> > Joseph MCAD
>>> >
>>> >
>>>
>>>
>>>
>
>



Relevant Pages

  • Re: CryptAPI(encryption/decryption)
    ... It seems like you're missing the Base64 decode step when trying to decrypt ... I misspelled the Private Key as Primary Key. ... Is there any variation in the encryption format in openssl compared to ... "Dylan DSilva " wrote: ...
    (microsoft.public.pocketpc.developer)
  • Re: RSA breaking vs. factoring
    ... affects the two possible usages of RSA both for encryption (first public, ... then private key) and for signing ... are identical to encryption, in reverse order. ... Digital signature generation takes an input message (which may be quite ...
    (sci.crypt)
  • Re: CryptAPI(encryption/decryption)
    ... The openssl encrypted data format is in bigendian ... Is there any way I can import the PEM formated private key to the MS CSP ... I'm decoding the base64 encoded data before trying to decrypt. ... Is there any variation in the encryption format in openssl compared ...
    (microsoft.public.pocketpc.developer)
  • Re: CryptAPI(encryption/decryption)
    ... since symmetric encryption is faster than public key encryption. ... As per your reply I could get the handle of the private key. ... possible for B to decrypt the data using his Private Key. ... The PFX format encrypts the private key with the user supplied password ...
    (microsoft.public.pocketpc.developer)
  • Re: Certificates
    ... RSA encryption. ... I wrote that the RSA digital signature _algorithm_ superficially ... looks like a RSA encryption _algorithm_. ... reason why you talk about "encrypting with the private key" and I point ...
    (sci.crypt)