cipher.html 7.68 KB
Newer Older
Cristy's avatar
Cristy committed
1 2 3 4




cristy's avatar
cristy committed
5
<!DOCTYPE html>
cristy's avatar
cristy committed
6
<html lang="en">
cristy's avatar
cristy committed
7
<head>
Cristy's avatar
...  
Cristy committed
8 9
  <meta charset="utf-8"  />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"  />
Cristy's avatar
Cristy committed
10
  <title>Encipher or Decipher an Image @ ImageMagick</title>
Cristy's avatar
...  
Cristy committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
  <meta name="application-name" content="ImageMagick" />
  <meta name="description" content="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." />
  <meta name="application-url" content="https://www.imagemagick.org" />
  <meta name="generator" content="PHP" />
  <meta name="keywords" content="encipher, or, decipher, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert" />
  <meta name="rating" content="GENERAL" />
  <meta name="robots" content="INDEX, FOLLOW" />
  <meta name="generator" content="ImageMagick Studio LLC" />
  <meta name="author" content="ImageMagick Studio LLC" />
  <meta name="revisit-after" content="2 DAYS" />
  <meta name="resource-type" content="document" />
  <meta name="copyright" content="Copyright (c) 1999-2017 ImageMagick Studio LLC" />
  <meta name="distribution" content="Global" />
  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
Cristy's avatar
...  
Cristy committed
25
  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
Cristy's avatar
...  
Cristy committed
26 27 28 29
  <link href="https://www.imagemagick.org/script/cipher.html" rel="canonical" />
  <link href="../images/wand.png" rel="icon" />
  <link href="../images/wand.ico" rel="shortcut icon" />
  <link href="css/magick.css" rel="stylesheet" />
cristy's avatar
cristy committed
30
</head>
cristy's avatar
cristy committed
31
<body>
Cristy's avatar
...  
Cristy committed
32
<div class="magick-masthead">
cristy's avatar
cristy committed
33
  <div class="container">
Cristy's avatar
Cristy committed
34
    <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
Cristy's avatar
Cristy committed
35 36 37 38
         style="display:block"
         data-ad-client="ca-pub-3129977114552745"
         data-ad-slot="6345125851"
         data-ad-format="auto"></ins>
cristy's avatar
cristy committed
39
    <script>
Cristy's avatar
Cristy committed
40
      (adsbygoogle = window.adsbygoogle || []).push({});
cristy's avatar
cristy committed
41
    </script>
Cristy's avatar
...  
Cristy committed
42 43 44 45 46 47 48 49 50
    <nav class="nav magick-nav">
      <a class="nav-link " href="../index.html">Home</a>
      <a class="nav-link " href="download.html">Download</a>
      <a class="nav-link " href="command-line-tools.html">Tools</a>
      <a class="nav-link " href="command-line-processing.html">Command-line</a>
      <a class="nav-link " href="resources.html">Resources</a>
      <a class="nav-link " href="develop.html">Develop</a>
      <a class="nav-link " href="https://www.imagemagick.org/script/search.php">Search</a>
      <a class="nav-link float-right" href="https://www.imagemagick.org/discourse-server/">Community</a>
cristy's avatar
cristy committed
51 52 53 54 55 56 57 58
    </nav>
  </div>
</div>
<div class="container">
<div class="magick-header">
<p class="text-center"><a href="cipher.html#encipher">Encipher an Image</a><a href="cipher.html#decipher">Decipher an Image</a><a href="cipher.html#caveats">Encipher and Decipher Caveats</a></p>

<p class="lead magick-description">Most images, by design, are made to be viewed often and by many people.  Web images, for example, may be viewed hundreds of times a day by a multitude of vistors.  However, in some cases, you may want to keep a particular image private so that only you or perhaps a select group of your friends or web visitors can view it.  ImageMagick permits you to scramble your images such that unless someone knows your passphrase, they will be unable to view the original content.</p>
cristy's avatar
cristy committed
59 60 61

<p>You could use an <a href="http://www.wizards-toolkit.org/www/encipher.html">enciphering</a> utility to scramble your image but they typically scramble the entire file making it unrecognizable as an image format.  With ImageMagick, only the pixels are scrambled.  The scrambled image continues to be recognized as an image and will even display in your web page.  However, the content appears as gibberish, nothing like the original content.</p>

Cristy's avatar
...  
Cristy committed
62
<h2 class="magick-post-title"><a id="encipher"></a>Encipher an Image</h2>
cristy's avatar
cristy committed
63

cristy's avatar
cristy committed
64
<p>Use the <a href="command-line-options.html#encipher">-encipher</a> option to scramble your image so that it is unrecognizable.  The option requires a filename that contains your passphrase.  In this example we scramble an image and save it in the PNG format:</p>
cristy's avatar
cristy committed
65

Cristy's avatar
...  
Cristy committed
66
<pre><code>
cristy's avatar
cristy committed
67
convert rose.jpg -encipher passphrase.txt rose.png
Cristy's avatar
...  
Cristy committed
68
</code></pre>
cristy's avatar
cristy committed
69

