Modifier and Type | Class and Description |
---|---|
static class |
PublicKeyReaderUtil.PublicKeyParseException
The Exception is throws if the public key encoded text could not be
parsed.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SSH2_DSA_KEY
Key name of the type of public key for DSA algorithm.
|
static java.lang.String |
SSH2_RSA_KEY
Key name of the type of public key for RSA algorithm.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
extractOpenSSHBase64(java.lang.String _key)
Extracts from the OpenSSH public key format the base64 encoded SSH
public key.
|
static java.lang.String |
format(java.security.PublicKey key)
format a key (of the types supported by the
load(String) method. |
static java.security.PublicKey |
load(java.lang.String _key)
Decodes given public
_key text and returns the related
public key instance. |
static java.lang.String |
normalise(java.lang.String key) |
static void |
packDSAkey(java.security.interfaces.DSAPublicKey pub,
uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) |
static void |
packDSAKeyParams(java.security.interfaces.DSAPublicKey pub,
uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) |
static void |
packRSAkey(java.security.interfaces.RSAPublicKey pub,
uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) |
static void |
packRSAKeyParams(java.security.interfaces.RSAPublicKey pub,
uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) |
public static final java.lang.String SSH2_DSA_KEY
load(String)
,
Constant Field Valuespublic static final java.lang.String SSH2_RSA_KEY
load(String)
,
Constant Field Valuespublic static java.security.PublicKey load(java.lang.String _key) throws PublicKeyReaderUtil.PublicKeyParseException
_key
text and returns the related
public key instance._key
- text key of the encoded public keyPublicKeyReaderUtil.PublicKeyParseException
- if the public key could not be parsed
from _key
PublicKeyReaderUtil.PublicKeyParseException.ErrorCode.UNKNOWN_PUBLIC_KEY_FILE_FORMAT
,
PublicKeyReaderUtil.PublicKeyParseException.ErrorCode.UNKNOWN_PUBLIC_KEY_CERTIFICATE_FORMAT
public static java.lang.String format(java.security.PublicKey key) throws PublicKeyReaderUtil.PublicKeyParseException, java.io.IOException
load(String)
method.key
- PublicKeyReaderUtil.PublicKeyParseException
java.io.IOException
public static void packDSAkey(java.security.interfaces.DSAPublicKey pub, uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) throws java.io.IOException
pub
- buf
- java.io.IOException
public static void packDSAKeyParams(java.security.interfaces.DSAPublicKey pub, uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) throws java.io.IOException
pub
- buf
- java.io.IOException
public static void packRSAkey(java.security.interfaces.RSAPublicKey pub, uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) throws java.io.IOException
pub
- buf
- java.io.IOException
public static void packRSAKeyParams(java.security.interfaces.RSAPublicKey pub, uk.ac.ed.epcc.webapp.ssh.PublicKeyReaderUtil.SSH2ByteBuffer buf) throws java.io.IOException
pub
- buf
- java.io.IOException
public static java.lang.String normalise(java.lang.String key) throws PublicKeyReaderUtil.PublicKeyParseException, java.io.IOException
PublicKeyReaderUtil.PublicKeyParseException
java.io.IOException
public static java.lang.String extractOpenSSHBase64(java.lang.String _key) throws PublicKeyReaderUtil.PublicKeyParseException
Extracts from the OpenSSH public key format the base64 encoded SSH public key.
An example of such a definition is:
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA1on8gxCGJJWSRT4uOrR130....
_key
- text of the public key defined in the OpenSSH formatPublicKeyReaderUtil.PublicKeyParseException
- if the OpenSSH public key string is
corruptPublicKeyReaderUtil.PublicKeyParseException.ErrorCode.CORRUPT_OPENSSH_PUBLIC_KEY_STRING
,
OpenSSH