# MagickCore, C API: Convert to and from Cipher Pixels @ ImageMagick
ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Author: ImageMagick Studio LLC
Keywords: magickcore, c, api:, convert, to, from, cipher, pixels, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert

AcquireAESInfo • DestroyAESInfo • EncipherAESBlock • PasskeyDecipherImage • PasskeyEncipherImage • SetAESKey • PasskeyDecipherImage • PasskeyEncipherImage

## AcquireAESInfo

AcquireAESInfo() allocate the AESInfo structure.

The format of the AcquireAESInfo method is:

    AESInfo *AcquireAESInfo(void)

## DestroyAESInfo

DestroyAESInfo() zeros memory associated with the AESInfo structure.

The format of the DestroyAESInfo method is:

    AESInfo *DestroyAESInfo(AESInfo *aes_info)

A description of each parameter follows:

aes_info
  the cipher context.

## EncipherAESBlock

EncipherAESBlock() enciphers a single block of plaintext to produce a block of ciphertext.

The format of the EncipherAESBlock method is:

    void EncipherAES(AESInfo *aes_info,const unsigned char *plaintext,
      unsigned char *ciphertext)

A description of each parameter follows:

aes_info
  the cipher context.
plaintext
  the plain text.
ciphertext
  the cipher text.

## PasskeyDecipherImage

PasskeyDecipherImage() converts cipher pixels to plain pixels.

The format of the PasskeyDecipherImage method is:

    MagickBooleanType PasskeyDecipherImage(Image *image,
      const StringInfo *passkey,ExceptionInfo *exception)
    MagickBooleanType DecipherImage(Image *image,const char *passphrase,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
passphrase
  decipher cipher pixels with this passphrase.
passkey
  decrypt cipher pixels with this passkey.
exception
  return any errors or warnings in this structure.

## PasskeyEncipherImage

PasskeyEncipherImage() converts pixels to cipher-pixels.

The format of the PasskeyEncipherImage method is:

    MagickBooleanType PasskeyEncipherImage(Image *image,
      const StringInfo *passkey,ExceptionInfo *exception)
    MagickBooleanType EncipherImage(Image *image,const char *passphrase,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
passphrase
  encipher pixels with this passphrase.
passkey
  decrypt cipher pixels with this passkey.
exception
  return any errors or warnings in this structure.

## SetAESKey

SetAESKey() sets the key for the AES cipher. The key length is specified in bits. Valid values are 128, 192, or 256 requiring a key buffer length in bytes of 16, 24, and 32 respectively.

The format of the SetAESKey method is:

    SetAESKey(AESInfo *aes_info,const StringInfo *key)

A description of each parameter follows:

aes_info
  the cipher context.
key
  the key.

## PasskeyDecipherImage

PasskeyDecipherImage() converts cipher pixels to plain pixels.

The format of the PasskeyDecipherImage method is:

    MagickBooleanType PasskeyDecipherImage(Image *image,
      const StringInfo *passkey,ExceptionInfo *exception)
    MagickBooleanType DecipherImage(Image *image,const char *passphrase,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
passphrase
  decipher cipher pixels with this passphrase.
passkey
  decrypt cipher pixels with this passkey.
exception
  return any errors or warnings in this structure.

## PasskeyEncipherImage

PasskeyEncipherImage() converts pixels to cipher-pixels.

The format of the PasskeyEncipherImage method is:

    MagickBooleanType PasskeyEncipherImage(Image *image,
      const StringInfo *passkey,ExceptionInfo *exception)
    MagickBooleanType EncipherImage(Image *image,const char *passphrase,
      ExceptionInfo *exception)

A description of each parameter follows:

passphrase
  decipher cipher pixels with this passphrase.
passkey
  decrypt cipher pixels with this passkey.
exception
  return any errors or warnings in this structure.