Posted on: 3/16/2011 10:33:06 AM | Views : 317

I have created an x590 certificate that is in the file :
"C:\Users\martin\AppData\Roaming\Microsoft\SystemCertificates\My\Certificates"
I am trying to acces the public key to encrypt some plain text.
The system is throwing an "System.ArgumentOutOfRangeException" at the line
Dim certificate As X509Certificate2 = certificateCollection(0)
Can anyone tell me where I am going wrong or tell me another way to access the public key
Many thanks
Martin
.................................................
This is the complete code:
Imports System.Security
Imports System.Security.Cryptography.X509Certificates
Imports System.Security.Cryptography.X509Certificates.X509Certificate2
Imports System.Security.Cryptography.Pkcs

Partial Class encryptwithcertificare
    Inherits System.We ...

Go to the complete details ...