Package hudson.cli
Class PrivateKeyProvider
- java.lang.Object
-
- hudson.cli.PrivateKeyProvider
-
public class PrivateKeyProvider extends Object
Read DSA or RSA key from file(s) asking for password interactively.- Since:
- 1.556
- Author:
- ogondza
-
-
Constructor Summary
Constructors Constructor Description PrivateKeyProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<KeyPair>getKeys()Get keys read so far.booleanhasKeys()static KeyPairloadKey(File f, String passwd)static KeyPairloadKey(String pemString, String passwd)voidreadFrom(File keyFile)Read key from keyFile.booleanreadFromDefaultLocations()Read keys from default keyFiles.ssh/id_rsa,.ssh/id_dsaand.ssh/identity.
-
-
-
Method Detail
-
getKeys
public List<KeyPair> getKeys()
Get keys read so far.- Returns:
- Possibly empty list. Never null.
-
hasKeys
public boolean hasKeys()
-
readFromDefaultLocations
public boolean readFromDefaultLocations()
Read keys from default keyFiles.ssh/id_rsa,.ssh/id_dsaand.ssh/identity.- Returns:
- true if some key was read successfully.
-
readFrom
public void readFrom(File keyFile) throws IOException, GeneralSecurityException
Read key from keyFile.- Throws:
IOExceptionGeneralSecurityException
-
loadKey
public static KeyPair loadKey(File f, String passwd) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
loadKey
public static KeyPair loadKey(String pemString, String passwd) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
-