teleconsole icon indicating copy to clipboard operation
teleconsole copied to clipboard

RSA Encrypted keys not recognized

Open phoenix1796 opened this issue 8 years ago • 1 comments

While using the -i option , if the private key is encrypted , teleconsole fails to connect .

Error: asn1: structure error: tags don't match (16 vs {class:3 tag:1 length:76 isCompound:false}) {optional:false explicit:false application:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} pkcs1PrivateKey @2

Found this as a solution to a similar problem in another application (Solution)

Do DecryptPEMBlock() like this after pem.Decode() https://golang.org/src/crypto/x509/pem_decrypt_test.go#L15

Also, use IsEncryptedPEMBlock() to determine if decryption is needed.

phoenix1796 avatar Nov 13 '16 05:11 phoenix1796

On a related note to PR #40 , I think it's preferable for the session provider to only use the public key with the -i switch (which does not need a passphrase). In that case, reading encrypted private keys would be moved to the responsibility of the ssh client on the session requester side, i.e. not within the scope of teleconsole -i ... anymore

shadiakiki1986 avatar Dec 09 '17 08:12 shadiakiki1986