Subject: "Invalid key format" exception while loading  RSA private putty key
Date: 2018-03-07 14:48:29
From: amolj
Source: invalid-key-format-exception-loading-rsa-private-putty-key


I am trying to load the private key files using the code mentioned in the following page   


My code is as follows 

        public static void ReadPrivateKey(byte[] key, string passPhrase)
                        using (Stream stream = new MemoryStream(key))
                            var privateKeyObject = new SecureShellPrivateKey(stream,passPhrase);
                    catch (Exception ex)
                        throw ex

Above code works fine for DSA private putty key file. but it fails for RSA Private Putty key file (SSH PRIVATE KEY FILE FORMAT 1.1) generated through puttygen.

It throws exception "Invalid key format".

I would like to upload the RSA Private putty key file but I don't know how to do it.

**Update 1:** 

I tried the rsa putty key 

and it does not throw the exception. example key contains can be readable (ASCII format ) but mine is not readable. 
**Update 2:** looks like an RSA private putty key with SSH-1 format (SSH PRIVATE KEY FILE FORMAT 1.1) is not supported. Can anybody confirm?



Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index