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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intHard upper bound on a single user-attribute subpacket body.Fields inherited from interface UserAttributeSubpacketTags
IMAGE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class InputStream
close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
MAX_SUBPACKET_LEN
public static final int MAX_SUBPACKET_LENHard upper bound on a single user-attribute subpacket body. This is an absolute cap applied independently ofStreamUtil.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-gigabytenew 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
-
UserAttributeSubpacketInputStream
-
-
Method Details
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
readPacket
- Throws:
IOException
-