|
|||||||||
Home >> All >> cryptix >> openpgp >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
cryptix.openpgp.util
Class PGPArmoury

java.lang.Objectcryptix.openpgp.util.PGPArmoury
- public class PGPArmoury
- extends java.lang.Object
Methods for armouring and dearmouring of messages and other objects.
- Version:
- $Revision: 1.2 $
Field Summary | |
private java.util.Properties |
clearheaders
|
private byte[] |
clearText
Clear text of a clearsigned message as a sequence of bytes . |
private java.util.Properties |
headers
Headers of the armoured message. |
private byte[] |
payload
Signature, or self-contained armoured packet(s) |
private java.lang.String |
type
The type of the contained information |
static java.lang.String |
TYPE_PUBLIC_KEY
|
static java.lang.String |
TYPE_SECRET_KEY
|
Constructor Summary | |
PGPArmoury(byte[] payload)
Construct a PGP armored message from the given binary data, assuming default headers (version) and default type ("PGP MESSAGE") |
|
PGPArmoury(byte[] text,
byte[] signature)
Construct a PGP armored message from the given text and signature bytes assuming defaults for the headers. |
|
PGPArmoury(byte[] payload,
java.lang.String type)
Construct a PGP armored message from the given binary data and type, assuming default headers (version) |
|
PGPArmoury(java.util.Properties headers,
byte[] payload)
Construct a PGP armored message from the given binary data and headers, assuming the default type "PGP MESSAGE". |
|
PGPArmoury(java.util.Properties headers,
byte[] clearText,
byte[] signature)
Construct a PGP armoured message from the given headers, text and signature bytes. |
|
PGPArmoury(java.util.Properties headers,
byte[] payload,
java.lang.String type)
Construct a PGP armored message from the given binary data, type and headers. |
|
PGPArmoury(java.lang.String armouredText)
Construct a PGP armoured message from already-armoured data. |
Method Summary | |
private static java.util.Properties |
addMissingHeaders(java.util.Properties headers)
Given a set of headers, add the missing ones (version). |
static java.lang.String |
armour(byte[] bytes)
|
static java.lang.String |
canonicalize(java.lang.String s)
Remove trailing whitespace and replace all line endings with \r\n |
static java.lang.String |
dashProtect(java.lang.String s)
Prefix all vulnerable lines with "- ". |
static java.lang.String |
fixLineEndings(java.lang.String txt,
java.lang.String eol)
Fix line endings to a certain format |
byte[] |
getClearText()
Return the clear text part of this armoured message. |
private static java.util.Properties |
getDefaultHeaders()
Construct a default set of headers (version). |
java.util.Properties |
getHeaders()
Return the headers for this armoured message. |
byte[] |
getPayload()
Return the payload of this armoured message. |
private java.lang.String |
headersToString(java.util.Properties head)
|
static void |
main(java.lang.String[] args)
Static main method to armour and dearmour files. |
void |
parse(java.lang.String armouredMessage)
Unarmour an armoured message. |
(package private) static java.lang.String |
removeTrailingWhitespace(java.lang.String s)
Remove trailing whitespace |
private void |
stringToHeaders(java.lang.String s,
java.util.Properties head)
|
java.lang.String |
toString()
Armour an unarmoured message. |
static byte[] |
unarmour(java.lang.String s)
|
static java.lang.String |
undashProtect(java.lang.String s)
Remove all "- "s from the start of lines. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
TYPE_PUBLIC_KEY
public static final java.lang.String TYPE_PUBLIC_KEY
- See Also:
- Constant Field Values
TYPE_SECRET_KEY
public static final java.lang.String TYPE_SECRET_KEY
- See Also:
- Constant Field Values
headers
private java.util.Properties headers
- Headers of the armoured message.
clearheaders
private java.util.Properties clearheaders
clearText
private byte[] clearText
- Clear text of a clearsigned message as a sequence of bytes .
payload
private byte[] payload
- Signature, or self-contained armoured packet(s)
type
private java.lang.String type
- The type of the contained information
Constructor Detail |
PGPArmoury
public PGPArmoury(byte[] payload)
- Construct a PGP armored message from the given binary data,
assuming default headers (version) and default type ("PGP MESSAGE")
PGPArmoury
public PGPArmoury(byte[] payload, java.lang.String type)
- Construct a PGP armored message from the given binary data and type,
assuming default headers (version)
PGPArmoury
public PGPArmoury(java.util.Properties headers, byte[] payload)
- Construct a PGP armored message from the given binary data and
headers, assuming the default type "PGP MESSAGE". If no version header
is present the default version header is added.
PGPArmoury
public PGPArmoury(java.util.Properties headers, byte[] payload, java.lang.String type)
- Construct a PGP armored message from the given binary data, type and
headers. If no version header is present the default version header
is added.
PGPArmoury
public PGPArmoury(byte[] text, byte[] signature) throws java.lang.IllegalArgumentException
- Construct a PGP armored message from the given text and signature bytes
assuming defaults for the headers.
PGPArmoury
public PGPArmoury(java.util.Properties headers, byte[] clearText, byte[] signature)
- Construct a PGP armoured message from the given headers, text and
signature bytes. If no version header is present the default version
header is added.
PGPArmoury
public PGPArmoury(java.lang.String armouredText) throws java.lang.IllegalArgumentException
- Construct a PGP armoured message from already-armoured data.
Method Detail |
getHeaders
public java.util.Properties getHeaders()
- Return the headers for this armoured message.
getClearText
public byte[] getClearText()
- Return the clear text part of this armoured message.
getPayload
public byte[] getPayload()
- Return the payload of this armoured message.
armour
public static java.lang.String armour(byte[] bytes)
unarmour
public static byte[] unarmour(java.lang.String s)
headersToString
private java.lang.String headersToString(java.util.Properties head)
stringToHeaders
private void stringToHeaders(java.lang.String s, java.util.Properties head) throws java.lang.IllegalArgumentException
parse
public void parse(java.lang.String armouredMessage) throws java.lang.IllegalArgumentException
- Unarmour an armoured message.
toString
public java.lang.String toString()
- Armour an unarmoured message.
fixLineEndings
public static java.lang.String fixLineEndings(java.lang.String txt, java.lang.String eol)
- Fix line endings to a certain format
canonicalize
public static java.lang.String canonicalize(java.lang.String s)
- Remove trailing whitespace and replace all line endings with \r\n
removeTrailingWhitespace
static java.lang.String removeTrailingWhitespace(java.lang.String s)
- Remove trailing whitespace
dashProtect
public static java.lang.String dashProtect(java.lang.String s)
- Prefix all vulnerable lines with "- ".
undashProtect
public static java.lang.String undashProtect(java.lang.String s)
- Remove all "- "s from the start of lines.
addMissingHeaders
private static java.util.Properties addMissingHeaders(java.util.Properties headers)
- Given a set of headers, add the missing ones (version).
getDefaultHeaders
private static java.util.Properties getDefaultHeaders()
- Construct a default set of headers (version).
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Static main method to armour and dearmour files.
|
|||||||||
Home >> All >> cryptix >> openpgp >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |