[Mono-list] How to set parameters for RSACryptoServiceProvide r

Goran Milenkovic GMilenkovic@mindport.com
Wed, 5 Nov 2003 08:54:29 +0100


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C3A372.0AC4A740
Content-Type: text/plain

Yes, I was talking about MS Framework, sorry.
Thanks very much for your help and support.
 
Best regards !
 
 -----Original Message-----
From: Sebastien Pouliot [mailto:spouliot@videotron.ca] 
Sent: Wednesday, November 05, 2003 2:18 AM
To: Goran Milenkovic; Mono-list@lists.ximian.com
Subject: RE: [Mono-list] How to set parameters for RSACryptoServiceProvider



Goran,
 
Are you having this problem with Mono or the MS framework ?
 
I ask because right now my mono setup doesn't work :-( but I'm able to
duplicate the bug on the MS framework (anyway your VB code can only work
under Windows and IIRC the exception message "Bad Key" is only shown in
Windows).
 
Anyway at first look it seems that MS requires the full parameters for
importing a private key - with no (known) good reason. This isn't (supposed
to be) the case for Mono - you can have a look at
/mcs/class/corlib/Mono.Security/RSAManaged.cs. Please fill a bug into
bugzilla if this doesn't work on Mono
(http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries
<http://bugzilla.ximian.com/enter_bug.cgi?product=Mono%2FClass%20Libraries>
).
 
As for solution for the MS framework:
 
a.    Report the bug to Microsoft (this is a long term solution but if you
don't complain it won't get fixed);
b.    Keep all exported parameters for the private key (easy solution,
faster decryption but requires extra space);
c.    Recalculate the other parameters (time consuming);
d.    Use Mono's RSAManaged implementation (on both Windows and Mono's)
 

Sebastien Pouliot
Security Architect, Motus Technologies, http://www.motus.com
<http://www.motus.com/> 
work: spouliot@motus.com
home: spouliot@videotron.ca
blog: http://pages.infinit.net/ctech/poupou.html
<http://pages.infinit.net/ctech/poupou.html> 
  

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com]On Behalf Of Goran Milenkovic
Sent: 3 novembre 2003 08:56
To: 'Mono-list@lists.ximian.com'
Subject: [Mono-list] How to set parameters for RSACryptoServiceProvider


The following VB.NET example should generate the new key pair, store
generated values localy, then encrypt the test string using public key and
decrypt it using private key. However, it works only if all parameters
(P,Q,DP,DQ,InverseQ & D) are given for the decryption, but not if only D is
given. That means that for simple decryption private key is not enough, but
also all of the other parameters ?? 

