0
votes

I am trying to decrypt a RSA encrypted string, which i encrypted with phpseclib, with vb.net.

The problem: I generated a keypair (public and private) with phpseclib and enrcypted the string with php and publickey. Now i want to decrypt this with a simple vb.net tool. but i can't load the private key i generated with phpseclib...

Can anybody help me, how to import or load the private key into vb.net, so that i can decrypt messages? Thanks!

The Code:

phpseclib and vb.net
1

1 Answers

0
votes

You didn't actually post your code.

In any event, your key is probably just not in the right format. In my experience, .NET usually likes keys to be in an XML format, which you can have phpseclib make for you thusly:

<?php
include('Crypt/RSA.php');

$rsa = new Crypt_RSA();

$rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_XML);

extract($rsa->createKey());
echo $privatekey;
?>