<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2009-04-23T16:41:23Z</created-at>
  <description></description>
  <id type="integer">1412</id>
  <name>Home</name>
  <number type="integer">22</number>
  <person-id type="integer">2581</person-id>
  <text>__TOC__

= BACKGROUND =

Many of the tools made available to store and retrieve files using Cloud Storage services such as Amazon S3 assume that the content will be stored &quot;as is&quot;.  There are many scenarios where it would be better to first encrypt the content before storing into the Cloud (and automatically decrypt it upon retrieval).  

The goal of this software project is to provide this necessary function, namely to provide front-end encryption and decryption capabilities to augment existing tools that can already store and retrieve files in the Cloud.  In addition, this tool will provide useful secondary functions such as compression and support for splitting/merging files that may be larger than a given threshold.  Strong security algorithms and providers will be used, and this tool will support a variety of encryption key types (as supported by the underlying providers).

= VERSIONS = 

* v0.1 - Initial release supporting Amazon S3.
* v0.2 - Added support for Sun Cloud.
* v0.3 - Added support for the Cloud Safety Box (CSB) simplified use command.
* v0.4 - Added support for compression, file splitting, and key labels (Solaris provider only).

= FUNCTIONALITY =

This tool supports the following modes of operation:

   * encryption
   * compression
   * splitting

in addition to any commands that can be passed through to the back-end functionality (e.g., list, remove, etc.)  For &quot;put&quot; operations, compression is done before encryption and splitting is done last (if needed).  The reverse process is used for &quot;get&quot; operations.

The cryptographic operations performed by these tools are enabled by OpenSSL (or the Solaris Cryptographic Framework on Solaris 10 or OpenSolaris).  By default, OpenSSL is used as it enables the greatest level of portability.  To use the Solaris cryptographic operations, use the &quot;-p solaris&quot; command line option.  Note that on platforms using the UltraSPARC T2 (Niagara 2) processor, these cryptographic operations can be hardware accelerated.

All of the command line options as well as common use cases are available from the tool's usage message available using the &quot;-h&quot;
command line option to the ''s3-crypto.ksh'' command.  Note that in addition, the Cloud Safety Box, ''csb'', command is also provided to enable a simple, easy to use interface at the expense of some measure of flexibility.  If you want more control than what ''csb'' provides, simply use the ''s3-crypto.ksh'' script directly.

= FUNCTIONAL DIAGRAM =

[[image: s3-crypto-diagram-v0.2.png]]

= DEPENDENCIES =

These software modules are just front-end components and must be used with a back-end component that performs the actual operations against the Storage Cloud.  To date, this software has been tested against both the Sun Cloud Storage Service and the Amazon Simple Storage Service (S3) using the &quot;Another S3 Bash Interface&quot; tool published by &quot;nescafe5&quot; at:

   [http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1081]

Thanks to &quot;nescafe5&quot; for posting this great tool.  It is expected that this software can be easily adapted to other CLI back-end software components, however.  To use with the Sun Cloud, this script must be modified to access ''object.storage.network.com'' in place of ''s3.amazonaws.com''.

