Page 7 of 8

S/MIME email encryption/signing using Zend_Mail

Recently I wrote a class for ZF that one can use as a convenient tool for signing and/or encrypting email documents. The tricky thing was that MS Outlook Express did not want to treat it as Signed and Encrypted message unless you add “\n” to the end of the message , that was hard to find and I had to only experiment as there are…

PAdES (PKCS11) and Zend_Pdf

Similar to my last post about Zend_Mail S/MIME class, this one allows to digitally sign and even add TSA (timestamping) support to your PDF documents generated using Zend_Pdf. There is a standalone ASN1 parser included that can be used for other projects that require ASN1 data interchange. See¬†https://en.wikipedia.org/wiki/PAdES ,¬†https://www.ietf.org/rfc/rfc3161.txt for reference. The challenge was to add the BytesRange element with right byte bounds of the…

Performing authentication in custom validator in ZF

Although, this is not a good approach to use more than one value in Zend_Validate, but it may be useful sometimes if you want to write your custom validator and add it to let’s say password field and use it as other validators in Zend_Form. So $password->setRequired(true) ->setLabel(’Password’) ->addFilter(new Zend_Filter_StringTrim()) ->addValidator(new My_Custom_Password_Validator());

Removing duplicate rows in MySQL

Getting rid of duplicate table rows in mysql seems to be a very often issue. And there are few well-known solutions like e.g. creating temporary table and copying there only unique ones with group by and then drop the old and rename the newly one. But this solution is bad because we lose auto_increment counters and we might not have all grant privileges to do…

Page 7 of 8