paragonie / pco_prototype

PCO - PHP Crypto Objects
Do What The F*ck You Want To Public License
12 stars 1 forks source link

Key class? #3

Closed paragonie-scott closed 8 years ago

paragonie-scott commented 9 years ago

Instead of allowing arbitrary strings (and running the risk that someone might want to encrypt with the string "MySecretPassword"), should we create a Key class to encapsulate this behavior?

Example Class Hierarchy:

PCO\Key
|\__ SymmetricKey
\___ AsymmetricKeyPair
     |\___ PrivateKey
     \___ PublicKey

See https://github.com/paragonie/halite_cookie/blob/master/src/Key.php for an example of how I have used it before. (Although, we need not be so strict!)

paragonie-scott commented 8 years ago

Using typed keys is much easier to reason about than just string data.