com.adobe.flashaccess.sdk.media.drm
Class MediaEncrypter

java.lang.Object
  extended by com.adobe.flashaccess.sdk.media.drm.MediaEncrypter
Direct Known Subclasses:
F4VEncrypter, FLVEncrypter

public abstract class MediaEncrypter
extends java.lang.Object

Abstract base class for encrypting media content. Subclasses will handle specific file formats. An instance of this class may be used to encrypt multiple files, but should only be accessed from a single thread. Use MediaEncrypterFactory.getMediaEncrypter() to get an instance of a MediaEncrypter if you do not know the type of the content. Otherwise, you can use the constructors for the subclasses. After creating the MediaEncrypter instance, call MediaEncrypter.createEncrypterParameters(), MediaEncrypter.createSignatureParameters(), and MediaEncrypter.createKeyParameters(Class) and fill in the encryption options. Then, pass the parameters to MediaEncrypter.encryptContent(File, File, DRMParameters). If you pass the same KeyParameters object in multiple calls to MediaEncrypter.encryptContent(File, File, DRMParameters), the same key will be used to protect all the content; this situation is typically not recommended.


Method Summary
abstract  DRMParameters createEncrypterParameters()
          (abstract method) Gets a DRMParameters object to set encryption options.
static KeyParameters createKeyParameters(java.lang.Class keyParamsType)
          Gets a KeyParameters object to set options for retrieving encryption keys.
static SignatureParameters createSignatureParameters()
          Gets a SignatureParameters object to set signature options.
abstract  MediaEncrypterResult encryptContent(java.io.File in, java.io.File out, DRMParameters params)
          (abstract method) Encrypts the content in the specified file.
abstract  KeyMetaData examineEncryptedContent(java.io.File in)
          (abstract method) Examines content that has already been encrypted by the MediaEncrypter and returns information about the key used to protect the content.
 java.lang.String getMediaType()
          Gets the file type handled by this MediaEncrypter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMediaType

public java.lang.String getMediaType()
Gets the file type handled by this MediaEncrypter.

Returns:
The media type.

createEncrypterParameters

public abstract DRMParameters createEncrypterParameters()
(abstract method) Gets a DRMParameters object to set encryption options. Be sure to use DRMParameters.setSignatureParameters() and DRMParameters.setKeyParameters() to set these options. A DRMParameters instance can be reused to use the same options for protecting multiple pieces of content, but should only be used by one thread at a time.

Returns:
A DRMParameters object used to set encryption options.

createSignatureParameters

public static SignatureParameters createSignatureParameters()
Gets a SignatureParameters object to set signature options. Use DRMParameters.setSignatureParameters() to add to the DRMParameters instance. A SignatureParameters instance can be re-used to use the same options for protecting multiple pieces of content, but should only be used by one thread at a time.

Returns:
A SignatureParameters object used to set signature options.

createKeyParameters

public static KeyParameters createKeyParameters(java.lang.Class keyParamsType)
Gets a KeyParameters object to set options for retrieving encryption keys. Use DRMParameters.setKeyParameters() to add to the DRMParameters instance. A KeyParameters instance can be reused to use the same options for protecting multiple pieces of content, but should only be used by one thread at a time. If you reuse the same KeyParameters object in multiple calls to MediaEncrypter.encryptContent(File, File, DRMParameters), exactly the same key will be used to protect all the content; this situation is typically not recommended.

Parameters:
keyParamsType - Indicates the type of key (it must be a sub-interface of KeyParameters).
Returns:
A KeyParameters object used to set options for retrieving encryption keys.
Throws:
java.lang.IllegalArgumentException - if an invalid key parameter class is specified.

encryptContent

public abstract MediaEncrypterResult encryptContent(java.io.File in,
                                                    java.io.File out,
                                                    DRMParameters params)
                                             throws KeyRetrievalException,
                                                    java.io.IOException,
                                                    ServerCredentialException
(abstract method) Encrypts the content in the specified file. The source and destination must be files, not directories, and they must be different; otherwise an IllegalArgumentException will be thrown. This method will attempt to lock the destination file before writing any data; if the file cannot be locked because another process is editing it, an IOException will be thrown. If the destination file already exists, the contents will be overwritten. If an error occurs, the destination file may be invalid, so the caller should delete it.

Parameters:
in - The file containing the content to be encrypted.
out - The file to which to write encrypted content.
params - The encryption options.
Returns:
An object containing information about the encrypted content.
Throws:
ServerCredentialException
KeyRetrievalException
java.io.IOException

examineEncryptedContent

public abstract KeyMetaData examineEncryptedContent(java.io.File in)
                                             throws java.io.IOException
(abstract method) Examines content that has already been encrypted by the MediaEncrypter and returns information about the key used to protect the content.

Parameters:
in - The file containing the content to be encrypted.
Returns:
Key information or null if no key information was found.
Throws:
java.io.IOException


[an error occurred while processing this directive] [an error occurred while processing this directive]