Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.openpgp.packet
Class PGPOnePassSignaturePacket  view PGPOnePassSignaturePacket download PGPOnePassSignaturePacket.java

java.lang.Object
  extended bycryptix.openpgp.packet.PGPPacket
      extended bycryptix.openpgp.packet.PGPOnePassSignaturePacket

public class PGPOnePassSignaturePacket
extends PGPPacket

A class representing a one-pass signature packet.

This packet both has a binary and a plaintext form. While RFC 2440 only lists the binary form of this packet, we also support the 'Hash:' armour header key in clearsigned messages.

Because the plaintext form contains less information than the binary form, not all get methods will work with the plaintext form, in fact only the getHashID and the isNested method work. Fortunately these two are also the only useful ones for one pass signatures, so applications are encouraged not to depend on the other information contained in a binary one-pass signature packet.

Version:
$Revision: 1.2 $

Field Summary
private  byte algid
           
private  byte hashid
           
private  byte[] keyid
           
private  boolean nested
           
private  byte type
           
private  byte version
           
 
Fields inherited from class cryptix.openpgp.packet.PGPPacket
 
Constructor Summary
PGPOnePassSignaturePacket()
          Emtpy constructor for binary one pass signature packets This constructor is used by PGPPacketFactory, which calls the decode method to decode a binary one pass signature packet
PGPOnePassSignaturePacket(byte type, byte hashid, byte algid, byte[] keyid, boolean nested)
          Constructor for binary one pass signature packets
PGPOnePassSignaturePacket(java.lang.String id, boolean nested)
          Constructor for plain-text one pass signature packets
PGPOnePassSignaturePacket(java.lang.String id, boolean nested, cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
          Constructor for plain-text one pass signature packets using a specific PGPAlgorithmFactory
 
Method Summary
 void decodeBody(cryptix.openpgp.io.PGPPacketDataInputStream in, cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
          Decode the packet body
 void encodeBody(cryptix.openpgp.io.PGPPacketDataOutputStream out)
          Encode the packet body
 boolean equals(java.lang.Object ssp)
          Compare this packet to another one.
 byte getAlgorithmID()
          Return the id of the public key algorithm used in the signature
 byte getHashID()
          Return the id of the hash algorithm used in the signature
 byte[] getKeyID()
          Return the 8 byte / 64 bit key ID for this signing key
 byte getType()
          Return the type of the signature
 byte getVersion()
          Return the version number of this packet
 boolean isNested()
          Return if the message has multiple nested signatures
 
Methods inherited from class cryptix.openpgp.packet.PGPPacket
encode, getForceLengthType, getPacketID, hashCode, isLazy, setPacketID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

private byte version

type

private byte type

hashid

private byte hashid

algid

private byte algid

keyid

private byte[] keyid

nested

private boolean nested
Constructor Detail

PGPOnePassSignaturePacket

public PGPOnePassSignaturePacket()
Emtpy constructor for binary one pass signature packets This constructor is used by PGPPacketFactory, which calls the decode method to decode a binary one pass signature packet


PGPOnePassSignaturePacket

public PGPOnePassSignaturePacket(java.lang.String id,
                                 boolean nested)
Constructor for plain-text one pass signature packets


PGPOnePassSignaturePacket

public PGPOnePassSignaturePacket(java.lang.String id,
                                 boolean nested,
                                 cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
Constructor for plain-text one pass signature packets using a specific PGPAlgorithmFactory


PGPOnePassSignaturePacket

public PGPOnePassSignaturePacket(byte type,
                                 byte hashid,
                                 byte algid,
                                 byte[] keyid,
                                 boolean nested)
Constructor for binary one pass signature packets

Method Detail

getHashID

public byte getHashID()
Return the id of the hash algorithm used in the signature

A list of possible values can be found in cryptix.openpgp.algorithm.PGPConstants


getVersion

public byte getVersion()
Return the version number of this packet

Note: this method does not work for a plaintext one-pass signature packet


getType

public byte getType()
Return the type of the signature

A list of possible values can be found in cryptix.openpgp.packet.PGPSignatureConstants

Note: this method does not work for a plaintext one-pass signature packet


getAlgorithmID

public byte getAlgorithmID()
Return the id of the public key algorithm used in the signature

A list of possible values can be found in cryptix.openpgp.algorithm.PGPConstants

Note: this method does not work for a plaintext one-pass signature packet


getKeyID

public byte[] getKeyID()
Return the 8 byte / 64 bit key ID for this signing key

Note: this method does not work for a plaintext one-pass signature packet


isNested

public boolean isNested()
Return if the message has multiple nested signatures

RFC 2440 says about this:

[If this method returns true, it] indicates that the next packet is another One-Pass Signature packet that describes another signature to be applied to the same message data.

Note that if a message contains more than one one-pass signature, then the signature packets bracket the message; that is, the first signature packet after the message corresponds to the last one-pass packet and the final signature packet corresponds to the first one- pass packet.


equals

public boolean equals(java.lang.Object ssp)
Compare this packet to another one.

Specified by:
equals in class PGPPacket

encodeBody

public void encodeBody(cryptix.openpgp.io.PGPPacketDataOutputStream out)
                throws java.io.IOException
Encode the packet body

Specified by:
encodeBody in class PGPPacket

decodeBody

public void decodeBody(cryptix.openpgp.io.PGPPacketDataInputStream in,
                       cryptix.openpgp.algorithm.PGPAlgorithmFactory factory)
                throws java.io.IOException,
                       cryptix.openpgp.PGPFatalDataFormatException,
                       cryptix.openpgp.PGPDataFormatException
Decode the packet body

Specified by:
decodeBody in class PGPPacket