CakeFest 2025 Madrid: The Official CakePHP Conference

Voting

: three plus zero?
(Example: nine)

The Note You're Voting On

hfuecks at nospam dot org
17 years ago
openssl_seal() can work well when you need to pass data securely to other platforms / languages. What openssl_seal() does is;

1. Generate a random key
2. Encrypt the data symmetrically with RC4 using the random key
3. Encrypt the random key itself with RSA using the public key / certificate
4. Returns the encrypted data and the encrypted key

So to decrypt the steps are simply;

1. Decrypt the key using RSA and your private key
2. Decrypt the data using RC4 and the decrypted key

The trickiest part may be figuring out how handle the private key - BouncyCastle ( http://www.bouncycastle.org/ ) provides a PEMReader for Java and C# while Not Yet commons-ssl ( http://juliusdavies.ca/commons-ssl/ ) has a KeyStoreBuilder to build Java keystores out of a PEM certificate.

A complete example in Java is described at http://blog.local.ch/archive/2007/10/29/openssl-php-to-java.html

<< Back to user notes page

To Top