public class CipherTextSerializer extends Object
CipherText
objects. The serialization is done in
network-byte order which is the same as big-endian byte order.
This serialization scheme is documented in
Format of Portable Serialization of org.owasp.esapi.crypto.CipherText Objects
.
Other serialization schemes may be desirable and could be supported (notably, RFC 5083 - Cryptographic
Message Syntax (CMS) Authenticated-Enveloped-Data Content Type, or CMS' predecessor,
PKCS#7 (RFC 2315)), but these serialization schemes are by comparison very complicated,
and do not have extensive support for the various implementation languages which ESAPI
supports. (Perhaps wishful thinking that other ESAPI implementations such as
ESAPI for .NET, ESAPI for C, ESAPI for C++, etc. will all support a single, common
serialization technique so they could exchange encrypted data.)
Modifier and Type | Field and Description |
---|---|
static int |
cipherTextSerializerVersion |
Constructor and Description |
---|
CipherTextSerializer(byte[] cipherTextSerializedBytes)
Given byte array in network byte order (i.e., big-endian order), convert
it so that a
CipherText can be constructed from it. |
CipherTextSerializer(CipherText cipherTextObj) |
Modifier and Type | Method and Description |
---|---|
CipherText |
asCipherText()
Return the actual
CipherText object. |
byte[] |
asSerializedByteArray()
Return this
CipherText object as a specialized, portable
serialized byte array. |
public static final int cipherTextSerializerVersion
public CipherTextSerializer(CipherText cipherTextObj)
public CipherTextSerializer(byte[] cipherTextSerializedBytes) throws EncryptionException
CipherText
can be constructed from it.cipherTextSerializedBytes
- A serialized CipherText
object
with the bytes in network byte order.EncryptionException
- Thrown if a valid CipherText
object
cannot be reconstructed from the byte array.public byte[] asSerializedByteArray()
CipherText
object as a specialized, portable
serialized byte array.public CipherText asCipherText()
CipherText
object.CipherText
object that we are serializing.Copyright © 2023 The Open Worldwide Application Security Project (OWASP). All rights reserved.