Package org.jvnet.hudson.crypto
Class RSAPublicKeyUtil
- java.lang.Object
-
- org.jvnet.hudson.crypto.RSAPublicKeyUtil
-
public class RSAPublicKeyUtil extends Object
Utility code to work around horrible Java Crypto API.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description RSAPublicKeyUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
encode(PublicKey key)
Encodes RSA/DSA public keys into the OpenSSH format.static String
getEC2FingerPrint(Key publicKey)
Gets RSA key fingerprint in the form EC2 does, which is different from how OpenSSH does.static String
getFingerPrint(PublicKey key)
Gets RSA key fingerprint in the form of "f7:7a:42:76:79:e8:8a:1a:4a:32:0c:b3:f9:3b:53:d4"static PublicKey
readPublicKey(String keyLine)
Loads RSA public key by parsing the OpenSSH format that it uses in ~/.ssh/authorized_keys
-
-
-
Method Detail
-
readPublicKey
public static PublicKey readPublicKey(String keyLine) throws GeneralSecurityException
Loads RSA public key by parsing the OpenSSH format that it uses in ~/.ssh/authorized_keys- Throws:
IllegalArgumentException
- If the input line doesn't follow the expected format.GeneralSecurityException
-
getFingerPrint
public static String getFingerPrint(PublicKey key) throws GeneralSecurityException
Gets RSA key fingerprint in the form of "f7:7a:42:76:79:e8:8a:1a:4a:32:0c:b3:f9:3b:53:d4"- Throws:
GeneralSecurityException
-
getEC2FingerPrint
public static String getEC2FingerPrint(Key publicKey) throws GeneralSecurityException
Gets RSA key fingerprint in the form EC2 does, which is different from how OpenSSH does.- Throws:
GeneralSecurityException
-
encode
public static byte[] encode(PublicKey key) throws GeneralSecurityException
Encodes RSA/DSA public keys into the OpenSSH format.- Throws:
GeneralSecurityException
-
-