FileDocCategorySizeDatePackage
EncryptionChunkReader.javaAPI DocJaudiotagger 2.0.44165Wed Mar 30 16:11:50 BST 2011org.jaudiotagger.audio.asf.io

EncryptionChunkReader

public class EncryptionChunkReader extends Object implements ChunkReader
This class reads the chunk containing encoding data
Warning:
Implementation is not completed. More analysis of this chunk is needed.
author
Christian Laireiter

Fields Summary
private static final org.jaudiotagger.audio.asf.data.GUID[]
APPLYING
The GUID this reader {@linkplain #getApplyingIds() applies to}
Constructors Summary
protected EncryptionChunkReader()
Should not be used for now.


               
      
        // NOTHING toDo
    
Methods Summary
public booleancanFail()
{@inheritDoc}

        return false;
    
public org.jaudiotagger.audio.asf.data.GUID[]getApplyingIds()
{@inheritDoc}

        return APPLYING.clone();
    
public org.jaudiotagger.audio.asf.data.Chunkread(org.jaudiotagger.audio.asf.data.GUID guid, java.io.InputStream stream, long chunkStart)
{@inheritDoc}

        EncryptionChunk result;
        final BigInteger chunkLen = Utils.readBig64(stream);
        result = new EncryptionChunk(chunkLen);

        // Can't be interpreted
        /*
         * Object ID GUID 128 Object Size QWORD 64 Secret Data Length DWORD 32
         * Secret Data INTEGER varies Protection Type Length DWORD 32 Protection
         * Type char varies Key ID Length DWORD 32 Key ID char varies License
         * URL Length DWORD 32 License URL char varies * Read the
         */
        byte[] secretData;
        byte[] protectionType;
        byte[] keyID;
        byte[] licenseURL;

        // Secret Data length
        int fieldLength;
        fieldLength = (int) Utils.readUINT32(stream);
        // Secret Data
        secretData = new byte[fieldLength + 1];
        stream.read(secretData, 0, fieldLength);
        secretData[fieldLength] = 0;

        // Protection type Length
        fieldLength = 0;
        fieldLength = (int) Utils.readUINT32(stream);
        // Protection Data Length
        protectionType = new byte[fieldLength + 1];
        stream.read(protectionType, 0, fieldLength);
        protectionType[fieldLength] = 0;

        // Key ID length
        fieldLength = 0;
        fieldLength = (int) Utils.readUINT32(stream);
        // Key ID
        keyID = new byte[fieldLength + 1];
        stream.read(keyID, 0, fieldLength);
        keyID[fieldLength] = 0;

        // License URL length
        fieldLength = 0;
        fieldLength = (int) Utils.readUINT32(stream);
        // License URL
        licenseURL = new byte[fieldLength + 1];
        stream.read(licenseURL, 0, fieldLength);
        licenseURL[fieldLength] = 0;

        result.setSecretData(new String(secretData));
        result.setProtectionType(new String(protectionType));
        result.setKeyID(new String(keyID));
        result.setLicenseURL(new String(licenseURL));

        result.setPosition(chunkStart);

        return result;