2

I deployed a windows machine on AWS with a key pair. I want the windows administrator password.

I got the windows encrypted password using:

var myEC2GetPasswordDataResult = ec2Client2.getPasswordData(myEC2GetPasswordDataRequest);

myEC2GetPasswordDataResult = myEC2GetPasswordDataResult.withInstanceId("instanceID");
System.log( myEC2GetPasswordDataResult.toString());

myEC2GetPasswordDataResult.getPasswordData()

Now how can I decrypt this password?

I tried many options with castlebouncy but none of them worked.

kenorb
  • 155,785
  • 88
  • 678
  • 743
  • Related: [how to retrive aws-ec2 windows instance password using aws sdk in c#](https://stackoverflow.com/questions/38499769/how-to-retrive-aws-ec2-windows-instance-password-using-aws-sdk-in-c-sharp). – John Rotenstein Nov 23 '16 at 20:18
  • @JohnRotenstein i dont want to decrypt the password using AWS SDK, my requirement is to decrypt it using JAVA and base 64. I know using the AWS sdk i can call the getDecryptedpassword method -but i cannot use that. I need a way to decrypt the password using java code but without sdk. – Ashutosh Yadav Nov 24 '16 at 09:56

1 Answers1

3

If you don't want to use AWS SDK, another way to decrypt the password is to use OpenSSL.

Here is the example using command-line:

printf 'BASE64ENCODEDSTRING==' | openssl rsautl -decrypt -inkey mykey.pem

Related: Windows Password won't decrypt on AWS EC2 even with the correct private key.

kenorb
  • 155,785
  • 88
  • 678
  • 743