Bouncy Castle Cryptography Library 1.85

org.bouncycastle.bcpg
Class UserAttributeSubpacketInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.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.
 
Fields inherited from interface org.bouncycastle.bcpg.UserAttributeSubpacketTags
IMAGE_ATTRIBUTE
 
Constructor Summary
UserAttributeSubpacketInputStream(java.io.InputStream in)
           
UserAttributeSubpacketInputStream(java.io.InputStream in, int limit)
           
 
Method Summary
 int available()
           
 int read()
           
 UserAttributeSubpacket readPacket()
           
 
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
 

Field Detail

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
Constructor Detail

UserAttributeSubpacketInputStream

public UserAttributeSubpacketInputStream(java.io.InputStream in)

UserAttributeSubpacketInputStream

public UserAttributeSubpacketInputStream(java.io.InputStream in,
                                         int limit)
Method Detail

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

Bouncy Castle Cryptography Library 1.85