public final class KeyBlob extends Object implements EncryptedDataKey
Constructor and Description |
---|
KeyBlob()
Default constructor.
|
KeyBlob(EncryptedDataKey edk) |
KeyBlob(String keyProviderId,
byte[] keyProviderInfo,
byte[] encryptedDataKey)
Construct a key blob using the provided key, key provider identifier, and key provider
information.
|
Modifier and Type | Method and Description |
---|---|
int |
deserialize(byte[] b,
int off)
Deserialize the provided bytes starting at the specified offset to construct an instance of
this class.
|
byte[] |
getEncryptedDataKey()
Return the encrypted data key set in the header.
|
int |
getEncryptedDataKeyLen()
Return the length of the encrypted data key set in the header.
|
int |
getKeyProviderIdLen()
Return the length of the key provider identifier set in the header.
|
int |
getKeyProviderInfoLen()
Return the length of the key provider info set in the header.
|
String |
getProviderId()
Return the key provider identifier set in the header.
|
byte[] |
getProviderInformation()
Return the information on the key provider set in the header.
|
boolean |
isComplete()
Check if this object has all the header fields populated and available for reading.
|
void |
setEncryptedDataKey(byte[] encryptedDataKey)
Set the encrypted data key.
|
void |
setKeyProviderId(String keyProviderId)
Set the key provider identifier.
|
void |
setKeyProviderInfo(byte[] keyProviderInfo)
Set the information on the key provider identifier.
|
byte[] |
toByteArray()
Serialize an instance of this class to a byte array.
|
public KeyBlob()
public KeyBlob(String keyProviderId, byte[] keyProviderInfo, byte[] encryptedDataKey)
keyProviderId
- the key provider identifier string.keyProviderInfo
- the bytes containing the key provider info.encryptedDataKey
- the encrypted bytes of the data key.public KeyBlob(EncryptedDataKey edk)
public int deserialize(byte[] b, int off)
This method parses the provided bytes for the individual fields in this class. This methods also supports partial parsing where not all the bytes required for parsing the fields successfully are available.
b
- the byte array to deserialize.off
- the offset in the byte array to use for deserialization.public byte[] toByteArray()
public boolean isComplete()
public int getKeyProviderIdLen()
public String getProviderId()
getProviderId
in interface EncryptedDataKey
public int getKeyProviderInfoLen()
public byte[] getProviderInformation()
getProviderInformation
in interface EncryptedDataKey
public int getEncryptedDataKeyLen()
public byte[] getEncryptedDataKey()
getEncryptedDataKey
in interface EncryptedDataKey
public void setKeyProviderId(String keyProviderId)
keyProviderId
- the key provider identifier.public void setKeyProviderInfo(byte[] keyProviderInfo)
keyProviderInfo
- the bytes containing information on the key provider identifier.public void setEncryptedDataKey(byte[] encryptedDataKey)
encryptedDataKey
- the bytes containing the encrypted data key.Copyright © 2023. All rights reserved.