If you change boolean value OnlyD to True, assuming that only D should be
enough for decryption, then it works. Otherwise, an exception occurs ("Bad
Key"). Is there any solution for this ?

 

'-----------------------------

Dim OnlyD As Boolean = False

Dim TestResult1() As Byte

Dim TestResult2() As Byte

'---Generate the key pair and export all of it's parameters into the
RSAParams1

Dim RSAParams1 As RSAParameters = New RSAParameters

Dim RSAObj1 As RSACryptoServiceProvider = New RSACryptoServiceProvider

RSAParams1 = RSAObj1.ExportParameters(True)

'---Get all parameters into local variables

Dim myModulus As Byte() = RSAParams1.Modulus

Dim myExponent As Byte() = RSAParams1.Exponent

Dim myPrivateKey As Byte() = RSAParams1.D

Dim myP As Byte() = RSAParams1.P

Dim myQ As Byte() = RSAParams1.Q

Dim myDP As Byte() = RSAParams1.DP

Dim myDQ As Byte() = RSAParams1.DQ

Dim myIQ As Byte() = RSAParams1.InverseQ

'---Create new RSACryproProvider

Dim RSAParams2 As RSAParameters = New RSAParameters

Dim RSAObj2 As RSACryptoServiceProvider = New RSACryptoServiceProvider

'---Set the public key

RSAParams2.Modulus = myModulus

RSAParams2.Exponent = myExponent

RSAObj2.ImportParameters(RSAParams2)

'---Encrypt with public key

TestResult1 = RSAObj2.Encrypt(Encoding.ASCII.GetBytes("TEST"), False)

MsgBox("Encrypted")

'---Now set the private key

RSAParams2.D = myPrivateKey

If (Not OnlyD) Then

    RSAParams2.P = myP

    RSAParams2.Q = myQ

    RSAParams2.DP = myDP

    RSAParams2.DQ = myDQ

    RSAParams2.InverseQ = myIQ

End If

RSAObj2.ImportParameters(RSAParams2)



'---Decrypt with private key

TestResult2 = RSAObj2.Decrypt(TestResult1, False)

MsgBox("Decrypted. Original string is: " &
Encoding.ASCII.GetString(TestResult2))

'-----------------------------

 

Many Thanks,

Goran

gmilenkovic@irdetoaccess.com <mailto:gmilenkovic@irdetoaccess.com> 

 
This e-mail and any attachments are CONFIDENTIAL and intended solely for the
use of the individual(s) to whom it is addressed. It can contain proprietary
confidential information and/or be subject to legal privilege and/or subject
to a non-disclosure Agreement. Unauthorized use, disclosure or copying is
strictly prohibited. If you are not the/an addressee and are in possession
of this e-mail, please notify us immediately.

 

 


------_=_NextPart_001_01C3A372.0AC4A740
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office"><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.3790.59" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D467434907-05112003><FONT face=3DArial =
color=3D#0000ff size=3D2>Yes, I=20
was talking about MS Framework, sorry.</FONT></SPAN></DIV>
<DIV><SPAN class=3D467434907-05112003><FONT face=3DArial =
color=3D#0000ff size=3D2>Thanks=20
very much&nbsp;for your help and support.</FONT></SPAN></DIV>
<DIV><SPAN class=3D467434907-05112003><FONT face=3DArial =
color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D467434907-05112003><FONT face=3DArial =
color=3D#0000ff size=3D2>Best=20
regards !</FONT></SPAN></DIV><SPAN class=3D467434907-05112003><FONT =
face=3DArial=20
color=3D#0000ff size=3D2></FONT></SPAN>
<DIV></DIV>
<DIV><FONT face=3DTahoma><FONT size=3D2><FONT face=3DArial><FONT =
color=3D#0000ff><SPAN=20
class=3D467434907-05112003></SPAN></FONT></FONT></FONT></FONT>&nbsp;</DI=
V>
<DIV><FONT face=3DTahoma><FONT size=3D2><FONT face=3DArial><FONT =
color=3D#0000ff><SPAN=20
class=3D467434907-05112003>&nbsp;</SPAN></FONT></FONT>-----Original=20
Message-----<BR><B>From:</B> Sebastien Pouliot =
[mailto:spouliot@videotron.ca]=20
<BR><B>Sent:</B> Wednesday, November 05, 2003 2:18 AM<BR><B>To:</B> =
Goran=20
Milenkovic; Mono-list@lists.ximian.com<BR><B>Subject:</B> RE: =
[Mono-list] How to=20
set parameters for RSACryptoServiceProvider<BR><BR></DIV></FONT></FONT>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003>Goran,</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D609205300-05112003>Are=20
  you having this problem with Mono or the MS framework =
?</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D609205300-05112003>I=20
  ask because r</SPAN></FONT><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
  class=3D609205300-05112003>ight now my mono setup doesn't work :-( =
but I'm able=20
  to duplicate the bug on the MS framework (anyway your VB code can =
only work=20
  under Windows and IIRC the exception message "Bad Key" is only shown =
in=20
  Windows).</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><FONT =
size=3D+0><SPAN=20
  class=3D609205300-05112003>Anyway at first look it seems that MS =
requires the=20
  full parameters for importing a private key - with no (known) good =
reason.=20
  </SPAN></FONT></FONT></FONT></FONT><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
  size=3D2><FONT size=3D+0><SPAN class=3D609205300-05112003>This isn't =
(supposed to=20
  be) the case for Mono - you can have a look at=20
  /mcs/class/corlib/Mono.Security/RSAManaged.cs</SPAN></FONT>.<SPAN=20
  class=3D609205300-05112003> Please fill a bug into bugzilla if this =
doesn't work=20
  on Mono (<A=20
  =
href=3D"http://bugzilla.ximian.com/enter_bug.cgi?product=3DMono%2FClass%=
20Libraries">http://bugzilla.ximian.com/enter_bug.cgi?product=3DMono%2FC=
lass%20Libraries</A>).</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003>As for solution for the MS=20
  framework:</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003>a.&nbsp;&nbsp;&nbsp; Report the bug to =
Microsoft=20
  (this is a long term solution but if you don't complain it won't get=20
  fixed);</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003>b.&nbsp;&nbsp;&nbsp; Keep all exported =
parameters for=20
  the private key (easy solution, faster decryption but requires extra=20
  space);</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003>c.&nbsp;&nbsp;&nbsp; Recalculate the other =
parameters=20
  (time consuming);</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20
  class=3D609205300-05112003>d.&nbsp;&nbsp;&nbsp; Use Mono's RSAManaged =

  implementation (on both Windows and =
Mono's)</SPAN></FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT><FONT face=3DArial =
color=3D#0000ff=20
  size=3D2><SPAN class=3D609205300-05112003></SPAN></FONT><FONT =
face=3DArial=20
  color=3D#0000ff size=3D2><SPAN =
class=3D609205300-05112003></SPAN></FONT><FONT=20
  face=3DArial color=3D#0000ff size=3D2><SPAN=20
  class=3D609205300-05112003></SPAN></FONT>&nbsp;</DIV>
  <P><FONT size=3D2>Sebastien Pouliot<BR>Security Architect, Motus =
Technologies,=20
  <A href=3D"http://www.motus.com/"=20
  target=3D_blank>http://www.motus.com</A><BR>work: =
spouliot@motus.com<BR>home:=20
  spouliot@videotron.ca<BR>blog: <A=20
  href=3D"http://pages.infinit.net/ctech/poupou.html"=20
  =
target=3D_blank>http://pages.infinit.net/ctech/poupou.html</A><BR>&nbsp;=
</FONT>=20
  </P>
  <BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
    <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
    size=3D2>-----Original Message-----<BR><B>From:</B>=20
    mono-list-admin@lists.ximian.com=20
    [mailto:mono-list-admin@lists.ximian.com]<B>On Behalf Of </B>Goran=20
    Milenkovic<BR><B>Sent:</B> 3 novembre 2003 08:56<BR><B>To:</B>=20
    'Mono-list@lists.ximian.com'<BR><B>Subject:</B> [Mono-list] How to =
set=20
    parameters for RSACryptoServiceProvider<BR><BR></FONT></DIV>
    <DIV><FONT face=3DArial>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    style=3D"mso-spacerun: yes"><SPAN class=3D910164013-03112003>The =
following=20
    VB.NET&nbsp;example should generate the new key pair, store =
generated values=20
    localy, then encrypt the test string using public&nbsp;key and =
decrypt it=20
    using private key. However, it works only if all parameters=20
    (P,Q,DP,DQ,InverseQ &amp; D) are given for the decryption, but not =
if only D=20
    is given. That means that for simple decryption private key is not =
enough,=20
    but also all of the other parameters ?? </SPAN></SPAN></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    style=3D"mso-spacerun: yes"><SPAN class=3D910164013-03112003>If you =
change=20
    boolean value OnlyD to True, assuming that only D should be enough =
for=20
    decryption, then it works. Otherwise, an exception occurs ("Bad =
Key"). Is=20
    there any solution for this ?</SPAN></SPAN></SPAN><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    style=3D"mso-spacerun: yes"><SPAN=20
    class=3D910164013-03112003></SPAN></SPAN></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    style=3D"mso-spacerun: yes"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"></SPAN></SPAN></SPAN>&nbsp;</P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    style=3D"mso-spacerun: yes"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN><SPAN=20
    class=3D910164013-03112003>--------------------------</SPAN></SPAN><=
/P></SPAN></SPAN>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim OnlyD As =
Boolean =3D=20
    False<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
TestResult1() As=20
    Byte<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
TestResult2() As=20
    Byte<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Generate the key pair and =
export all of=20
    it's parameters into the RSAParams1<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
RSAParams1 As=20
    RSAParameters =3D New RSAParameters<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim RSAObj1 =
As=20
    RSACryptoServiceProvider =3D New=20
RSACryptoServiceProvider<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">RSAParams1 =
=3D=20
    RSAObj1.ExportParameters(True)<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Get all parameters into local=20
    variables<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myModulus =
As Byte()=20
    =3D RSAParams1.Modulus<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
myExponent As Byte()=20
    =3D RSAParams1.Exponent<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
myPrivateKey As=20
    Byte() =3D RSAParams1.D<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myP As =
Byte() =3D=20
    RSAParams1.P<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myQ As =
Byte() =3D=20
    RSAParams1.Q<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myDP As =
Byte() =3D=20
    RSAParams1.DP<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myDQ As =
Byte() =3D=20
    RSAParams1.DQ<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim myIQ As =
Byte() =3D=20
    RSAParams1.InverseQ<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Create new=20
    RSACryproProvider<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim =
RSAParams2 As=20
    RSAParameters =3D New RSAParameters<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Dim RSAObj2 =
As=20
    RSACryptoServiceProvider =3D New=20
RSACryptoServiceProvider<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Set the public =
key<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">RSAParams2.Modulus =3D=20
    myModulus<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">RSAParams2.Exponent =3D=20
    myExponent<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">RSAObj2.ImportParameters(RSAParams2)<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Encrypt with public=20
    key<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">TestResult1 =
=3D=20
    RSAObj2.Encrypt(Encoding.ASCII.GetBytes("TEST"),=20
False)<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">MsgBox("Encrypted")<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Now set the private=20
    key<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">RSAParams2.D =
=3D=20
    myPrivateKey<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">If (Not =
OnlyD)=20
    Then<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003>&nbsp;&nbsp;&nbsp; </SPAN>RSAParams2.P =
=3D=20
    myP<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003>&nbsp;&nbsp;&nbsp; </SPAN>RSAParams2.Q =
=3D=20
    myQ<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003>&nbsp;&nbsp;&nbsp; </SPAN>RSAParams2.DP =
=3D=20
    myDP<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003>&nbsp;&nbsp;&nbsp; </SPAN>RSAParams2.DQ =
=3D=20
    myDQ<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003>&nbsp;&nbsp;&nbsp; =
</SPAN>RSAParams2.InverseQ =3D=20
    myIQ<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">End=20
    If<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">RSAObj2.ImportParameters(RSAParams2)<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN>Decrypt with private=20
    key<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">TestResult2 =
=3D=20
    RSAObj2.Decrypt(TestResult1, False)<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">MsgBox("Decrypted.=20
    Original string is: " &amp;=20
    Encoding.ASCII.GetString(TestResult2))</SPAN></P><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">'<SPAN=20
    class=3D910164013-03112003>---</SPAN><SPAN=20
    =
class=3D910164013-03112003>--------------------------</SPAN></SPAN></P><=
/SPAN>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN=20
    class=3D910164013-03112003><FONT =
face=3DArial></FONT></SPAN></SPAN><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"></SPAN>&nbsp;</P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
    class=3D910164013-03112003>Many Thanks,</SPAN></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
    class=3D910164013-03112003>Goran</SPAN></o:p></SPAN></P>
    <P class=3DMsoNormal style=3D"MARGIN: 0in 0in 0pt"><SPAN=20
    style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
    class=3D910164013-03112003><A=20
    =
href=3D"mailto:gmilenkovic@irdetoaccess.com">gmilenkovic@irdetoaccess.co=
m</A></SPAN></o:p></SPAN></P></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
    <DIV align=3Dleft><SPAN=20
    style=3D"FONT-SIZE: 7pt; COLOR: blue; FONT-FAMILY: Verdana; =
mso-bidi-font-family: Verdana">
    <P class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none; =
tab-stops: 62.35pt 85.05pt 153.1pt 175.75pt 243.8pt 266.5pt 334.55pt =
357.2pt 425.25pt"><SPAN=20
    style=3D"FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Verdana; =
mso-bidi-font-family: Verdana">This=20
    e-mail and any attachments are CONFIDENTIAL and intended solely for =
the use=20
    of the individual(s) to whom it</SPAN><SPAN=20
    style=3D"FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial"> =
i</SPAN><SPAN=20
    style=3D"FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Verdana; =
mso-bidi-font-family: Verdana">s=20
    addressed. It can contain proprietary confidential information =
and/or be=20
    subject to legal privilege and/or subject to a non-disclosure =
Agreement.=20
    Unauthorized use, disclosure or copying is strictly prohibited. If =
you are=20
    not the/an addressee and are in possession of this e-mail, please =
notify us=20
    immediately.<o:p></o:p></SPAN></P>
    <P class=3DMsoNormal=20
    style=3D"MARGIN: 0in 0in 0pt; mso-layout-grid-align: none; =
mso-pagination: none"><FONT=20
    face=3DArial color=3D#000000 size=3D2></FONT></SPAN><SPAN=20
    style=3D"FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Verdana; =
mso-bidi-font-family: Verdana"><FONT=20
    face=3DVerdana color=3D#ff0000 size=3D1><FONT face=3DArial =
color=3D#000000=20
    size=3D2></FONT>&nbsp;</P></FONT></SPAN></DIV>
    <DIV><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C3A372.0AC4A740--