thanks.  this looks like the way to go.

      CryptoPP::StringSource pubStr(_pubString, true, new
CryptoPP::HexDecoder);
                CryptoPP::InvertibleRSAFunction pubKey;
                pubKey.BERDecodePublicKey(pubStr,true,_pubString.length());
        CryptoPP::RSAES_OAEP_SHA_Encryptor pub(pubKey);


On Feb 25, 4:33 pm, Jeffrey Walton <[email protected]> wrote:
> Hi John,
>
> It sounds like you have the public key (e and n). It appears the format is:
> +- SEQUENCE            // RSAPublicKey
>    +- INTEGER(N)       // N
>    +- INTEGER(E)       // E
>
> The outer sequence is 30820108. The integer 'n' (immediately following
> the outer sequence) begins with 02.
>
> I suspect your code should look similar to:
> CryptoPP::RSAES_OAEP_SHA_Encryptor pub;
> pub.BERDecodePublicKey(...);
>
> Jeff
>
> On 2/25/09, john <[email protected]> wrote:
>
>
>
> > Thanks to Geoff and Jeff for the pointers.
>
> > I used an online dumpasn (http://lapo.it/asn1js/)  to check whether
> > the public key is encoded correctly and it seems to be fine(it
> > contains two integers).
>
> > Any other ideas on what i should look for to solve this would be
> > greatly appreciated.
>
> > thanks,
> > john
>
> > PS. The sequence i posted originally was not accurate, here is the
> > whole sequence for the public key
> > 308201080282010100B566A0868FCEB4E2EA6CAB21942F1D089E48AA57692AB62C927EABFF1CBD2C724C8B74963C05F1CEB88DC0898301B7C85F727FE6AB907307430F3A4B1809FE706BD1364EF5774E4B75D49E403760FACD47DF743C16FDEDBF0B3EFBF243B5F205677AA4E0E22644113D9D666EC637ADB54E70965B1EC128396F35F99742633AD7E96566B07B977F924E515E2AC33710189E1F9600A905E06E3A0715DE7CE914E053D6223122AA7F675FF2D2E006ECA1D88DCD394CC2B9A68D9D2B49778AF5B9E51EB546FCC1535D5F8C93C38024CA6E58923CA6B0E6021CA3A9A6937511A228A46D8A94CA514986E8686C4BDA096E17BDC4F8FA19B7803413E51085B0E4840BB5020111
>
> > std:string pb("308201080282010100B566A0868FCEB4E2EA.....");
> > CryptoPP::StringSource pubStr(pb, true, new CryptoPP::HexDecoder);
> > CryptoPP::RSAES_OAEP_SHA_Encryptor pub(pubStr);
>
> [SNIP]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to