Package org.jivesoftware.smackx.ox
Class OpenPgpMessage
java.lang.Object
org.jivesoftware.smackx.ox.OpenPgpMessage
This class embodies a decrypted and/or verified
The content can be one of the following three
To determine, of which nature the content of the message is, use
Use
OpenPgpElement
.
The content can be one of the following three
OpenPgpContentElement
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, use
getState()
. You should utilize this
information to cast the return value of getOpenPgpContentElement()
correctly.
Use
getMetadata()
in order to get information about the messages encryption status, its signatures etc.-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionOpenPgpMessage
(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
Modifier and TypeMethodDescriptionorg.pgpainless.decryption_verification.OpenPgpMetadata
Return metadata about the encrypted message.Return the decryptedOpenPgpContentElement
of this message.getState()
Return the state of the message.
-
Constructor Details
-
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 Details
-
getOpenPgpContentElement
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
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
Return metadata about the encrypted message.- Returns:
- metadata TODO javadoc me please
-