public final class MediaDrm.CryptoSession extends Object
The CryptoSession class implements generic encrypt/decrypt/sign/verify methods based on the established session keys. These keys are exchanged using the getKeyRequest/provideKeyResponse methods.
Applications of this capability could include securing various types of purchased or private content, such as applications, books and other media, photos or media delivery protocols.
Operators can create session key servers that are functionally similar to a license key server, except that instead of receiving license key requests and providing encrypted content keys which are used specifically to decrypt A/V media content, the session key server receives session key requests and provides encrypted session keys which can be used for general purpose crypto operations.
A CryptoSession is obtained using MediaDrm.getCryptoSession(byte[], java.lang.String, java.lang.String)
Modifier and Type | Method and Description |
---|---|
byte[] |
decrypt(byte[] keyid,
byte[] input,
byte[] iv)
Decrypt data using the CryptoSessions's cipher algorithm
|
byte[] |
encrypt(byte[] keyid,
byte[] input,
byte[] iv)
Encrypt data using the CryptoSession's cipher algorithm
|
byte[] |
sign(byte[] keyid,
byte[] message)
Sign data using the CryptoSessions's mac algorithm.
|
boolean |
verify(byte[] keyid,
byte[] message,
byte[] signature)
Verify a signature using the CryptoSessions's mac algorithm.
|
public byte[] encrypt(byte[] keyid, byte[] input, byte[] iv)
keyid
- specifies which key to useinput
- the data to encryptiv
- the initialization vector to use for the cipherpublic byte[] decrypt(byte[] keyid, byte[] input, byte[] iv)
keyid
- specifies which key to useinput
- the data to encryptiv
- the initialization vector to use for the cipherpublic byte[] sign(byte[] keyid, byte[] message)
keyid
- specifies which key to usemessage
- the data for which a signature is to be computedpublic boolean verify(byte[] keyid, byte[] message, byte[] signature)
keyid
- specifies which key to usemessage
- the data to verifysignature
- the reference signature which will be compared with the
computed signature