21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

a<br />

Buffer containing optional data that you would like to authenticate, but that<br />

does not need to be encrypted, such as plaintext headers in the HTTP protocol.<br />

alen<br />

Length of extra authentication data buffer, specified in bytes. It may be zero if<br />

there is no such data.<br />

pt<br />

Buffer containing the plaintext you would like to encrypt and authenticate.<br />

ptlen<br />

Length of the plaintext buffer. It may be zero if there is no data to be encrypted.<br />

nonce<br />

Pointer to an 11-byte buffer, which must be unique for each message. (See Recipe<br />

4.9 for hints on nonce selection.)<br />

output<br />

Buffer into which the ciphertext is written. This buffer must always be at least<br />

ptlen + 16 bytes in size because the message grows by 16 bytes when the<br />

authentication value is added.<br />

This function always succeeds. The cwc_decrypt_message( ) function, on the other<br />

hand, returns 1 on success, and 0 on failure. Failure occurs only if the message integrity<br />

check fails, meaning the data has somehow changed since it was originally<br />

encrypted. This function has the following arguments:<br />

ctx<br />

Pointer to the cwc_t context object.<br />

a<br />

Buffer containing optional data that you would like to authenticate, but that was<br />

not encrypted, such as plaintext headers in the HTTP protocol.<br />

alen<br />

Length of extra authentication data buffer, specified in bytes. It may be zero if<br />

there is no such data.<br />

ct<br />

Buffer containing the ciphertext you would like to authenticate and decrypt if it<br />

is valid.<br />

ctlen<br />

Length of the ciphertext buffer. It may be zero if there is no data to be decrypted.<br />

nonce<br />

Pointer to an 11-byte buffer, which must be unique for each message. (See Recipe<br />

4.9 for hints on nonce selection.)<br />

204 | Chapter 5: Symmetric Encryption<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!