Encipher/DecipherImage doesn't round-trip in 6.4.6-0

Post any defects you find in the released or beta versions of the ImageMagick software here. The ImageMagick maintainers carefully monitor this list and will work diligently to repair any reported problems. When posting a bug report, please specify both the ImageMagick version and operating system you are using.

Encipher/DecipherImage doesn't round-trip in 6.4.6-0

Postby rmagick » 2008-11-22T16:45:32+00:00

The following program enciphers an image, then deciphers it. In 6.4.5-8, the deciphered image has the same signature as the original image. In 6.4.6-0 the signatures are different.

The input image is Image as usual.

Code: Select all
/*

Tim Hunter, cyclists@nc.rr.com

gcc `Magick-config --cflags --cppflags` test_encipher.c `Magick-config --ldflags --libs` -o test_encipher
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <magick/MagickCore.h>

int main(int argc,char **argv)
{
    ImageInfo *info;
    Image *image, *enc;
    const char *image_sig, *enc_sig;
    ExceptionInfo exception;
    MagickBooleanType okay;


    InitializeMagick(argv[0]);

    puts(GetMagickVersion(NULL));

    GetExceptionInfo(&exception);

    info = CloneImageInfo(NULL);
    strcpy(info->filename, "Flower_Hat.jpg");
    image = ReadImage(info, &exception);
    if (exception.severity != UndefinedException)
    {
        printf("ReadImage: %s: %s", exception.reason, exception.description);
        exit(1);
    }

    enc = CloneImage(image, 0, 0, MagickTrue, &exception);
    okay = EncipherImage(enc, "passphrase", &exception);
    if (!okay)
    {
        exit(1);
    }
    okay = DecipherImage(enc, "passphrase", &exception);
    if (!okay)
    {
        exit(1);
    }

    SignatureImage(image);
    SignatureImage(enc);

    image_sig = GetImageProperty(image, "signature");
    enc_sig = GetImageProperty(enc, "signature");

    printf("Image: %64s\n", image_sig);
    printf("Enc:   %64s\n", enc_sig);

    DestroyExceptionInfo(&exception);
    DestroyImageInfo(info);
    DestroyImage(image);
    DestroyImage(enc);
    DestroyMagick();

    exit(0);
}
rmagick
 
Posts: 245
Joined: 2006-03-16T17:30:48+00:00
Location: Durham, NC, USA

Re: Encipher/DecipherImage doesn't round-trip in 6.4.6-0

Postby magick » 2008-11-22T19:43:30+00:00

We have patch for the problem you reported. It will be available in the next point release. Thanks.
User avatar
magick
Site Admin
 
Posts: 5671
Joined: 2003-05-31T11:32:55+00:00


Return to Bugs

Who is online

Users browsing this forum: Alexa [Bot], MSN [Bot], Yahoo [Bot] and 1 guest