org.bouncycastle.bcpg
Class UserAttributeSubpacketInputStream
java.lang.Object
java.io.InputStream
org.bouncycastle.bcpg.UserAttributeSubpacketInputStream
- All Implemented Interfaces:
- UserAttributeSubpacketTags
- public class UserAttributeSubpacketInputStream
- extends java.io.InputStream
- implements UserAttributeSubpacketTags
reader for user attribute sub-packets
|
Field Summary |
static int |
MAX_SUBPACKET_LEN
Hard upper bound on a single user-attribute subpacket body. |
| Methods inherited from class java.io.InputStream |
close, mark, markSupported, read, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 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:
- Constant Field Values
UserAttributeSubpacketInputStream
public UserAttributeSubpacketInputStream(java.io.InputStream in)
UserAttributeSubpacketInputStream
public UserAttributeSubpacketInputStream(java.io.InputStream in,
int limit)
available
public int available()
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Throws:
java.io.IOException
readPacket
public UserAttributeSubpacket readPacket()
throws java.io.IOException
- Throws:
java.io.IOException