Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual Basic 6.0) Generate an RSA Key and Export to XMLSee more RSA ExamplesDemonstrates how to generate an RSA key and export public/private to XML.
Dim rsa As New ChilkatRsa ' Generate a 2048-bit key. Dim success As Long success = rsa.GenerateKey(2048) If (success = 0) Then Debug.Print rsa.LastErrorText Exit Sub End If Dim privKeyXml As String privKeyXml = rsa.ExportPrivateKey() Debug.Print privKeyXml ' Sample output: ' <RSAKeyValue> ' <Modulus>pvxYRzbV8Gru5/NNFQunXkLfhUW9W83/A+LtVD5jhV5oDZ5mv9R3BbfBE88UTqGjA1jZoFegprY3dGpm7Dl0PFqIYSwfE869Tx7OGzg+ocsM3klTBslxVftN4grJzovfWeUbi22JNbOEjuvI9548OmTnIHhYI9yhl54xyIHUIRWCa6nlPNfqqFD/tscmel+2AwWM5hhylse2Q3xg1Y3D3al3BckGGvrBGjKAFoN60+kmD0mnisy0zfHRAiHH8EsqSXASXjqRa6G60jj+tRrdY5AcOrtWe7tsoHE8txGI+xZQ6g3MWelyNM6Dnb324hid8rNxj33lFiqbOkQGPvE9fw==</Modulus> ' <Exponent>AQAB</Exponent> ' <D>fsydqC3+lJpOoblBrhp0VAKJwqSrXpv06pmVx+O8JJkEgFrpAP+wBZp8NbOIYxEgPLlqP/RqXE1/nJnzX6tdFTtV1hvv2VWisQLeVRMHlEogkmaxcjTjJ/w1LtEsXvgdeSCdIunhR/LyVKi8qTLx3xGh5CkeHNU7q2sHuI7Favy0ux5JluKdrx4CSu30DKPhVvIoWTp4rif5lBBMojw7TEj2Gfbrfw8ZoPZRztjpqI8D4ZyxuFKrPEVWBNBt3yTE3TLWnlH1Me/5iwLgctLv+htDNStoKmco7t+xepusgALYachRaRe7bbVahDaQF/hOxKd00CpoetuasPjBP5yMaQ==</D> ' <P>wl6TQ35VGfpR4dk1I+7JeQVXMyD9McAIKrlQ0uGc2U5Ts7MXXaq0l+QI6/VPsf0jtuzRiT4+wmDUgWjaYpNUaBn1KI+F/gRdMgZcmEOOGUDiCCsWUO0hS5tlchyY9l8LoPXFbpdfNFsLEZDtIEeNMyRzBHcZABoXWN/yFqGsaEU=</P> ' <Q>2+74GkV4+1Dkxr/KGNZKfYaKEolaRRmjxeUj8VNLU9vKpaGXEgsi7208esH8KG5He1f8fJOIJtnRfUne/cg8vrqPRQ8nYDGSaNswPNQldji2FhNN2hWmhlQ3hS+ymTS8Dm8h1dqRVn/QQNvH8+WkcztmUNXKk3vtnc2UBakPdPM=</Q> ' <DP>ar3zk9JSPBT7WNOnWldtr5eePsb0JZk3Ivdoipc6QyC/2OUWhOsViIDD4YlzveSt82x02jEj2C3DJlqF7DLK3Oy8dQz04f5Vi/5wZXJcHEREnYXEGKdRbKsneBZ6bnrd8QRn64cX0rHZD0mO3/ZLdfWjcKVTRnoNrlI2KfWZsB0=</DP> ' <DQ>TvJgAuYvQF9QT/umavX5NUfnJjJBwg4rGK1hEo5oushp3Ly9gs+WkcVvcU1S25yCckcqLfmzZObJaSTsM8L98yT6qrp+0uvYd2U+0ocAj4hZ7GCvkHo3FX8Dkv6FKLOiUbgYuDBF/XvR4IZEJ0umlWqcFqY3mmtg50VVPhbqons=</DQ> ' <InverseQ>W7bC5ZD55dv6XqmfHDVuUoI8IZQVnM1M1BtA5+tTFXxPT29ZUov7wOh+5R2nygUqkJfiNAC0s18tPiv7HoQXHxIskI2tXT3XM9yJdZOnAXCzV+xh+zeenBVTD63PvpNpC9Obrxd1rpBi2jTIFESgD0Cn5CKEIUpXIGntaNLLgDI=</InverseQ> ' </RSAKeyValue> Dim pubKeyXml As String pubKeyXml = rsa.ExportPublicKey() Debug.Print pubKeyXml ' Sample output: ' <RSAPublicKey> ' <Modulus>pvxYRzbV8Gru5/NNFQunXkLfhUW9W83/A+LtVD5jhV5oDZ5mv9R3BbfBE88UTqGjA1jZoFegprY3dGpm7Dl0PFqIYSwfE869Tx7OGzg+ocsM3klTBslxVftN4grJzovfWeUbi22JNbOEjuvI9548OmTnIHhYI9yhl54xyIHUIRWCa6nlPNfqqFD/tscmel+2AwWM5hhylse2Q3xg1Y3D3al3BckGGvrBGjKAFoN60+kmD0mnisy0zfHRAiHH8EsqSXASXjqRa6G60jj+tRrdY5AcOrtWe7tsoHE8txGI+xZQ6g3MWelyNM6Dnb324hid8rNxj33lFiqbOkQGPvE9fw==</Modulus> ' <Exponent>AQAB</Exponent> ' </RSAPublicKey> |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.