public class SshPublicKeyEncoder extends Object
This encoder returns a blob containing the SSH public key as specified in the SSH protocol.
The second column of a SSH public key file contains this blob (base64 encoded).
| Constructor and Description |
|---|
SshPublicKeyEncoder() |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
encodeDsaPublicKey(DSAPublicKey aDsaPublicKey)
Encodes a DSA public key.
|
protected byte[] |
encodeEd25519PublicKey(PublicKey aPublicKey)
Encodes a ED25519 public key.
|
byte[] |
encodePublicKey(PublicKey aPublicKey)
Encodes a public key in SSH format.
|
protected byte[] |
encodeRsaPublicKey(RSAPublicKey aRsaPublicKey)
Encodes a RSA public key.
|
public byte[] encodePublicKey(PublicKey aPublicKey) throws SshSignatureException
aPublicKey - a public keySshSignatureException - in case the public key could no be encodedprotected final byte[] encodeDsaPublicKey(DSAPublicKey aDsaPublicKey)
According to RTC 4253 the DSA public key encoding is
aDsaPublicKey - the DSA public keyprotected final byte[] encodeRsaPublicKey(RSAPublicKey aRsaPublicKey)
According to RTC 4253 the RSA public key encoding is
aRsaPublicKey - the RSA public keyprotected byte[] encodeEd25519PublicKey(PublicKey aPublicKey) throws SshSignatureException
According to RFC 8709 the ED25519 public key encoding is
NOTE:
Since we are compiling against a JDK8 which has no support for ED25519 we are not able to provide a proper
encoding method :-/.
For the case the public key has the X.509 format we can extract the required 32 bytes from the X.509 encoding.
aPublicKey - the ED25519 public keySshSignatureException - in case key is not in X.509 formatCopyright © 2023. All rights reserved.