Package net.schmizz.sshj.common
Class KeyType.CertUtils
java.lang.Object
net.schmizz.sshj.common.KeyType.CertUtils
- Enclosing class:
KeyType
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Date
dateFromEpoch
(BigInteger seconds) private static BigInteger
epochFromDate
(Date date) (package private) static boolean
isCertificateOfType
(Key key, KeyType innerKeyType) static boolean
matchPattern
(String target, String pattern) This method must work exactly as match_pattern from match.c of OpenSSH.private static byte[]
private static byte[]
private static byte[]
packString
(String data) (package private) static <T extends PublicKey>
Certificate<T> readPubKey
(Buffer<?> buf, KeyType innerKeyType) (package private) static Certificate
<PublicKey> toCertificate
(PublicKey key) unpackList
(byte[] packedString) unpackMap
(byte[] packedString) private static String
unpackString
(byte[] packedString) static String
verifyHostCertificate
(byte[] certRaw, Certificate<?> cert, String hostname) (package private) static void
writePubKeyContentsIntoBuffer
(PublicKey publicKey, KeyType innerKeyType, Buffer<?> buf)
-
Field Details
-
ALL_SIGNATURES
-
-
Constructor Details
-
CertUtils
public CertUtils()
-
-
Method Details
-
readPubKey
static <T extends PublicKey> Certificate<T> readPubKey(Buffer<?> buf, KeyType innerKeyType) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
writePubKeyContentsIntoBuffer
-
verifyHostCertificate
public static String verifyHostCertificate(byte[] certRaw, Certificate<?> cert, String hostname) throws Buffer.BufferException, SSHRuntimeException - Parameters:
certRaw
- Already serialized host certificate that was received as a packet. Can be restored simply by callingnew Buffer.PlainBuffer().putPublicKey(cert)
cert
- A key with a certificate received from a server.hostname
- A hostname of the server. It is juxtaposed to the principals of the certificate.- Returns:
- null if the certificate is valid, an error message if it is not valid.
- Throws:
Buffer.BufferException
- If something fromcertRaw
orcert
can't be parsed.SSHRuntimeException
-
matchPattern
This method must work exactly as match_pattern from match.c of OpenSSH. If it works differently, consider it as a bug that must be fixed. -
isCertificateOfType
-
toCertificate
-
dateFromEpoch
-
epochFromDate
-
unpackString
- Throws:
Buffer.BufferException
-
unpackList
- Throws:
Buffer.BufferException
-
unpackMap
- Throws:
Buffer.BufferException
-
packString
-
packList
-
packMap
-