Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.signing.ssh

pack-priv Class OpenSshBinaryKrl

extends Object
Class Inheritance
Imports
java.io.EOFException, .IOException, .InputStream, .StreamCorruptedException, java.nio.charset.StandardCharsets, java.security.MessageDigest, .NoSuchAlgorithmException, .PublicKey, java.text.MessageFormat, java.util.Arrays, .HashMap, .HashSet, .Map, .Set, org.apache.sshd.common.config.keys.OpenSshCertificate, org.apache.sshd.common.util.buffer.BufferUtils, .ByteArrayBuffer, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.api.errors.JGitInternalException, org.eclipse.jgit.internal.transport.sshd.SshdText, org.eclipse.jgit.util.IO, .StringUtils

An implementation of OpenSSH binary format key revocation lists (KRLs).
See Also
PROTOCOL.krl

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
OpenSshBinaryKrl.Blob

A byte array that can be used as a key in a Map or Set.

private static class

Field Summary

Modifier and TypeField and Description
private final Set<OpenSshBinaryKrl.Blob>
private static final int
private static final int
private static final int
private static final int
private static final int
private final Map<OpenSshBinaryKrl.Blob, OpenSshBinaryKrl.CertificateRevocation>
private static final int
pack-priv static final byte[]
MAGIC

The "magic" bytes at the start of an OpenSSH binary KRL.

private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private final Set<OpenSshBinaryKrl.Blob>
private final Set<OpenSshBinaryKrl.Blob>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private OpenSshBinaryKrl.Blob
private static long
private static long
private OpenSshBinaryKrl.Blob
hash(String algorithm, PublicKey key)

pack-priv boolean

Returns:

true if the key was revoked, false otherwise
isRevoked
(PublicKey
PublicKey to check
key
)

Tells whether the given key has been revoked.

private boolean
pack-priv static OpenSshBinaryKrl

Returns:

a new OpenSshBinaryKrl.
load
(InputStream
InputStream to read from
in
,
boolean
whether the MAGIC bytes at the beginning have already been skipped
magicSkipped
)

Loads a binary KRL from the given stream.

private static OpenSshBinaryKrl
private static void
readBlobs(String sectionName, Set<OpenSshBinaryKrl.Blob> blobs, InputStream in, long sectionLength, long expectedBlobLength)

private static void
private static void
readIds(Set<String> ids, InputStream in, long subLength)

private static void
readSerialBitSet(SerialRangeSet set, InputStream in, long subLength)

private static void
readSerials(SerialRangeSet set, InputStream in, long length, boolean ranges)

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blobsback to summary
private final Set<OpenSshBinaryKrl.Blob> blobs
CERT_EXTENSIONSback to summary
private static final int CERT_EXTENSIONS
CERT_KEY_IDSback to summary
private static final int CERT_KEY_IDS
CERT_SERIAL_BITSback to summary
private static final int CERT_SERIAL_BITS
CERT_SERIAL_LISTback to summary
private static final int CERT_SERIAL_LIST
CERT_SERIAL_RANGESback to summary
private static final int CERT_SERIAL_RANGES
certificatesback to summary
private final Map<OpenSshBinaryKrl.Blob, OpenSshBinaryKrl.CertificateRevocation> certificates
FORMAT_VERSIONback to summary
private static final int FORMAT_VERSION
MAGICback to summary
pack-priv static final byte[] MAGIC

The "magic" bytes at the start of an OpenSSH binary KRL.

SECTION_CERTIFICATESback to summary
private static final int SECTION_CERTIFICATES
SECTION_EXTENSIONback to summary
private static final int SECTION_EXTENSION
SECTION_KEYback to summary
private static final int SECTION_KEY
SECTION_SHA1back to summary
private static final int SECTION_SHA1
SECTION_SHA256back to summary
private static final int SECTION_SHA256
SECTION_SIGNATUREback to summary
private static final int SECTION_SIGNATURE
sha1back to summary
private final Set<OpenSshBinaryKrl.Blob> sha1
sha256back to summary
private final Set<OpenSshBinaryKrl.Blob> sha256

Constructor Detail