cristy's avatar
cristy committed
70
<p>Here we encipher an image using another image as the passphrase:</p>
cristy's avatar
cristy committed
71

Cristy's avatar
...  
Cristy committed
72
<pre><code>
cristy's avatar
cristy committed
73
convert rose.jpg -encipher smiley.gif rose.png
Cristy's avatar
...  
Cristy committed
74
</code></pre>
cristy's avatar
cristy committed
75

Cristy's avatar
...  
Cristy committed
76
<h2 class="magick-post-title"><a id="decipher"></a>Decipher an Image</h2>
cristy's avatar
cristy committed
77

cristy's avatar
cristy committed
78
<p>Use the <a href="command-line-options.html#decipher">-decipher</a> option to unscramble your image so that it is recognizable once again.  The option requires a filename that contains your passphrase.  In this example we unscramble an image and save it in the JPEG format:</p>
cristy's avatar
cristy committed
79

Cristy's avatar
...  
Cristy committed
80
<pre><code>
cristy's avatar
cristy committed
81
convert rose.png -decipher passphrase.txt rose.jpg
Cristy's avatar
...  
Cristy committed
82
</code></pre>
cristy's avatar
cristy committed
83

Cristy's avatar
...  
Cristy committed
84
<h2 class="magick-post-title"><a id="caveats"></a>Encipher and Decipher Caveats</h2>
cristy's avatar
cristy committed
85

cristy's avatar
cristy committed
86 87
<p>Some formats do not support enciphered pixels-- the JPEG or GIF format, for
example.  To ensure your image format is supported, encipher a test image and
cristy's avatar
cristy committed
88
verify you can restore its original content <var>before</var> you encipher any
cristy's avatar
cristy committed
89
additional images in that format.</p>
cristy's avatar
cristy committed
90

cristy's avatar
cristy committed
91
<p>The image format may only support 8-bit and RGB (TrueColor). As such you may
cristy's avatar
cristy committed
92
like to include the options "-depth 8 -type TrueColor" before the output
cristy's avatar
cristy committed
93
filename.</p>
cristy's avatar
cristy committed
94

cristy's avatar
cristy committed
95 96 97 98 99
<p>The passphrase can be any combinations of letters and symbols.  It should
be a minimum of 12 character combinations to help ensure your image remains
private.  Also make sure your passphrase file permissions prevent others from
reading it otherwise unintended users may be able to view the original image
content.</p>
cristy's avatar
cristy committed
100

cristy's avatar
cristy committed
101 102 103
<p>You can only restore the original image content if you know your
passphrase.  If you lose or forget it, your original image content is lost
forever.</p>
cristy's avatar
cristy committed
104

cristy's avatar
cristy committed
105 106
<p>ImageMagick only scrambles the image pixels.  The image metadata remains
untouched and readable by anyone with access to the image file.</p>
cristy's avatar
cristy committed
107

Cristy's avatar
Cristy committed
108 109
<p>ImageMagick uses the <a
href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a>
cristy's avatar
cristy committed
110
cipher in Counter mode.  We use the the first half of your passphrase to derive the nonce.  The second half is the cipher key. When used correctly, AES-CTR provides a high level of confidentiality. To avoid information leaks, you must use a fresh passphrase for each image your encrypt.</p>
cristy's avatar
cristy committed
111 112

<p>Currently only ImageMagick can restore your enciphered image content.  We
Cristy's avatar
Cristy committed
113
use a standard cipher and mode so other vendors could support enciphered image content.</p>
cristy's avatar
cristy committed
114 115

<p>Some small practical examples of image enciphering can be found in IM
Cristy's avatar
...  
Cristy committed
116
Examples <a href="https://www.imagemagick.org/Usage/transform/#encipher"
Cristy's avatar
Cristy committed
117
>Encrypting Image Data</a>. </p>
cristy's avatar
cristy committed
118 119 120

</div>
  <footer class="magick-footer">
cristy's avatar
cristy committed
121 122
    <p><a href="support.html">Donate</a>
     <a href="sitemap.html">Sitemap</a>
cristy's avatar
cristy committed
123
    <a href="links.html">Related</a>
Cristy's avatar
...  
Cristy committed
124
    <a href="security-policy.html">Security</a>
cristy's avatar
cristy committed
125
    <a href="architecture.html">Architecture</a>
cristy's avatar
cristy committed
126 127
</p>
    <p><a href="cipher.html#">Back to top</a>
cristy's avatar
cristy committed
128
    <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
Cristy's avatar
Cristy committed
129
    <a href="https://www.imagemagick.org/script/contact.php">Contact Us</a></p>
Cristy's avatar
Cristy committed
130
        <p><small>© 1999-2017 ImageMagick Studio LLC</small></p>
cristy's avatar
cristy committed
131 132 133
  </footer>
</div><!-- /.container -->

Cristy's avatar
...  
Cristy committed
134
  <script src="https://localhost/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Cristy's avatar
Cristy committed
135
  <script src="../js/magick.html"></script>
cristy's avatar
cristy committed
136
</body>
cristy's avatar
cristy committed
137
</html>
Cristy's avatar
...  
Cristy committed
138
<!-- Magick Cache 24th August 2017 20:35 -->