Made to Order Software Corporation Logo

libsswf: sswf::TagProtect Class Reference

Mark the movie as protected. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagProtect:

:TagBase :MemoryManager

List of all members.


Public Member Functions

virtual ErrorManager::error_code_t Save (Data &data)
 Save the protect tag in a Data buffer.
void SetEncodedPassword (const char *password)
 Set pre-encoded password for movie protection.
void SetPassword (const char *password)
 Set a non-encoded password for movie protection.
 TagProtect (TagBase *parent)
 Initialize the TagProtect object.
virtual swf_type_t TypeFlags (void) const
 Check the type of the TagProtect tag.

Private Member Functions

virtual ErrorManager::error_code_t ParseTag (swf_tag_t tag, const Data &data)
 Parse data from a file into a Protect tag.
virtual ErrorManager::error_code_t PreSave (void)
 Defines the minimum version required for this tag.

Private Attributes

char * f_password

Detailed Description

The TagProtect object is used to mark a movie as protected against piracy. This is just a tag. The movie itself is not otherwise protected. Macromedia asks that movies marked as protected not be editable by a graphical tool. However, an tool can choose to ignore or not that tag.

You should put this tag close to the beginning of the movie.

Since version 5, it is possible to add a password in the movie itself. The password is encrypted using some MD5 algorithm. Note that, password or not, the entire movie can still be read anyway!

See also:
SWF Alexis' Reference—Protect

SWF Alexis' Reference—swf_tag


Constructor & Destructor Documentation

TagProtect::TagProtect ( TagBase parent  ) 

The TagProtect tag marks a movie as protected against piracy... The truth is that this is just a tag. All the other tags remain the same and are not in any way encoded. So the protection holds only if the tools you are using honor that protection. And since many tools in existance already do not (or can be used to remove this tag) that's not very much of a protection.

The tag used will depend on the version of the movie being saved.

  • SWF_TAG_PROTECT (up to version 4)
  • SWF_TAG_PROTECT_DEBUG (version 5)
  • SWF_TAG_PROTECT_DEBUG2 (version 6+)
Parameters:
parent The TagHeader where the TagProtect needs to be created

References f_password.


Member Function Documentation

ErrorManager::error_code_t TagProtect::ParseTag ( swf_tag_t  tag,
const Data data 
) [private, virtual]

This function reads the password saved in the Protect tag.

Note that the password is kept encrypted.

Parameters:
[in] tag The tag that generated this call
[in] data The Data buffer from the Flash file being loaded
Returns:
An error if one occurs, or ErrorManager::ERROR_CODE_NONE

Implements sswf::TagBase.

References sswf::Data::ByteSize(), sswf::ErrorManager::ERROR_CODE_NONE, f_password, sswf::Data::GetShort(), sswf::Data::GetString(), sswf::MemoryManager::MemClean(), sswf::TagBase::SWF_TAG_PROTECT, and sswf::TagBase::SWF_TAG_PROTECT_DEBUG2.

ErrorManager::error_code_t TagProtect::PreSave ( void   )  [private, virtual]

The TagProtect object requires a minimum version of 2 unless a password is defined in which case the minimum version is 5.

Reimplemented from sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, f_password, and sswf::TagBase::MinimumVersion().

ErrorManager::error_code_t TagProtect::Save ( Data data  )  [virtual]

Saves the Protect tag in the specified Data buffer.

The SWF tag is chosen depending on the version of the movie:

2 to 4 -- SWF_TAG_PROTECT 5 -- SWF_TAG_PROTECT_DEBUG 6+ -- SWF_TAG_PROTECT_DEBUG2

Parameters:
data A data buffer where the TagProtect is saved
Returns:
This function returns 0 on success, non zero otherwise

Implements sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, f_password, sswf::Data::PutShort(), sswf::TagBase::SaveTag(), sswf::TagBase::SWF_TAG_PROTECT, sswf::TagBase::SWF_TAG_PROTECT_DEBUG, sswf::TagBase::SWF_TAG_PROTECT_DEBUG2, sswf::TagBase::Version(), and sswf::Data::Write().

void TagProtect::SetEncodedPassword ( const char *  password  ) 

This function can be used to define the protection password.

In this case the library takes care of the password encoding.

Parameters:
password A pre-encoded MD5 password

References f_password, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

void TagProtect::SetPassword ( const char *  password  ) 

This function can be used to define the protection password.

In this case the library takes care of the password encoding.

Note:
This function is not yet implemented.
Parameters:
password A clear text password to protect the movie

References sswf::assert(), f_password, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

TagBase::swf_type_t TagProtect::TypeFlags ( void   )  const [virtual]

Defines the generic type of this tag. You should put only one in the whole movie, it should be close to the start of the movie and it is considered as being a control tag.

Returns:
Control, Unique and Start

Implements sswf::TagBase.

References SWF_TYPE_CONTROL, SWF_TYPE_START, and SWF_TYPE_UNIQUE.


Member Data Documentation


The documentation for this class was generated from the following files:


Generated on Wed Mar 18 15:13:59 2009 for libsswf by  doxygen 1.5.5