OpenSshBinaryKrlback to summary
private OpenSshBinaryKrl()

Method Detail

blobback to summary
private OpenSshBinaryKrl.Blob blob(PublicKey key)
getLongback to summary
private static long getLong(InputStream in) throws IOException
getUIntback to summary
private static long getUInt(InputStream in) throws IOException
hashback to summary
private OpenSshBinaryKrl.Blob hash(String algorithm, PublicKey key)
isRevokedback to summary
pack-priv boolean isRevoked(PublicKey key)

Tells whether the given key has been revoked.

Parameters
key:PublicKey

PublicKey to check

Returns:boolean

true if the key was revoked, false otherwise

isRevokedback to summary
private boolean isRevoked(OpenSshCertificate certificate, OpenSshBinaryKrl.CertificateRevocation revocations)
loadback to summary
pack-priv static OpenSshBinaryKrl load(InputStream in, boolean magicSkipped) throws IOException

Loads a binary KRL from the given stream.

Parameters
in:InputStream

InputStream to read from

magicSkipped:boolean

whether the MAGIC bytes at the beginning have already been skipped

Returns:OpenSshBinaryKrl

a new OpenSshBinaryKrl.

Annotations
@NonNull
Exceptions
IOException:
if the stream cannot be read as an OpenSSH binary KRL
loadback to summary
private static OpenSshBinaryKrl load(InputStream in) throws IOException
readBlobsback to summary
private static void readBlobs(String sectionName, Set<OpenSshBinaryKrl.Blob> blobs, InputStream in, long sectionLength, long expectedBlobLength) throws IOException
readCertificatesback to summary
private static void readCertificates(Map<OpenSshBinaryKrl.Blob, OpenSshBinaryKrl.CertificateRevocation> certs, InputStream in, long sectionLength) throws IOException
readIdsback to summary
private static void readIds(Set<String> ids, InputStream in, long subLength) throws IOException
readSerialBitSetback to summary
private static void readSerialBitSet(SerialRangeSet set, InputStream in, long subLength) throws IOException
readSerialsback to summary
private static void readSerials(SerialRangeSet set, InputStream in, long length, boolean ranges) throws IOException
skipHeaderback to summary
private static void skipHeader(InputStream in) throws IOException
org.eclipse.jgit.internal.signing.ssh back to summary

private final Record OpenSshBinaryKrl.Blob

extends Record
Class Inheritance
Annotations
@SuppressWarnings:ArrayRecordComponent
Record Components
blob:byte[]
the array to wrap

A byte array that can be used as a key in a Map or Set. equals(Object) and hashCode() are based on the content.

Field Summary

Modifier and TypeField and Description
private final byte[]
blob

Record Component accessed by blob().

the array to wrap

Constructor Summary

AccessConstructor and Description
private
Blob(byte[] blob)

Method Summary

Modifier and TypeMethod and Description
public byte[]
blob()

Record Component getter of blob.

Record Component the array to wrap

public final boolean
equals(Object
the reference object with which to compare.
any
)

Implements abstract java.lang.Record.equals.

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

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

blobback to summary
private final byte[] blob

Record Component accessed by blob().

the array to wrap

Constructor Detail

Blobback to summary
private Blob(byte[] blob)

Method Detail

blobback to summary
public byte[] blob()

Record Component getter of blob.

Record Component
the array to wrap
equalsback to summary
public final boolean equals(Object any)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
Parameters
any:Object

the reference object with which to compare.

Returns:boolean

true if this record is equal to the argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

Returns:int

a hash code value for this record.

Annotations
@Override
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

Returns:String

a string representation of the object.

org.eclipse.jgit.internal.signing.ssh back to summary

private Class OpenSshBinaryKrl.CertificateRevocation

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.signing.ssh.OpenSshBinaryKrl.CertificateRevocation

Field Summary

Modifier and TypeField and Description
pack-priv final Set<String>
pack-priv final SerialRangeSet

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyIdsback to summary
pack-priv final Set<String> keyIds
rangesback to summary
pack-priv final SerialRangeSet ranges

Constructor Detail

CertificateRevocationback to summary
private CertificateRevocation()