org.bouncycastle.bcpg.Packet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-jdk14 Show documentation
Show all versions of bcpg-jdk14 Show documentation
The Bouncy Castle Java API for handling the OpenPGP protocol. This jar contains the OpenPGP API for JDK 1.4. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
The newest version!
package org.bouncycastle.bcpg;
/**
*/
public class Packet
implements PacketTags
{
private final int packetTag;
private final boolean newPacketFormat;
// for API compatibility
public Packet()
{
this(RESERVED);
}
Packet(int packetTag)
{
this(packetTag, false);
}
Packet(int packetTag, boolean newPacketFormat)
{
this.packetTag = packetTag;
this.newPacketFormat = newPacketFormat;
}
/**
* Return the tag of the packet.
*
* @return packet tag
*/
public final int getPacketTag()
{
return packetTag;
}
/**
* Return true, if this instance of a packet was encoded using the new packet format.
* If the packet was encoded using the old legacy format, return false instead.
*
* @return true if new packet format encoding is used
*/
public boolean hasNewPacketFormat()
{
return newPacketFormat;
}
/**
* Returns whether the packet is to be considered critical for v6 implementations.
* Packets with tags less or equal to 39 are critical.
* Tags 40 to 59 are reserved for unassigned, non-critical packets.
* Tags 60 to 63 are non-critical private or experimental packets.
*
* @see
* OpenPGP - Packet Tags
* @return true if the packet is critical, false otherwise.
*/
public boolean isCritical()
{
return getPacketTag() <= 39;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy