Shawn Willden edited this page Mar 7, 2015 · 1 revision

Session Encryption and Decryption with Keyczar

Encrypts a symmetric key using another keyczar key and uses it to communicate across a session


All data is stored as byte arrays. There is no support for encoding.


Encrypter keyEncrypter = new Encrypter("/path/to/your/keys");
SessionCrypter crypter = new SessionCrypter(keyEncrypter);
byte[] encryptedData = crypter.encrypt(data);
byte[] sessionMaterial = crypter.getSessionMaterial();

The sender now sends the sessionMaterial and encryptedData to the Reciever.


Crypter keyCrypter = new Crypter("/path/to/their/keys");
SessionCrypter sessionCrypter = new SessionCrypter(keyCrypter, sessionMaterial);
byte[] decryptedData = sessionCrypter.decrypt(encryptedData);


All data is input as python strings and ciphertext and session material is WebSafeBase64 encoded. There is no support for other encodings.


key_encrypter = Encrypter.Read("/path/to/your/keys")
crypter = SessionEncrypter(key_encrypter)
encrypted_data = crypter.Encrypt(data)
session_material = crypter.getSessionMaterial()

The sender now sends the sessionMaterial and encrypted_data to the Reciever.


key_crypter = Crypter.Read("/path/to/their/keys")
session_decrypter = SessionDecrypter(key_crypter, session_material)
decryptedData = session_decrypter.Decrypt(encrypted_data)


C++ Sessions are incompatible with Java and Python Sessions. Issue 131 (on Google Code)

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.