Class Ssh2RsaPublicKey
java.lang.Object
com.sshtools.common.ssh.components.jce.Ssh2RsaPublicKey
- All Implemented Interfaces:
Component,SshPublicKey,SshRsaPublicKey,SecureComponent
- Direct Known Subclasses:
Ssh2RsaPublicKeySHA256,Ssh2RsaPublicKeySHA512
A RSA public key implementation which uses a JCE provider.
- Author:
- Lee David Painter
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for initializing the key from a byte array using the init method.Ssh2RsaPublicKey(BigInteger modulus, BigInteger publicExponent) Ssh2RsaPublicKey(RSAPublicKey pubKey) -
Method Summary
Modifier and TypeMethodDescriptiondoPublic(BigInteger input) booleanGet 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.intintThe algorithm name expected to be encoded in SSH signaturesintinthashCode()init(byte[] blob, int start, int len) Initialize the public key from a blob of binary data.test()Test the JCE for algorithm availability.booleanverifySignature(byte[] signature, byte[] data) Verify the signature.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sshtools.common.ssh.components.SshPublicKey
init, isCertificate
-
Field Details
-
pubKey
-
-
Constructor Details
-
Ssh2RsaPublicKey
public Ssh2RsaPublicKey()Default constructor for initializing the key from a byte array using the init method. -
Ssh2RsaPublicKey
-
Ssh2RsaPublicKey
public Ssh2RsaPublicKey(BigInteger modulus, BigInteger publicExponent) throws NoSuchAlgorithmException, InvalidKeySpecException
-
-
Method Details
-
getSecurityLevel
- Specified by:
getSecurityLevelin interfaceSecureComponent
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceSecureComponent
-
getEncoded
Description copied from interface:SshPublicKeyEncode the public key into a blob of binary data, the encoded result will be passed into init to recreate the key.- Specified by:
getEncodedin interfaceSshPublicKey- Returns:
- an encoded byte array
- Throws:
SshException
-
getFingerprint
Description copied from interface:SshPublicKeyReturn an SSH fingerprint of the public key- Specified by:
getFingerprintin interfaceSshPublicKey- Returns:
- String
- Throws:
SshException
-
getBitLength
public int getBitLength()Description copied from interface:SshPublicKeyGet the bit length of the public key- Specified by:
getBitLengthin interfaceSshPublicKey- Returns:
- the bit length of the public key
-
getEncodingAlgorithm
Description copied from interface:SshPublicKeyThe algorithm name used in the encoding of the public key- Specified by:
getEncodingAlgorithmin interfaceSshPublicKey
-
init
Description copied from interface:SshPublicKeyInitialize the public key from a blob of binary data.- Specified by:
initin interfaceSshPublicKey- Throws:
SshException
-
getAlgorithm
Description copied from interface:SshPublicKeyGet the algorithm name for the public key.- Specified by:
getAlgorithmin interfaceSecureComponent- Specified by:
getAlgorithmin interfaceSshPublicKey- Returns:
- the algorithm name, for example "ssh-dss"
-
verifySignature
Description copied from interface:SshPublicKeyVerify the signature.- Specified by:
verifySignaturein interfaceSshPublicKey- Returns:
trueif the signature was produced by the corresponding private key that owns this public key, otherwisefalse.- Throws:
SshException
-
getSignatureLength
public int getSignatureLength() -
equals
-
hashCode
public int hashCode() -
doPublic
- Specified by:
doPublicin interfaceSshRsaPublicKey- Throws:
SshException
-
getModulus
- Specified by:
getModulusin interfaceSshRsaPublicKey
-
getPublicExponent
- Specified by:
getPublicExponentin interfaceSshRsaPublicKey
-
getVersion
public int getVersion()- Specified by:
getVersionin interfaceSshRsaPublicKey
-
getJCEPublicKey
Description copied from interface:SshPublicKeyReturn the JCE component for this key.- Specified by:
getJCEPublicKeyin interfaceSshPublicKey- Specified by:
getJCEPublicKeyin interfaceSshRsaPublicKey- Returns:
-
test
Description copied from interface:SshPublicKeyTest the JCE for algorithm availability.- Specified by:
testin interfaceSshPublicKey- Returns:
-
getSigningAlgorithm
Description copied from interface:SshPublicKeyThe algorithm name expected to be encoded in SSH signatures- Specified by:
getSigningAlgorithmin interfaceSshPublicKey
-