java.lang.Object
iu.crypt.Jwe
- All Implemented Interfaces:
WebEncryption
JSON Web Encryption (JWE) implementation class.
-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.iu.crypt.WebEncryption
WebEncryption.Builder, WebEncryption.Encryption -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJwe(WebEncryption.Encryption encryption, boolean deflate, boolean compact, Set<String> protectedParameters, Iterable<JweRecipient> recipients, byte[] contentEncryptionKey, byte[] additionalData, InputStream in) Encrypts an outbound message.Verifies and prepares decryption of an inbound encrypted message. -
Method Summary
Modifier and TypeMethodDescriptioncompact()Gets the message encrypted for only this recipient in compact JWE format.voiddecrypt(WebKey key, OutputStream out) Decrypts the encrypted content.byte[]Gets the aad JWE attributebyte[]Gets the tag JWE attributebyte[]Gets the ciphertext JWE attributeGets the encryption algorithm.byte[]Gets the iv JWE attributeGets the recipients.booleanDetermines whether or not to compress content before encryption.toString()Gets the encrypted message in serialized JWE format.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.iu.crypt.WebEncryption
decrypt, decryptText
-
Field Details
-
JSON
-
-
Constructor Details
-
Jwe
Jwe(WebEncryption.Encryption encryption, boolean deflate, boolean compact, Set<String> protectedParameters, Iterable<JweRecipient> recipients, byte[] contentEncryptionKey, byte[] additionalData, InputStream in) Encrypts an outbound message.- Parameters:
encryption- content encryption algorithmdeflate- true to compress content before encryption; false to encrypt uncompressedcompact- true to verify as compact serializableprotectedParameters- parameter names to enforce as shared and include in the protected header, ignored when compact = truerecipients- message recipientscontentEncryptionKey- content encryption keyadditionalData- AEAD additional authentication datain- provides the plain text data to be encrypted
-
Jwe
Verifies and prepares decryption of an inbound encrypted message.- Parameters:
jwe- inbound encrypted message
-
-
Method Details
-
getEncryption
Description copied from interface:WebEncryptionGets the encryption algorithm.- Specified by:
getEncryptionin interfaceWebEncryption- Returns:
- encryption algorithm
-
isDeflate
public boolean isDeflate()Description copied from interface:WebEncryptionDetermines whether or not to compress content before encryption.- Specified by:
isDeflatein interfaceWebEncryption- Returns:
- true to compress content before encrypting; false to encrypt as-is
-
getRecipients
Description copied from interface:WebEncryptionGets the recipients.- Specified by:
getRecipientsin interfaceWebEncryption- Returns:
- recipients
-
getInitializationVector
public byte[] getInitializationVector()Description copied from interface:WebEncryptionGets the iv JWE attribute- Specified by:
getInitializationVectorin interfaceWebEncryption- Returns:
- iv JWE attribute
-
getCipherText
public byte[] getCipherText()Description copied from interface:WebEncryptionGets the ciphertext JWE attribute- Specified by:
getCipherTextin interfaceWebEncryption- Returns:
- ciphertext JWE attribute
-
getAuthenticationTag
public byte[] getAuthenticationTag()Description copied from interface:WebEncryptionGets the tag JWE attribute- Specified by:
getAuthenticationTagin interfaceWebEncryption- Returns:
- tag JWE attribute
-
getAdditionalData
public byte[] getAdditionalData()Description copied from interface:WebEncryptionGets the aad JWE attribute- Specified by:
getAdditionalDatain interfaceWebEncryption- Returns:
- aad JWE attribute
-
decrypt
Description copied from interface:WebEncryptionDecrypts the encrypted content.- Specified by:
decryptin interfaceWebEncryption- Parameters:
key- private or secret key; should be verified by the application as correct for the recipient before calling.out-OutputStreamto write the decrypted content to
-
compact
Description copied from interface:WebEncryptionGets the message encrypted for only this recipient in compact JWE format.- Specified by:
compactin interfaceWebEncryption- Returns:
- compact JWE
-
toString
Description copied from interface:WebEncryptionGets the encrypted message in serialized JWE format.- Specified by:
toStringin interfaceWebEncryption- Overrides:
toStringin classObject- Returns:
- serialized JWE
-