Interface SshPublicKey
- All Superinterfaces:
Component,SecureComponent
- All Known Subinterfaces:
SshDsaPublicKey,SshEd25519PublicKey,SshEd448PublicKey,SshRsaPublicKey
- All Known Implementing Classes:
OpenSshCertificate,OpenSshEcdsaCertificate,OpenSshEcdsaSha2Nist256Certificate,OpenSshEcdsaSha2Nist384Certificate,OpenSshEcdsaSha2Nist521Certificate,OpenSshEd25519Certificate,OpenSshRsaCertificate,OpenSshRsaSha256Certificate,OpenSshRsaSha512Certificate,Ssh2DsaPublicKey,Ssh2EcdsaSha2Nist256PublicKey,Ssh2EcdsaSha2Nist384PublicKey,Ssh2EcdsaSha2Nist521PublicKey,Ssh2EcdsaSha2NistPublicKey,Ssh2RsaPublicKey,Ssh2RsaPublicKeySHA256,Ssh2RsaPublicKeySHA512,SshEd25519PublicKeyJCE,SshEd448PublicKeyJCE
Interface for SSH supported public keys.
- Author:
- Lee David Painter
-
Method Summary
Modifier and TypeMethodDescriptionGet the algorithm name for the public key.intGet the bit length of the public keybyte[]Encode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.The algorithm name used in the encoding of the public keyReturn an SSH fingerprint of the public keyReturn the JCE component for this key.The algorithm name expected to be encoded in SSH signaturesdefault SshPublicKeyinit(byte[] blob) init(byte[] blob, int start, int len) Initialize the public key from a blob of binary data.default booleanIndicates if this key is part of a certificate.test()Test the JCE for algorithm availability.booleanverifySignature(byte[] signature, byte[] data) Verify the signature.Methods inherited from interface com.sshtools.common.ssh.SecureComponent
getPriority, getSecurityLevel
-
Method Details
-
init
Initialize the public key from a blob of binary data.- Parameters:
blob-start-len-- Throws:
SshException
-
init
- Throws:
SshException
-
getAlgorithm
String getAlgorithm()Get the algorithm name for the public key.- Specified by:
getAlgorithmin interfaceSecureComponent- Returns:
- the algorithm name, for example "ssh-dss"
-
getSigningAlgorithm
String getSigningAlgorithm()The algorithm name expected to be encoded in SSH signatures -
getEncodingAlgorithm
String getEncodingAlgorithm()The algorithm name used in the encoding of the public key -
getBitLength
int getBitLength()Get the bit length of the public key- Returns:
- the bit length of the public key
-
getEncoded
Encode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.- Returns:
- an encoded byte array
- Throws:
SshException
-
getFingerprint
Return an SSH fingerprint of the public key- Returns:
- String
- Throws:
SshException
-
verifySignature
Verify the signature.- Parameters:
signature-data-- Returns:
trueif the signature was produced by the corresponding private key that owns this public key, otherwisefalse.- Throws:
SshException
-
test
String test()Test the JCE for algorithm availability.- Returns:
-
getJCEPublicKey
PublicKey getJCEPublicKey()Return the JCE component for this key.- Returns:
-
isCertificate
default boolean isCertificate()Indicates if this key is part of a certificate.- Returns:
-