0

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
Herlex
  • 43
  • 9

1 Answers1

0

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;
?>
neubert
  • 15,947
  • 24
  • 120
  • 212
  • Thanks, i know this already, but how can i "load" the generated private key now into vb.net, to decrypt? – Herlex Apr 21 '14 at 10:41
  • i do not have any working code...so just think please, i created a keypair with your posted phpcode. after that, i encrypt a string via phpseclib and publickey...then i read the output encrypted string in vb.net and want to decrypt this...with a private key, which i don't know how to import into my vb.net – Herlex Apr 21 '14 at 13:38