Package org.jivesoftware.smackx.ox
Class OpenPgpMessage
- java.lang.Object
-
- org.jivesoftware.smackx.ox.OpenPgpMessage
-
public class OpenPgpMessage extends Object
This class embodies a decrypted and/or verifiedOpenPgpElement
.
The content can be one of the following threeOpenPgpContentElement
s:
SignElement
: The content is expected to be signed with the senders key, but unencrypted.
CryptElement
: The content is expected to be encrypted, but not signed.
SigncryptElement
: The content is expected to be signed with the senders key and encrypted.
To determine, of which nature the content of the message is, usegetState()
. You should utilize this information to cast the return value ofgetOpenPgpContentElement()
correctly.
UsegetMetadata()
in order to get information about the messages encryption status, its signatures etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpenPgpMessage.State
-
Constructor Summary
Constructors Constructor Description OpenPgpMessage(byte[] bytes, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)
Constructor.OpenPgpMessage(String content, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.pgpainless.decryption_verification.OpenPgpMetadata
getMetadata()
Return metadata about the encrypted message.OpenPgpContentElement
getOpenPgpContentElement()
Return the decryptedOpenPgpContentElement
of this message.OpenPgpMessage.State
getState()
Return the state of the message.
-
-
-
Constructor Detail
-
OpenPgpMessage
public OpenPgpMessage(String content, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)
Constructor.- Parameters:
content
- XML representation of the decryptedOpenPgpContentElement
.state
-OpenPgpMessage.State
of theOpenPgpContentElement
.metadata
- Metadata about the encryption.
-
OpenPgpMessage
public OpenPgpMessage(byte[] bytes, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)
Constructor.- Parameters:
bytes
- bytes of the XML representation of the decryptedOpenPgpContentElement
.state
-OpenPgpMessage.State
of theOpenPgpContentElement
.metadata
- metadata about the encryption.
-
-
Method Detail
-
getOpenPgpContentElement
public OpenPgpContentElement getOpenPgpContentElement() throws XmlPullParserException, IOException
Return the decryptedOpenPgpContentElement
of this message. To determine, whether the element is aSignElement
,CryptElement
orSigncryptElement
, please consultgetState()
.- Returns:
OpenPgpContentElement
- Throws:
XmlPullParserException
- if the parser encounters an error.IOException
- if the parser encounters an error.
-
getState
public OpenPgpMessage.State getState() throws IOException, XmlPullParserException
Return the state of the message. This value determines, whether the message was aSignElement
,CryptElement
orSigncryptElement
.- Returns:
- state of the content element.
- Throws:
IOException
- if the parser encounters an error.XmlPullParserException
- if the parser encounters and error.
-
getMetadata
public org.pgpainless.decryption_verification.OpenPgpMetadata getMetadata()
Return metadata about the encrypted message.- Returns:
- metadata TODO javadoc me please
-
-