Package com.sshtools.common.publickey
Class OpenSshCertificate
java.lang.Object
com.sshtools.common.publickey.OpenSshCertificate
- All Implemented Interfaces:
Component,SshPublicKey,SecureComponent
- Direct Known Subclasses:
OpenSshEcdsaCertificate,OpenSshEd25519Certificate,OpenSshRsaCertificate,OpenSshRsaSha256Certificate,OpenSshRsaSha512Certificate
To generate a key that supports this use
ssh-keygen -s ca_key -I 2 -n lee,kelly -z 12345 -O force-command=ls -O
source-address=192.168.82.0/24 -O no-port-forwarding user_key.pub
- Author:
- lee
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddecodeCertificate(com.sshtools.common.util.ByteArrayReader reader) protected abstract voiddecodePublicKey(com.sshtools.common.util.ByteArrayReader reader) protected voidencodeCertificate(com.sshtools.common.util.ByteArrayWriter writer) byte[]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 keygetExtension(String key) Deprecated.Process CertificateExtension values directly.Deprecated.Process CertificateExtension values directly.final StringReturn an SSH fingerprint of the public keygetKeyId()com.sshtools.common.util.UnsignedInteger64intgetType()init(byte[] blob, int start, int len) Initialize the public key from a blob of binary data.booleanbooleanbooleanvoidsign(SshPublicKey publicKey, com.sshtools.common.util.UnsignedInteger64 serial, int type, String keyId, List<String> validPrincipals, com.sshtools.common.util.UnsignedInteger64 validAfter, com.sshtools.common.util.UnsignedInteger64 validBefore, List<CriticalOption> criticalOptions, List<CertificateExtension> extensions, SshKeyPair signingKey) voidverify()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sshtools.common.ssh.SecureComponent
getPriority, getSecurityLevelMethods inherited from interface com.sshtools.common.ssh.components.SshPublicKey
getAlgorithm, getBitLength, getJCEPublicKey, getSigningAlgorithm, init, isCertificate, test, verifySignature
-
Field Details
-
SSH_CERT_TYPE_USER
public static final int SSH_CERT_TYPE_USER- See Also:
-
SSH_CERT_TYPE_HOST
public static final int SSH_CERT_TYPE_HOST- See Also:
-
PERMIT_X11_FORWARDING
- See Also:
-
PERMIT_PORT_FORWARDING
- See Also:
-
PERMIT_AGENT_FORWARDING
- See Also:
-
PERMIT_USER_PTY
- See Also:
-
PERMIT_USER_RC
- See Also:
-
OPTION_FORCE_COMMAND
- See Also:
-
OPTION_SOURCE_ADDRESS
- See Also:
-
publicKey
-
-
Constructor Details
-
OpenSshCertificate
public OpenSshCertificate()
-
-
Method Details
-
getEncodingAlgorithm
Description copied from interface:SshPublicKeyThe algorithm name used in the encoding of the public key- Specified by:
getEncodingAlgorithmin interfaceSshPublicKey
-
isUserCertificate
public boolean isUserCertificate() -
isHostCertificate
public boolean isHostCertificate() -
getSignedKey
-
getFingerprint
Description copied from interface:SshPublicKeyReturn an SSH fingerprint of the public key- Specified by:
getFingerprintin interfaceSshPublicKey- Returns:
- String
- Throws:
SshException
-
init
Description copied from interface:SshPublicKeyInitialize the public key from a blob of binary data.- Specified by:
initin interfaceSshPublicKey- Throws:
SshException
-
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
-
decodePublicKey
protected abstract void decodePublicKey(com.sshtools.common.util.ByteArrayReader reader) throws IOException, SshException - Throws:
IOExceptionSshException
-
encodeCertificate
protected void encodeCertificate(com.sshtools.common.util.ByteArrayWriter writer) throws IOException, SshException - Throws:
IOExceptionSshException
-
getExtension
-
decodeCertificate
protected void decodeCertificate(com.sshtools.common.util.ByteArrayReader reader) throws IOException, SshException - Throws:
IOExceptionSshException
-
sign
public void sign(SshPublicKey publicKey, com.sshtools.common.util.UnsignedInteger64 serial, int type, String keyId, List<String> validPrincipals, com.sshtools.common.util.UnsignedInteger64 validAfter, com.sshtools.common.util.UnsignedInteger64 validBefore, List<CriticalOption> criticalOptions, List<CertificateExtension> extensions, SshKeyPair signingKey) throws SshException - Throws:
SshException
-
verify
- Throws:
SshException
-
getSignedBy
-
getType
public int getType() -
getPrincipals
-
getExtensions
Deprecated.Process CertificateExtension values directly.- Returns:
-
getCriticalOptionsList
-
getExtensionsList
-
getExtensionsMap
Deprecated.Process CertificateExtension values directly.- Returns:
-
isForceCommand
public boolean isForceCommand() -
getForcedCommand
-
getSourceAddresses
-
getValidBefore
-
getValidAfter
-
getSerial
public com.sshtools.common.util.UnsignedInteger64 getSerial() -
getKeyId
-