Class OpenSshCertificateImpl
java.lang.Object
org.apache.sshd.common.config.keys.OpenSshCertificateImpl
- All Implemented Interfaces:
Serializable,Key,PrivateKey,PublicKey,Destroyable,OpenSshCertificate,SshPublicKey
- Author:
- Apache MINA SSHD Project
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sshd.common.config.keys.OpenSshCertificate
OpenSshCertificate.CertificateOption, OpenSshCertificate.Type -
Field Summary
Fields inherited from interface org.apache.sshd.common.config.keys.OpenSshCertificate
INFINITY, MIN_EPOCH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCriticalOption(String name, String value) Adds a critical option to the certificate, or removes it ifvalue == null.booleanaddExtension(String name, String value) Adds an extension to the certificate, or removes it ifvalue == null.Retrieves the CA public key of this certificate.Retrieves the certified public key.Retrieves the critical options set in the certificate.Retrieves the critical options set in the certificate.byte[]Retrieves the extensions set in the certificate.Retrieves the extensions set in the certificate.getId()Retrieves a free-form text set by the CA when the certificate was generated; intended to identify the identity principal in log message.Retrieves the SSH key type.byte[]Retrieves the raw byte content of the certificate, minus the signature.byte[]getNonce()Retrieves the nonce of this certificate.Retrieves the principals mentioned in the certificate.Retrieves the raw SSH key type of this certificate.byte[]Retrieves the raw signature bytes, without the signature algorithm.Retrieves the "reserved" field of the certificate.longRetrieves the serial number of this certificate.byte[]Retrieves the signature of the certificate, including the signature algorithm.Retrieves the signature algorithm used for the signature.getType()Retrieves the type of certificate.longRetrieves the time in number of seconds since theInstant.EPOCHat which this certificate becomes or became valid.longRetrieves the time in number of seconds since theInstant.EPOCHat which this certificate becomes or became invalid.voidsetCaPubKey(PublicKey caPubKey) voidsetCertPubKey(PublicKey certificatePublicKey) voidsetCriticalOptions(List<OpenSshCertificate.CertificateOption> criticalOptions) Sets the critical options of the certificate, overriding any options set earlier.voidsetCriticalOptions(Map<String, String> criticalOptions) Sets the critical options of the certificate, overriding any options set earlier.voidsetExtensions(List<OpenSshCertificate.CertificateOption> extensions) Sets the extensions of the certificate, overriding any extensions set earlier.voidsetExtensions(Map<String, String> extensions) Sets the extensions of the certificate, overriding any extensions set earlier.voidvoidsetKeyType(String keyType) voidsetMessage(byte[] message) voidsetNonce(byte[] nonce) voidsetPrincipals(Collection<String> principals) voidsetReserved(String reserved) voidsetSerial(long serial) voidsetSignature(byte[] signature) voidvoidsetValidAfter(long validAfter) voidsetValidAfter(Instant validAfter) If null, usesOpenSshCertificate.MIN_EPOCHvoidsetValidBefore(long validBefore) voidsetValidBefore(Instant validBefore) If null, usesOpenSshCertificate.INFINITYtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.security.auth.Destroyable
destroy, isDestroyed
-
Constructor Details
-
OpenSshCertificateImpl
public OpenSshCertificateImpl()
-
-
Method Details
-
getRawKeyType
Description copied from interface:OpenSshCertificateRetrieves the raw SSH key type of this certificate.- Specified by:
getRawKeyTypein interfaceOpenSshCertificate- Returns:
- the key type, for instance "ssh-rsa" for a "ssh-rsa-cert-v01@openssh.com" certificate
-
getNonce
public byte[] getNonce()Description copied from interface:OpenSshCertificateRetrieves the nonce of this certificate.- Specified by:
getNoncein interfaceOpenSshCertificate- Returns:
- the nonce.
-
getKeyType
Description copied from interface:SshPublicKeyRetrieves the SSH key type.- Specified by:
getKeyTypein interfaceSshPublicKey- Returns:
- the SSH key type, never
null.
-
getCertPubKey
Description copied from interface:OpenSshCertificateRetrieves the certified public key.- Specified by:
getCertPubKeyin interfaceOpenSshCertificate- Returns:
- the
PublicKey
-
getSerial
public long getSerial()Description copied from interface:OpenSshCertificateRetrieves the serial number of this certificate.- Specified by:
getSerialin interfaceOpenSshCertificate- Returns:
- the serial number
-
getType
Description copied from interface:OpenSshCertificateRetrieves the type of certificate.- Specified by:
getTypein interfaceOpenSshCertificate- Returns:
- the
OpenSshCertificate.Type
-
getId
Description copied from interface:OpenSshCertificateRetrieves a free-form text set by the CA when the certificate was generated; intended to identify the identity principal in log message.- Specified by:
getIdin interfaceOpenSshCertificate- Returns:
- the id; never
nullbut may be empty.
-
getPrincipals
Description copied from interface:OpenSshCertificateRetrieves the principals mentioned in the certificate.- Specified by:
getPrincipalsin interfaceOpenSshCertificate- Returns:
- the collection of principals, never
nullbut possibly empty
-
getValidAfter
public long getValidAfter()Description copied from interface:OpenSshCertificateRetrieves the time in number of seconds since theInstant.EPOCHat which this certificate becomes or became valid.- Specified by:
getValidAfterin interfaceOpenSshCertificate- Returns:
- the number of seconds since the
Instant.EPOCHas an unsigned 64bit value - See Also:
-
getValidBefore
public long getValidBefore()Description copied from interface:OpenSshCertificateRetrieves the time in number of seconds since theInstant.EPOCHat which this certificate becomes or became invalid.- Specified by:
getValidBeforein interfaceOpenSshCertificate- Returns:
- the number of seconds since the
Instant.EPOCHas an unsigned 64bit value - See Also:
-
getCriticalOptions
Description copied from interface:OpenSshCertificateRetrieves the critical options set in the certificate.- Specified by:
getCriticalOptionsin interfaceOpenSshCertificate- Returns:
- the critical options as an unmodifiable list, never
nullbut possibly empty - See Also:
-
getCriticalOptionsMap
Description copied from interface:OpenSshCertificateRetrieves the critical options set in the certificate.- Specified by:
getCriticalOptionsMapin interfaceOpenSshCertificate- Returns:
- the critical options as an unmodifiable map, never
nullbut possibly empty
-
getExtensions
Description copied from interface:OpenSshCertificateRetrieves the extensions set in the certificate.- Specified by:
getExtensionsin interfaceOpenSshCertificate- Returns:
- the extensions as an unmodifiable list, never
nullbut possibly empty - See Also:
-
getExtensionsMap
Description copied from interface:OpenSshCertificateRetrieves the extensions set in the certificate.- Specified by:
getExtensionsMapin interfaceOpenSshCertificate- Returns:
- the extensions as an unmodifiable map, never
nullbut possibly empty
-
getReserved
Description copied from interface:OpenSshCertificateRetrieves the "reserved" field of the certificate. OpenSSH currently doesn't use it and ignores it.- Specified by:
getReservedin interfaceOpenSshCertificate- Returns:
- the "reserved" field.
-
getCaPubKey
Description copied from interface:OpenSshCertificateRetrieves the CA public key of this certificate.- Specified by:
getCaPubKeyin interfaceOpenSshCertificate- Returns:
- the
PublicKey
-
getMessage
public byte[] getMessage()Description copied from interface:OpenSshCertificateRetrieves the raw byte content of the certificate, minus the signature. This is the data that was signed.- Specified by:
getMessagein interfaceOpenSshCertificate- Returns:
- the part of the certificate raw data that was signed
-
getSignature
public byte[] getSignature()Description copied from interface:OpenSshCertificateRetrieves the signature of the certificate, including the signature algorithm.- Specified by:
getSignaturein interfaceOpenSshCertificate- Returns:
- the signature bytes
- See Also:
-
getRawSignature
public byte[] getRawSignature()Description copied from interface:OpenSshCertificateRetrieves the raw signature bytes, without the signature algorithm.- Specified by:
getRawSignaturein interfaceOpenSshCertificate- Returns:
- the signature bytes
- See Also:
-
getSignatureAlgorithm
Description copied from interface:OpenSshCertificateRetrieves the signature algorithm used for the signature.- Specified by:
getSignatureAlgorithmin interfaceOpenSshCertificate- Returns:
- the signature algorithm as recorded in the certificate
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
getFormat
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey
-
setKeyType
-
setNonce
public void setNonce(byte[] nonce) -
setCertPubKey
-
setSerial
public void setSerial(long serial) -
setType
-
setId
-
setPrincipals
-
setValidAfter
public void setValidAfter(long validAfter) -
setValidAfter
If null, usesOpenSshCertificate.MIN_EPOCH- Parameters:
validAfter-Instantto use for validAfter
-
setValidBefore
public void setValidBefore(long validBefore) -
setValidBefore
If null, usesOpenSshCertificate.INFINITY- Parameters:
validBefore-Instantto use for validBefore
-
setCriticalOptions
Sets the critical options of the certificate, overriding any options set earlier.- Parameters:
criticalOptions- to set; may benullor empty to remove all previously set options
-
setCriticalOptions
Sets the critical options of the certificate, overriding any options set earlier.- Parameters:
criticalOptions- to set; may benullor empty to remove all previously set options
-
addCriticalOption
Adds a critical option to the certificate, or removes it ifvalue == null. To add an option with an empty value, use an empty string as value. If the certificate already has an option with the given name it is replaced.- Parameters:
name- of the option to setvalue- of the option- Returns:
trueif the map did not contain the name;falseif it did
-
setExtensions
Sets the extensions of the certificate, overriding any extensions set earlier.- Parameters:
extensions- to set; may benullor empty to remove all previously set extensions
-
setExtensions
Sets the extensions of the certificate, overriding any extensions set earlier.- Parameters:
extensions- to set; may benullor empty to remove all previously set extensions
-
addExtension
Adds an extension to the certificate, or removes it ifvalue == null. To add an extension with an empty value, use an empty string as value. If the certificate already has an extension with the given name it is replaced.- Parameters:
name- of the extension to setvalue- of the extension- Returns:
trueif the map did not contain the name;falseif it did
-
setReserved
-
setCaPubKey
-
setMessage
public void setMessage(byte[] message) -
setSignature
public void setSignature(byte[] signature) -
toString
-