Creates a key container using the CspParameters class and saves the key in the container. : CspParameters « Security « VB.Net Tutorial






Imports System
Imports System.IO
Imports System.Security.Cryptography

Public Class StoreKey

    Public Shared Sub Main()
        Dim cp As New CspParameters()
        cp.KeyContainerName = "MyKeyContainerName"
        Dim rsa As New RSACryptoServiceProvider(cp)
        rsa.PersistKeyInCsp = False
        Console.WriteLine("Key is : "  & rsa.ToXmlString(True))
    End Sub
End Class








21.4.CspParameters
21.4.1.Creates a key container using the CspParameters class and saves the key in the container.