Top Description Inners Fields Methods
org.apache.sshd.common.config.keys

public Interface OpenSshCertificate

extends SshPublicKey, PrivateKey
Known Direct Implementers
org.apache.sshd.common.config.keys.OpenSshCertificateImpl
Imports
java.security.PrivateKey, .PublicKey, java.util.Arrays, .Collection, .Collections, .List, .Objects, java.util.concurrent.TimeUnit, org.apache.sshd.common.util.ValidateUtils

An OpenSSH certificate key as specified by OpenSSH.
Author
Apache MINA SSHD Project
See Also
PROTOCOL.certkeys

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
OpenSshCertificate.CertificateOption

Certificate Options are a set of bytes that is

[overall length][name(string)][[length of buffer][[length of string][data(string)]]]...
public static enum
OpenSshCertificate.Type

OpenSshCertificates have a type indicating whether the certificate if for a host key (certifying a host identity) or for a user key (certifying a user identity)

Note

values order is significant

Field Summary

Modifier and TypeField and Description
public static final long
public static final long
MIN_EPOCH

The minimal getValidAfter() or getValidBefore() value, corresponding to Instant#EPOCH.

Inherited from java.security.PrivateKey:
serialVersionUID

Method Summary

Modifier and TypeMethod and Description
public PublicKey

Returns:

the PublicKey
getCaPubKey
()

Retrieves the CA public key of this certificate.

public PublicKey

Returns:

the PublicKey
getCertPubKey
()

Retrieves the certified public key.

public List<OpenSshCertificate.CertificateOption>

Returns:

the critical options as a list, never null but possibly empty
getCriticalOptions
()

Retrieves the critical options set in the certificate.

public List<OpenSshCertificate.CertificateOption>

Returns:

the extensions as a list, never null but possibly empty
getExtensions
()

Retrieves the extensions set in the certificate.

public String

Returns:

the id; never null but may be empty.
getId
()

Retrieves a free-form text set by the CA when the certificate was generated; intended to identify the identity principal in log message.

public byte[]

Returns:

the part of the certificate raw data that was signed
getMessage
()

Retrieves the raw byte content of the certificate, minus the signature.

public byte[]

Returns:

the nonce.
getNonce
()

Retrieves the nonce of this certificate.

public Collection<String>

Returns:

the collection of principals, never null but possibly empty
getPrincipals
()

Retrieves the principals mentioned in the certificate.

public String

Returns:

the key type, for instance "ssh-rsa" for a "[email protected]" certificate
getRawKeyType
()

Retrieves the raw SSH key type of this certificate.

public byte[]

Returns:

the signature bytes
getRawSignature
()

Retrieves the raw signature bytes, without the signature algorithm.

public String

Returns:

the "reserved" field.
getReserved
()

Retrieves the "reserved" field of the certificate.

public long

Returns:

the serial number
getSerial
()

Retrieves the serial number of this certificate.

public byte[]

Returns:

the signature bytes
getSignature
()

Retrieves the signature of the certificate, including the signature algorithm.

public String

Returns:

the signature algorithm as recorded in the certificate
getSignatureAlgorithm
()

Retrieves the signature algorithm used for the signature.

public OpenSshCertificate.Type

Returns:

the Type
getType
()

Retrieves the type of certificate.

public long

Returns:

the number of seconds since the java.time.Instant#EPOCH as an unsigned 64bit value
getValidAfter
()

Retrieves the time in number of seconds since the java.time.Instant#EPOCH at which this certificate becomes or became valid.

public long

Returns:

the number of seconds since the java.time.Instant#EPOCH as an unsigned 64bit value
getValidBefore
()

Retrieves the time in number of seconds since the java.time.Instant#EPOCH at which this certificate becomes or became invalid.

public static boolean

Returns:

true if the certificate is valid according to its timestamps, false otherwise
isValidNow
(OpenSshCertificate
to check
cert
)

Determines whether the given OpenSshCertificate is valid at the current local system time.

Inherited from org.apache.sshd.common.config.keys.SshPublicKey:
getKeyType

Field Detail

INFINITYback to summary
public static final long INFINITY

The maximum getValidAfter() or getValidBefore() value.

Note that timestamps in OpenSSH certificates are unsigned 64-bit values.

See Also
isValidNow(OpenSshCertificate)
MIN_EPOCHback to summary
public static final long MIN_EPOCH

The minimal getValidAfter() or getValidBefore() value, corresponding to Instant#EPOCH.

Method Detail

getCaPubKeyback to summary
public PublicKey getCaPubKey()

Retrieves the CA public key of this certificate.

Returns:PublicKey

the PublicKey

getCertPubKeyback to summary
public PublicKey getCertPubKey()

Retrieves the certified public key.

Returns:PublicKey

the PublicKey

getCriticalOptionsback to summary
public List<OpenSshCertificate.CertificateOption> getCriticalOptions()

Retrieves the critical options set in the certificate.

Returns:List<OpenSshCertificate.CertificateOption>

the critical options as a list, never null but possibly empty

getExtensionsback to summary
public List<OpenSshCertificate.CertificateOption> getExtensions()

Retrieves the extensions set in the certificate.

Returns:List<OpenSshCertificate.CertificateOption>

the extensions as a list, never null but possibly empty

getIdback to summary
public String getId()

Retrieves a free-form text set by the CA when the certificate was generated; intended to identify the identity principal in log message.

Returns:String

the id; never null but may be empty.

