#include <libsswf.h>
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 |
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!
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.
parent | The TagHeader where the TagProtect needs to be created |
References f_password.
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.
[in] | tag | The tag that generated this call |
[in] | data | The Data buffer from the Flash file being loaded |
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
data | A data buffer where the TagProtect is saved |
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.
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.
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.
Implements sswf::TagBase.
References SWF_TYPE_CONTROL, SWF_TYPE_START, and SWF_TYPE_UNIQUE.
char* sswf::TagProtect::f_password [private] |
Referenced by ParseTag(), PreSave(), Save(), SetEncodedPassword(), SetPassword(), and TagProtect().