Package org.jivesoftware.smackx.ox
Class OpenPgpMessage
- java.lang.Object
-
- org.jivesoftware.smackx.ox.OpenPgpMessage
-
public class OpenPgpMessage extends java.lang.Object
This class embodies a decrypted and/or verifiedOpenPgpElement.
The content can be one of the following threeOpenPgpContentElements:
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 classOpenPgpMessage.State
-
Constructor Summary
Constructors Constructor Description OpenPgpMessage(byte[] bytes, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)Constructor.OpenPgpMessage(java.lang.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.OpenPgpMetadatagetMetadata()Return metadata about the encrypted message.OpenPgpContentElementgetOpenPgpContentElement()Return the decryptedOpenPgpContentElementof this message.OpenPgpMessage.StategetState()Return the state of the message.
-
-
-
Constructor Detail
-
OpenPgpMessage
public OpenPgpMessage(java.lang.String content, OpenPgpMessage.State state, org.pgpainless.decryption_verification.OpenPgpMetadata metadata)
Constructor.- Parameters:
content- XML representation of the decryptedOpenPgpContentElement.state-OpenPgpMessage.Stateof 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.Stateof theOpenPgpContentElement.metadata- metadata about the encryption.
-
-
Method Detail
-
getOpenPgpContentElement
public OpenPgpContentElement getOpenPgpContentElement() throws XmlPullParserException, java.io.IOException
Return the decryptedOpenPgpContentElementof this message. To determine, whether the element is aSignElement,CryptElementorSigncryptElement, please consultgetState().- Returns:
OpenPgpContentElement- Throws:
XmlPullParserException- if the parser encounters an error.java.io.IOException- if the parser encounters an error.
-
getState
public OpenPgpMessage.State getState() throws java.io.IOException, XmlPullParserException
Return the state of the message. This value determines, whether the message was aSignElement,CryptElementorSigncryptElement.- Returns:
- state of the content element.
- Throws:
java.io.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
-
-