'''Note''': By default, the &quot;Another S3 Bash Interface&quot; tool is configured to use HTTP not HTTPS.  It is strongly recommended that HTTPS be used wherever possible.  To enable HTTPS, change the ''curl'' command entry from ''http'' to ''https''.  Also, one of the [http://curl.haxx.se/docs/sslcerts.html curl SSL certificate verification] steps must also be performed.

'''Note''': By default, the ''s3-crypto.sh'' and ''csb'' programs will attempt to call the &quot;Another S3 Bash Interface&quot; command as ''s3''.  If this functionality was saved under a different name, simply use the ''S3C_CLI_CMD_NAME'' environment variable, setting its value to be the name of the program to be executed.  For example:
   $ export S3C_CLI_CMD_NAME=&quot;s3-suncloud&quot;


= DOWNLOAD =

Currently, this software is accessible from a Mercurial [http://kenai.com/projects/s3-crypto/sources/source/show source code repository] and a (tar) [http://kenai.com/projects/s3-crypto/downloads bundle].


= CSB USAGE =

To create a new storage bucket:
      csb put bucket


To remove an empty storage bucket:
      csb rm bucket


To display a listing of storage buckets:
      csb buckets


To display the contents of a specified bucket:
      csb ls bucket


To put a file into a specified bucket:
      csb put bucket local_file [remote_file]


To get a file from a specified bucket:
      csb get bucket remote_file [local_file]


To remove a file from a specified bucket:
      csb rm bucket remote_file


To remove all files from a specified bucket:
      csb rmrf bucket



= CSB EXAMPLES =


To display a listing of storage buckets:

      $ ./csb buckets
      test-bucket-a
      test-bucket-b
      test-bucket-c


To display the contents of a bucket:

      $ ./csb ls test-bucket-a
      test-file-1
      test-file-2
      test-file-3


To compress, encrypt and put a file (split if necessary) into a bucket: 

      $ ./csb put test-bucket-a /export/myfile myfile
      enter aes-256-cbc encryption password:
      Verifying - enter aes-256-cbc encryption password:


To get (reassembling if necessary), decrypt and decompress a file from
a bucket:

      $ ./csb get test-bucket-a myfile ./new_myfile
      enter aes-256-cbc decryption password:


To remove a file from a specified bucket:

      $ ./csb rm test-bucket-a myfile


To remove all files from a specified bucket:

      $ ./csb rmrf test-bucket-a


= S3-CRYPTO.SH USAGE =

To generate a new encryption/decryption key:
      ./s3-crypto.ksh -m genkey -k key_file [-s key_size]


To display a listing of storage buckets:
      ./s3-crypto.ksh -m buckets


To display the contents of a specified bucket:
      ./s3-crypto.ksh -m ls -b bucket


To put a file into a specified bucket:
      ./s3-crypto.ksh -m put -b bucket -l local_file -r remote_file


To compress and put a file into a specified bucket:
      ./s3-crypto.ksh -C -m put -b bucket -l local_file -r remote_file


To encrypt and put a file into a specified bucket:
      ./s3-crypto.ksh -c [ [-a enc_alg] [-p crypto_provider] [-k key_file |-K key_label] ]
         -m put -b bucket -l local_file -r remote_file


To get a file from a specified bucket:
      ./s3-crypto.ksh -m get -b bucket -r remote_file [-l local_file]


To get and decompress a file from a specified bucket:
      ./s3-crypto.ksh -C -m get -b bucket -r remote_file [-l local_file]


To get and decrypt a file from a specified bucket:
      ./s3-crypto.ksh -c [ [-a enc_alg] [-p crypto_provider] [-k key_file | -K key_label] ] -m get -b bucket
         -r remote_file [-l local_file]


To remove a file from a specified bucket:
      ./s3-crypto.ksh -m rm -b bucket -r remote_file


To remove all files from a specified bucket:
      ./s3-crypto.ksh -m rmrf -b bucket


Specific options:

-a.  The name of the encryption algorithm to be used.  The default is aes (Solaris encryption) and aes-256-cbc for OpenSSL.  Valid names are those defined by the encrypt(1) and openssl(5) commands.

-b.  The name of the bucket on the Storage Cloud.

-c.  Enable encryption (put) / decryption (get).

-C.  Enable compression (put) / decompression (get).

-h.  Display this message.

-k.   The name of the key file used only for cryptographic operations when the -c option is selected.  If this parameter is not specified, then the program will prompt the user for  a passphrase to be used for encrypt/decrypt operations.

-K.  (Solaris cryptographic provider only).  Specify the key label of a symmetric token key in a PKCS#11 token.

-l.  The name (path) to the local file.

-L.  The maximum file size limit (in Kbytes) used to determine if an input file should be split into chunks for upload.

-m.   The mode of operation.  Values include:
           * buckets.  list (your) Storage Cloud buckets
           * genkey.  generate a key (file) for crypto operations
           * get.  get a file from the Storage Cloud
           * ls.  list the contents of a Storage Cloud bucket
           * put.  put a file into the Storage Cloud
           * rm.  remove a file from a Storage Cloud bucket
           * rmrf.  remove all files from a Storage Cloud bucket

-p.  The cryptographic services provider, currently either &quot;openssl&quot;  (default) or &quot;solaris&quot;.

-r.  The name of the remote file.

-s.  The size of the key file to be generated (in bytes).  This parameter is only used with the genkey command mode.

-S.  Split the file into chunks if its size is greater than 4 GB (default) or the size specified by the &quot;-L&quot; (size limit) option.


= S3-CRYPTO.SH EXAMPLES =

These examples are based upon the use of this tool with the &quot;Another S3 Bash Interface&quot; tool discussed above.

To generate a encryption/decryption key

      $ ./s3-crypto.ksh -m genkey -k ./my_key -s 32


To display a listing of storage buckets:

      $ ./s3-crypto.ksh -m buckets
      test-bucket-a
      test-bucket-b
      test-bucket-c


To display the contents of a bucket:

      $ ./s3-crypto.ksh -m ls -b test-bucket-a
      test-file-1
      test-file-2
      test-file-3


To create a new bucket:

      $ ./s3-crypto.ksh -m put -b new-bucket


To compress a file before storing it in a bucket:

      $ ./s3-crypto.ksh -C -m put -b test-bucket-a \
      -l ./myfile -r cloudfile


To encrypt a file before storing it in a bucket (OpenSSL
w/key generated from passphrase):

      $ ./s3-crypto.ksh -c -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
      enter aes-256-cbc encryption password:
      Verifying - enter aes-256-cbc encryption password:


To encrypt a file before storing it in a bucket (OpenSSL
w/user-supplied key file):

      $ ./s3-crypto.ksh -c -m put -b test-bucket-a \
      -k ./my_key -l ./myfile -r cloudfile


To encrypt a file before storing it in a bucket (Solaris
w/key generated from passphrase):

      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
      Enter passphrase: 
      Re-enter passphrase: 


To encrypt a file before storing it in a bucket (Solaris
w/user-supplied key file):

      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -k ./my_key -l ./myfile -r cloudfile


To encrypt a file before storing it in a bucket (Solaris
w/user-supplied key label):

      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -K my_key_label -l ./myfile -r cloudfile
      Enter PIN for Sun Software PKCS#11 softtoken  : 


To split a file before storing it in a bucket:

      $ ./s3-crypto.ksh -S -m put -b test-bucket-a \
      -l ./myfile -r cloudfile


To compress, encrypt and split a file before storing it in
a bucket (OpenSSL w/key generated from passphrase):

      $ ./s3-crypto.ksh -C -c -S -m put -b test-bucket-a \
      -l ./myfile -r cloudfile


To reassemble a file after retrieving it from a bucket:

      $ ./s3-crypto.ksh -S -m get -b test-bucket-a \
      -l ./new_file -r cloudfile


To decrypt a file after retreiving it from a bucket (OpenSSL
w/key generated from passphrase):

      $ ./s3-crypto.ksh -c -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
      enter aes-256-cbc decryption password:


To decrypt a file after retreiving it from a bucket (OpenSSL
w/user-supplied key file):

      $ ./s3-crypto.ksh -c -m get -b test-bucket-a \
      -k ./my_key -l ./new_file -r cloudfile


To decrypt a file after retreiving it from a bucket (Solaris
w/key generated from passphrase):

      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
      Enter passphrase: 


To decrypt a file after retreiving it from a bucket (Solaris
w/user-supplied key file):

      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -k ./my_key -l ./new_file -r cloudfile


To decrypt a file after retreiving it from a bucket (Solaris
w/user-supplied key label):

      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -K my_key_label -l ./new_file -r cloudfile
      Enter PIN for Sun Software PKCS#11 softtoken  : 


To decompress a file after retrieving it from a bucket:

      $ ./s3-crypto.ksh -C -m get -b test-bucket-a \
      -l ./new_file -r cloudfile


To reassemble, decrypt and decompress a file after retrieving
it from a bucket (OpenSSL w/key generated from passphrase):

      $ ./s3-crypto.ksh -C -c -S -m get -b test-bucket-a \
      -l ./new_file -r cloudfile


To remove a file from a specified bucket:

      $ ./s3-crypto.ksh -m rm -b test-bucket-a -r cloudfile


To remove all files from a specified bucket:

      $ ./s3-crypto.ksh -m rmrf -b test-bucket-a 


To remove a bucket:

      $ ./s3-crypto.ksh -m rm -b test-bucket-a

</text>
  <text-as-html>&lt;div id='toc' class='toc'&gt;
           &lt;div id='toctitle' class='toc-title'&gt;
             &lt;span&gt;Contents&lt;/span&gt;
           &lt;/div&gt;
           &lt;div id='toccontents' class='toc-contents'&gt;&lt;ul&gt;&lt;li&gt;1 &lt;a href='#BACKGROUND'&gt; BACKGROUND &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2 &lt;a href='#VERSIONS'&gt; VERSIONS &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;3 &lt;a href='#FUNCTIONALITY'&gt; FUNCTIONALITY &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;4 &lt;a href='#FUNCTIONAL_DIAGRAM'&gt; FUNCTIONAL DIAGRAM &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5 &lt;a href='#DEPENDENCIES'&gt; DEPENDENCIES &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;6 &lt;a href='#DOWNLOAD'&gt; DOWNLOAD &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;7 &lt;a href='#CSB_USAGE'&gt; CSB USAGE &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;8 &lt;a href='#CSB_EXAMPLES'&gt; CSB EXAMPLES &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;9 &lt;a href='#S3-CRYPTO.SH_USAGE'&gt; S3-CRYPTO.SH USAGE &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;10 &lt;a href='#S3-CRYPTO.SH_EXAMPLES'&gt; S3-CRYPTO.SH EXAMPLES &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
         &lt;/div&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h1&gt;&lt;a name='BACKGROUND'&gt;&lt;/a&gt; BACKGROUND &lt;/h1&gt;
&lt;p&gt;
Many of the tools made available to store and retrieve files using Cloud Storage services such as Amazon S3 assume that the content will be stored &amp;quot;as is&amp;quot;.  There are many scenarios where it would be better to first encrypt the content before storing into the Cloud (and automatically decrypt it upon retrieval).  

&lt;/p&gt;&lt;p&gt;The goal of this software project is to provide this necessary function, namely to provide front-end encryption and decryption capabilities to augment existing tools that can already store and retrieve files in the Cloud.  In addition, this tool will provide useful secondary functions such as compression and support for splitting/merging files that may be larger than a given threshold.  Strong security algorithms and providers will be used, and this tool will support a variety of encryption key types (as supported by the underlying providers).

&lt;/p&gt;&lt;h1&gt;&lt;a name='VERSIONS'&gt;&lt;/a&gt; VERSIONS &lt;/h1&gt;
&lt;p&gt; 

&lt;/p&gt;&lt;ul&gt;&lt;li&gt; v0.1 - Initial release supporting Amazon S3.
&lt;/li&gt;&lt;li&gt; v0.2 - Added support for Sun Cloud.
&lt;/li&gt;&lt;li&gt; v0.3 - Added support for the Cloud Safety Box (CSB) simplified use command.
&lt;/li&gt;&lt;li&gt; v0.4 - Added support for compression, file splitting, and key labels (Solaris provider only).
&lt;/li&gt;&lt;/ul&gt;&lt;h1&gt;&lt;a name='FUNCTIONALITY'&gt;&lt;/a&gt; FUNCTIONALITY &lt;/h1&gt;
&lt;p&gt;
This tool supports the following modes of operation:

&lt;/p&gt;&lt;pre&gt;   * encryption
   * compression
   * splitting
&lt;/pre&gt;&lt;p&gt;
in addition to any commands that can be passed through to the back-end functionality (e.g., list, remove, etc.)  For &amp;quot;put&amp;quot; operations, compression is done before encryption and splitting is done last (if needed).  The reverse process is used for &amp;quot;get&amp;quot; operations.

&lt;/p&gt;&lt;p&gt;The cryptographic operations performed by these tools are enabled by OpenSSL (or the Solaris Cryptographic Framework on Solaris 10 or OpenSolaris).  By default, OpenSSL is used as it enables the greatest level of portability.  To use the Solaris cryptographic operations, use the &amp;quot;-p solaris&amp;quot; command line option.  Note that on platforms using the UltraSPARC T2 (Niagara 2) processor, these cryptographic operations can be hardware accelerated.

&lt;/p&gt;&lt;p&gt;All of the command line options as well as common use cases are available from the tool's usage message available using the &amp;quot;-h&amp;quot;
command line option to the &lt;i&gt;s3-crypto.ksh&lt;/i&gt; command.  Note that in addition, the Cloud Safety Box, &lt;i&gt;csb&lt;/i&gt;, command is also provided to enable a simple, easy to use interface at the expense of some measure of flexibility.  If you want more control than what &lt;i&gt;csb&lt;/i&gt; provides, simply use the &lt;i&gt;s3-crypto.ksh&lt;/i&gt; script directly.

&lt;/p&gt;&lt;h1&gt;&lt;a name='FUNCTIONAL_DIAGRAM'&gt;&lt;/a&gt; FUNCTIONAL DIAGRAM &lt;/h1&gt;
&lt;p&gt;&lt;?link_for_image s3-crypto-diagram-v0.2.png?&gt;

&lt;/p&gt;&lt;h1&gt;&lt;a name='DEPENDENCIES'&gt;&lt;/a&gt; DEPENDENCIES &lt;/h1&gt;
&lt;p&gt;
These software modules are just front-end components and must be used with a back-end component that performs the actual operations against the Storage Cloud.  To date, this software has been tested against both the Sun Cloud Storage Service and the Amazon Simple Storage Service (S3) using the &amp;quot;Another S3 Bash Interface&amp;quot; tool published by &amp;quot;nescafe5&amp;quot; at:

&lt;/p&gt;&lt;pre&gt;   &lt;a class='external' href=&quot;http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1081&quot;&gt;http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1081&lt;/a&gt;
&lt;/pre&gt;&lt;p&gt;
Thanks to &amp;quot;nescafe5&amp;quot; for posting this great tool.  It is expected that this software can be easily adapted to other CLI back-end software components, however.  To use with the Sun Cloud, this script must be modified to access &lt;i&gt;object.storage.network.com&lt;/i&gt; in place of &lt;i&gt;s3.amazonaws.com&lt;/i&gt;.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: By default, the &amp;quot;Another S3 Bash Interface&amp;quot; tool is configured to use HTTP not HTTPS.  It is strongly recommended that HTTPS be used wherever possible.  To enable HTTPS, change the &lt;i&gt;curl&lt;/i&gt; command entry from &lt;i&gt;http&lt;/i&gt; to &lt;i&gt;https&lt;/i&gt;.  Also, one of the &lt;a class='external' href=&quot;http://curl.haxx.se/docs/sslcerts.html&quot;&gt;curl SSL certificate verification&lt;/a&gt; steps must also be performed.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: By default, the &lt;i&gt;s3-crypto.sh&lt;/i&gt; and &lt;i&gt;csb&lt;/i&gt; programs will attempt to call the &amp;quot;Another S3 Bash Interface&amp;quot; command as &lt;i&gt;s3&lt;/i&gt;.  If this functionality was saved under a different name, simply use the &lt;i&gt;S3C_CLI_CMD_NAME&lt;/i&gt; environment variable, setting its value to be the name of the program to be executed.  For example:
&lt;/p&gt;&lt;pre&gt;   $ export S3C_CLI_CMD_NAME=&amp;quot;s3-suncloud&amp;quot;
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h1&gt;&lt;a name='DOWNLOAD'&gt;&lt;/a&gt; DOWNLOAD &lt;/h1&gt;
&lt;p&gt;
Currently, this software is accessible from a Mercurial &lt;a class='external' href=&quot;http://kenai.com/projects/s3-crypto/sources/source/show&quot;&gt;source code repository&lt;/a&gt; and a (tar) &lt;a class='external' href=&quot;http://kenai.com/projects/s3-crypto/downloads&quot;&gt;bundle&lt;/a&gt;.

&lt;/p&gt;&lt;h1&gt;&lt;a name='CSB_USAGE'&gt;&lt;/a&gt; CSB USAGE &lt;/h1&gt;
&lt;p&gt;
To create a new storage bucket:
&lt;/p&gt;&lt;pre&gt;      csb put bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove an empty storage bucket:
&lt;/p&gt;&lt;pre&gt;      csb rm bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display a listing of storage buckets:
&lt;/p&gt;&lt;pre&gt;      csb buckets
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display the contents of a specified bucket:
&lt;/p&gt;&lt;pre&gt;      csb ls bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To put a file into a specified bucket:
&lt;/p&gt;&lt;pre&gt;      csb put bucket local_file [remote_file]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To get a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      csb get bucket remote_file [local_file]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      csb rm bucket remote_file
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove all files from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      csb rmrf bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h1&gt;&lt;a name='CSB_EXAMPLES'&gt;&lt;/a&gt; CSB EXAMPLES &lt;/h1&gt;
&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display a listing of storage buckets:

&lt;/p&gt;&lt;pre&gt;      $ ./csb buckets
      test-bucket-a
      test-bucket-b
      test-bucket-c
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display the contents of a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./csb ls test-bucket-a
      test-file-1
      test-file-2
      test-file-3
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To compress, encrypt and put a file (split if necessary) into a bucket: 

&lt;/p&gt;&lt;pre&gt;      $ ./csb put test-bucket-a /export/myfile myfile
      enter aes-256-cbc encryption password:
      Verifying - enter aes-256-cbc encryption password:
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To get (reassembling if necessary), decrypt and decompress a file from
a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./csb get test-bucket-a myfile ./new_myfile
      enter aes-256-cbc decryption password:
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove a file from a specified bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./csb rm test-bucket-a myfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove all files from a specified bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./csb rmrf test-bucket-a
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h1&gt;&lt;a name='S3-CRYPTO.SH_USAGE'&gt;&lt;/a&gt; S3-CRYPTO.SH USAGE &lt;/h1&gt;
&lt;p&gt;
To generate a new encryption/decryption key:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m genkey -k key_file [-s key_size]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display a listing of storage buckets:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m buckets
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display the contents of a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m ls -b bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To put a file into a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m put -b bucket -l local_file -r remote_file
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To compress and put a file into a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -C -m put -b bucket -l local_file -r remote_file
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt and put a file into a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -c [ [-a enc_alg] [-p crypto_provider] [-k key_file |-K key_label] ]
         -m put -b bucket -l local_file -r remote_file
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To get a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m get -b bucket -r remote_file [-l local_file]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To get and decompress a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -C -m get -b bucket -r remote_file [-l local_file]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To get and decrypt a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -c [ [-a enc_alg] [-p crypto_provider] [-k key_file | -K key_label] ] -m get -b bucket
         -r remote_file [-l local_file]
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove a file from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m rm -b bucket -r remote_file
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove all files from a specified bucket:
&lt;/p&gt;&lt;pre&gt;      ./s3-crypto.ksh -m rmrf -b bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;Specific options:

&lt;/p&gt;&lt;p&gt;-a.  The name of the encryption algorithm to be used.  The default is aes (Solaris encryption) and aes-256-cbc for OpenSSL.  Valid names are those defined by the encrypt(1) and openssl(5) commands.

&lt;/p&gt;&lt;p&gt;-b.  The name of the bucket on the Storage Cloud.

&lt;/p&gt;&lt;p&gt;-c.  Enable encryption (put) / decryption (get).

&lt;/p&gt;&lt;p&gt;-C.  Enable compression (put) / decompression (get).

&lt;/p&gt;&lt;p&gt;-h.  Display this message.

&lt;/p&gt;&lt;p&gt;-k.   The name of the key file used only for cryptographic operations when the -c option is selected.  If this parameter is not specified, then the program will prompt the user for  a passphrase to be used for encrypt/decrypt operations.

&lt;/p&gt;&lt;p&gt;-K.  (Solaris cryptographic provider only).  Specify the key label of a symmetric token key in a PKCS#11 token.

&lt;/p&gt;&lt;p&gt;-l.  The name (path) to the local file.

&lt;/p&gt;&lt;p&gt;-L.  The maximum file size limit (in Kbytes) used to determine if an input file should be split into chunks for upload.

&lt;/p&gt;&lt;p&gt;-m.   The mode of operation.  Values include:
&lt;/p&gt;&lt;pre&gt;           * buckets.  list (your) Storage Cloud buckets
           * genkey.  generate a key (file) for crypto operations
           * get.  get a file from the Storage Cloud
           * ls.  list the contents of a Storage Cloud bucket
           * put.  put a file into the Storage Cloud
           * rm.  remove a file from a Storage Cloud bucket
           * rmrf.  remove all files from a Storage Cloud bucket
&lt;/pre&gt;&lt;p&gt;
-p.  The cryptographic services provider, currently either &amp;quot;openssl&amp;quot;  (default) or &amp;quot;solaris&amp;quot;.

&lt;/p&gt;&lt;p&gt;-r.  The name of the remote file.

&lt;/p&gt;&lt;p&gt;-s.  The size of the key file to be generated (in bytes).  This parameter is only used with the genkey command mode.

&lt;/p&gt;&lt;p&gt;-S.  Split the file into chunks if its size is greater than 4 GB (default) or the size specified by the &amp;quot;-L&amp;quot; (size limit) option.

&lt;/p&gt;&lt;h1&gt;&lt;a name='S3-CRYPTO.SH_EXAMPLES'&gt;&lt;/a&gt; S3-CRYPTO.SH EXAMPLES &lt;/h1&gt;
&lt;p&gt;
These examples are based upon the use of this tool with the &amp;quot;Another S3 Bash Interface&amp;quot; tool discussed above.

&lt;/p&gt;&lt;p&gt;To generate a encryption/decryption key

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m genkey -k ./my_key -s 32
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display a listing of storage buckets:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m buckets
      test-bucket-a
      test-bucket-b
      test-bucket-c
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To display the contents of a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m ls -b test-bucket-a
      test-file-1
      test-file-2
      test-file-3
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To create a new bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m put -b new-bucket
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To compress a file before storing it in a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -C -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt a file before storing it in a bucket (OpenSSL
w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
      enter aes-256-cbc encryption password:
      Verifying - enter aes-256-cbc encryption password:
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt a file before storing it in a bucket (OpenSSL
w/user-supplied key file):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -m put -b test-bucket-a \
      -k ./my_key -l ./myfile -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt a file before storing it in a bucket (Solaris
w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
      Enter passphrase: 
      Re-enter passphrase: 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt a file before storing it in a bucket (Solaris
w/user-supplied key file):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -k ./my_key -l ./myfile -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To encrypt a file before storing it in a bucket (Solaris
w/user-supplied key label):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m put -b test-bucket-a \
      -K my_key_label -l ./myfile -r cloudfile
      Enter PIN for Sun Software PKCS#11 softtoken  : 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To split a file before storing it in a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -S -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To compress, encrypt and split a file before storing it in
a bucket (OpenSSL w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -C -c -S -m put -b test-bucket-a \
      -l ./myfile -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To reassemble a file after retrieving it from a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -S -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decrypt a file after retreiving it from a bucket (OpenSSL
w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
      enter aes-256-cbc decryption password:
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decrypt a file after retreiving it from a bucket (OpenSSL
w/user-supplied key file):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -m get -b test-bucket-a \
      -k ./my_key -l ./new_file -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decrypt a file after retreiving it from a bucket (Solaris
w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
      Enter passphrase: 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decrypt a file after retreiving it from a bucket (Solaris
w/user-supplied key file):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -k ./my_key -l ./new_file -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decrypt a file after retreiving it from a bucket (Solaris
w/user-supplied key label):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -c -p solaris -m get -b test-bucket-a \
      -K my_key_label -l ./new_file -r cloudfile
      Enter PIN for Sun Software PKCS#11 softtoken  : 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To decompress a file after retrieving it from a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -C -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To reassemble, decrypt and decompress a file after retrieving
it from a bucket (OpenSSL w/key generated from passphrase):

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -C -c -S -m get -b test-bucket-a \
      -l ./new_file -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove a file from a specified bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m rm -b test-bucket-a -r cloudfile
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove all files from a specified bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m rmrf -b test-bucket-a 
&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;p&gt;To remove a bucket:

&lt;/p&gt;&lt;pre&gt;      $ ./s3-crypto.ksh -m rm -b test-bucket-a
&lt;/pre&gt;</text-as-html>
  <updated-at type="datetime">2009-06-11T14:05:01Z</updated-at>
  <wiki-id type="integer">5613</wiki-id>
</page>