getMessageback to summary
public byte[] getMessage()

Retrieves the raw byte content of the certificate, minus the signature. This is the data that was signed.

Returns:byte[]

the part of the certificate raw data that was signed

getNonceback to summary
public byte[] getNonce()

Retrieves the nonce of this certificate.

Returns:byte[]

the nonce.

getPrincipalsback to summary
public Collection<String> getPrincipals()

Retrieves the principals mentioned in the certificate.

Returns:Collection<String>

the collection of principals, never null but possibly empty

getRawKeyTypeback to summary
public String getRawKeyType()

Retrieves the raw SSH key type of this certificate.

Returns:String

the key type, for instance "ssh-rsa" for a "[email protected]" certificate

getRawSignatureback to summary
public byte[] getRawSignature()

Retrieves the raw signature bytes, without the signature algorithm.

Returns:byte[]

the signature bytes

See Also
getSignature()
getReservedback to summary
public String getReserved()

Retrieves the "reserved" field of the certificate. OpenSSH currently doesn't use it and ignores it.

Returns:String

the "reserved" field.

getSerialback to summary
public long getSerial()

Retrieves the serial number of this certificate.

Returns:long

the serial number

getSignatureback to summary
public byte[] getSignature()

Retrieves the signature of the certificate, including the signature algorithm.

Returns:byte[]

the signature bytes

See Also
getRawSignature()
getSignatureAlgorithmback to summary
public String getSignatureAlgorithm()

Retrieves the signature algorithm used for the signature.

Returns:String

the signature algorithm as recorded in the certificate

getTypeback to summary
public OpenSshCertificate.Type getType()

Retrieves the type of certificate.

Returns:OpenSshCertificate.Type

the Type

getValidAfterback to summary
public long getValidAfter()

Retrieves the time in number of seconds since the java.time.Instant#EPOCH at which this certificate becomes or became valid.

Returns:long

the number of seconds since the java.time.Instant#EPOCH as an unsigned 64bit value

See Also
isValidNow(OpenSshCertificate)
getValidBeforeback to summary
public long getValidBefore()

Retrieves the time in number of seconds since the java.time.Instant#EPOCH at which this certificate becomes or became invalid.

Returns:long

the number of seconds since the java.time.Instant#EPOCH as an unsigned 64bit value

See Also
isValidNow(OpenSshCertificate)
isValidNowback to summary
public static boolean isValidNow(OpenSshCertificate cert)

Determines whether the given OpenSshCertificate is valid at the current local system time.

Parameters
cert:OpenSshCertificate

to check

Returns:boolean

true if the certificate is valid according to its timestamps, false otherwise

org.apache.sshd.common.config.keys back to summary

public Class OpenSshCertificate.CertificateOption

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.sshd.common.config.keys.OpenSshCertificate.CertificateOption

Certificate Options are a set of bytes that is
[overall length][name(string)][[length of buffer][[length of string][data(string)]]]...

Where each Certificate Option is encoded as a name (string) and data (string packed in a buffer). The entire name (string) + data (buffer) are added as bytes (which will get a length prefix).

See Also
PROTOCOL.certkeys

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
CertificateOption(String
of the option; must be neither null nor empty
name
,
String
for the option; may be null or empty
data
)

Creates a new CertificateOption with the given name and data.

public
CertificateOption(String
of the option; must be neither null nor empty
name
)

Creates a new CertificateOption with a name without data.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public final String

Returns:

the data, may benull or empty
getData
()

Retrieves the data.

public final String

Returns:

the name, never null
getName
()

Retrieves the name.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

databack to summary
private final String data
nameback to summary
private final String name

Constructor Detail

CertificateOptionback to summary
public CertificateOption(String name, String data)

Creates a new CertificateOption with the given name and data.

Parameters
name:String

of the option; must be neither null nor empty

data:String

for the option; may be null or empty

CertificateOptionback to summary
public CertificateOption(String name)

Creates a new CertificateOption with a name without data.

Parameters
name:String

of the option; must be neither null nor empty

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDataback to summary
public final String getData()

Retrieves the data.

Returns:String

the data, may benull or empty

getNameback to summary
public final String getName()

Retrieves the name.

Returns:String

the name, never null

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.apache.sshd.common.config.keys back to summary

public final Enum OpenSshCertificate.Type

extends Enum<OpenSshCertificate.Type>
Class Inheritance

OpenSshCertificates have a type indicating whether the certificate if for a host key (certifying a host identity) or for a user key (certifying a user identity)

Note

values order is significant

Field Summary

Modifier and TypeField and Description
public static final OpenSshCertificate.Type
HOST

Host key certificate.

public static final OpenSshCertificate.Type
USER

User key certificate.

public static final List<OpenSshCertificate.Type>

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static OpenSshCertificate.Type
fromCode(int code)

public int
public static OpenSshCertificate.Type
public static OpenSshCertificate.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

HOSTback to summary
public static final OpenSshCertificate.Type HOST

Host key certificate.

USERback to summary
public static final OpenSshCertificate.Type USER

User key certificate.

VALUESback to summary
public static final List<OpenSshCertificate.Type> VALUES

Constructor Detail

Typeback to summary
private Type()

Method Detail

fromCodeback to summary
public static OpenSshCertificate.Type fromCode(int code)
getCodeback to summary
public int getCode()
valueOfback to summary
public static OpenSshCertificate.Type valueOf(String name)
valuesback to summary
public static OpenSshCertificate.Type[] values()