Unix
Mac OS X
Windows
Options
Unix
Windows

# Module cipher Methods

## AcquireCipherInfo

AcquireCipherInfo() allocates the CipherInfo structure.

The format of the AcquireCipherInfo method is:

      CipherInfo *AcquireCipherInfo(const CipherType cipher,
        const CipherMode mode)

A description of each parameter follows:

##### cipher

The cipher type.

##### mode

The cipher mode.

## DecipherCipher

DecipherCipher() deciphers ciphertext and returns plaintext. The deciphering is performed in-place and DecipherCipher() returns a pointer to the ciphertext string.

The format of the DecipherCipher method is:

           StringInfo *DecipherCipher(CipherInfo *cipher_info,StringInfo *ciphertext)

A description of each parameter follows:

##### cipher_info

The cipher context.

##### ciphertext

The cipher text.

## DestroyCipherInfo

DestroyCipherInfo() zeros memory associated with the CipherInfo structure.

The format of the DestroyCipherInfo method is:

      CipherInfo *DestroyCipherInfo(CipherInfo *cipher_info)

A description of each parameter follows:

##### cipher_info

The cipher info.

## EncipherCipher

EncipherCipher() enciphers plaintext and returns ciphertext. The enciphering is performed in-place and EncipherCipher() returns a pointer to the plaintext string.

The format of the EncipherCipher method is:

           StringInfo *EncipherCipher(CipherInfo *cipher_info,StringInfo *plaintext)

A description of each parameter follows:

##### cipher_info

The cipher context.

##### plaintext

The plain text.

## GetCipherBlocksize

GetCipherBlocksize() returns the cipher blocksize.

The format of the GetCipherBlocksize method is:

      size_t GetCipherBlocksize(const CipherInfo *cipher_info)

A description of each parameter follows:

##### cipher_info

The cipher info.

## GenerateCipherNonce

GenerateCipherNonce() generate a nonce for the given cipher.

The format of the GenerateCipherNonce method is:

           StringInfo *GenerateCipherNonce(CipherInfo *cipher_info)

A description of each parameter follows:

##### cipher_info

The cipher context.

## GetCipherNonce

GetCipherNonce() returns a nonce of the cipher.

The format of the GetCipherNonce method is:

           const StringInfo *GetCipherNonce(CipherInfo *cipher_info)

A description of each parameter follows:

##### cipher_info

The cipher context.

## ResetCipherNonce

ResetCipherNonce() resets the initialization vector for the cipher.

The format of the ResetCipherNonce method is:

      ResetCipherNonce(CipherInfo *cipher_info)

A description of each parameter follows:

##### cipher_info

The cipher context.

## SetCipherNonce

SetCipherNonce() sets the initialization vector for the cipher.

The format of the SetCipherNonce method is:

      SetCipherNonce(CipherInfo *cipher_info,const StringInfo *nonce)

A description of each parameter follows:

##### cipher_info

The cipher context.

##### nonce

The initialization vector.

## SetCipherKey

SetCipherKey() sets the key for the cipher. The key length is specified in bits. Valid values are 128, 192, or 256.

The format of the SetCipherKey method is:

      SetCipherKey(CipherInfo *cipher_info,const StringInfo *key)

A description of each parameter follows:

##### cipher_info

The cipher context.

##### key

The key.

Discourse Server