OCB Mode

From Crypto++ Wiki
Jump to navigation Jump to search
OCB Mode
Documentation
#include <cryptopp/ocb.h>

OCB mode, or Offset Cookbook mode, is an authenticated encryption mode of operation for block ciphers. OCB mode was designed by Phillip Rogaway, Mihir Bellare, John Black, and Ted Krovetz. OCB is unique in that it was the first single-pass authenticated encryption mode. Also see OCB: A Block-Cipher Mode of Operation forEfficient Authenticated Encryption.

Crypto++ offers OCB3 from RFC 7253. OCB1 and OCB3 from 2011 are considered secure, but OCB2 was proven insecure.

Crypto++ offers several modes of operation, including ECB, CBC, OFB, CFB, CBC-CTS, CTR, XTS, CCM, EAX, GCM and OCB.

Crypto++ does not provide a way to retrieve the current IV or counter used for encryption or decryption. If you need the current IV or counter then you need to manage it yourself. Some ciphers allow you to seek a number of bytes or blocks in the stream.

If you are used to working in languages like Java or libraries like OpenSSL, then you might want to visit the Init-Update-Final wiki page. Crypto++ provides the transformation model, but its not obvious because its often shrouded behind Pipelines.

Note: if your project is using encryption alone to secure your data, encryption alone is usually not enough. Please take a moment to read Authenticated Encryption and consider using an algorithm or mode like CCM, GCM, EAX or ChaCha20Poly1305.