Class UserAttributeSubpacketInputStream

java.lang.Object
java.io.InputStream
org.bouncycastle.bcpg.UserAttributeSubpacketInputStream
All Implemented Interfaces:
Closeable, AutoCloseable, UserAttributeSubpacketTags

public class UserAttributeSubpacketInputStream extends InputStream implements UserAttributeSubpacketTags
reader for user attribute sub-packets
  • Field Details

    • MAX_SUBPACKET_LEN

      public static final int MAX_SUBPACKET_LEN
      Hard upper bound on a single user-attribute subpacket body. This is an absolute cap applied independently of StreamUtil.findLimit(InputStream), which for the non-seekable streams used during packet parsing returns close to the JVM heap size and so does not bound the per-packet allocation. Without it a crafted 4-octet length header could force a multi-gigabyte new byte[] before any body bytes are read. 2 MiB matches the ceiling used for signature subpackets (SignaturePacket.MAX_SUBPACKET_LEN) and public-key packets (PublicKeyPacket.MAX_LEN); user-attribute (image) subpackets are not expected to approach it.
      See Also:
  • Constructor Details

    • UserAttributeSubpacketInputStream

      public UserAttributeSubpacketInputStream(InputStream in)
    • UserAttributeSubpacketInputStream

      public UserAttributeSubpacketInputStream(InputStream in, int limit)
  • Method Details