org.bouncycastle.openpgp.PGPPadding Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-debug-jdk15to18 Show documentation
Show all versions of bcpg-debug-jdk15to18 Show documentation
The Bouncy Castle Java API for handling the OpenPGP protocol. This jar contains the OpenPGP API for JDK 1.5 to JDK 1.8. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.
package org.bouncycastle.openpgp;
import java.io.IOException;
import org.bouncycastle.bcpg.BCPGInputStream;
import org.bouncycastle.bcpg.Packet;
import org.bouncycastle.bcpg.PaddingPacket;
/**
* The PGPPadding contains random data, and can be used to defend against traffic analysis on version 2 SEIPD messages
* and Transferable Public Keys.
*
* Such a padding packet MUST be ignored when received.
*/
public class PGPPadding
{
private PaddingPacket p;
/**
* Default constructor.
*
* @param in
* @throws IOException
*/
public PGPPadding(
BCPGInputStream in)
throws IOException
{
Packet packet = in.readPacket();
if (!(packet instanceof PaddingPacket))
{
throw new IOException("unexpected packet in stream: " + packet);
}
p = (PaddingPacket)packet;
}
public byte[] getPadding()
{
return p.getPadding();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy