Introduction
CryptoNite provides encryption and decryption in your applications for security, safe data transfer etc. Cryptonite completely removes the complexity of implementing cryptography.
Cryptonite aims to make using encryption as simple as possible,
and handles all the complexity for you. CryptoNite requires
StringTheory.
CryptoNite will easily help you:
- Encrypt and decrypt strings - with one line of code.
- Encrypt and decrypt files - with one line of code.
- Handle a wide variety of encryption types, from Symmetric key cipher such as Blowfish and 3DES to asymmetric public/private key cryptography such as RSA
- Perform encryption or decryption quickly and simply, with no experience with cryptography
- Handles certificates
- Sign and verify signatures using public/private key cryptography
- Base64 encoding and Decoding using StringTheory
- Unicode (UTF-8) to ANSI and ANSI to Unicode using StringTheory.
We strongly recommend starting with the example applications,
which are described below in the Example section.
Basic Terminology
Cryptography is a field that has a wide
variety of specific terminology, much of which can be confusing
without a background in the subject.
Cipher
A cipher is simply a method of encrypting
(tranforming or changing) data from one form into another. A
simple cipher would be substituting letters with numbers, for
example "ABC" would become "123". The different methods for
encrypting data are known as ciphers. Ciphers typically preserve
the data, so that what is encrypted can then be decrypted at a
later stage. Most ciphers use a "key" to lock and unlock
(encrypt and decrypt) the data.
Encryption and Decryption
The process of using a cipher to
transform plain data into encrypted data and vice versa.
Symmetric and Asymmetric keys
When encrypting and decrypting there are
two basic types of keys used:
Symmetric keys use the same key to
encrypt and decrypt the data. An example would be providing a
password to encrypt a file, and then using the same password to
decrypt the file. In order to decrypt the data, you need to know
the key (password), and hence the data is only as a secure as
your mechanism for transferring the key is.
Asymmetric keys use a two parts of the
the key, anything encrypted with one part can only be decrytped
with the other. These are know as the Public and Private keys
and form the Public/Private key pair. The public key is
distributed, allowing anyone to encrypted data using it. The
private key is kept securely, allowing the owner to decrypt data
that is encrypted with the matching public key.
Assymetric keys tend to be far larger
than symmetric keys are, and assymetric encryption is far
slower. For this reason it is usually used as a key exchange
mechanism. The session key (which is a symmetric key) is used to
encrypt the data. The session key is then encrypted using the
Public key, which means that only the person with the Private
key can decrypt it. This is known as a key transport mechanism.
Hashing and Digest creation
Hashing is a method of creating a unique
number from a given set of data. This provides a way to uniquely
identify particular data, and to ensure that it has not been
changed (if the data is not identical, the hash will change).
Hashing is used to ensure the integrity of encrypted data, and
to validate that the data has not been altered. Both plain
(unencrypted) and cipher (encrypted) data can be hashed. A hash
is also known as a digest. Common methods of creating digests
are MD5, SHA-1 and SHA-2. SHA-1 is the most commonly used hash,
although SHA-2 corrects a potential mathamatical weakness that
SHA-1 might possess and is hence technically more secure. MD5 is
no longer recommend as a result of demonstrated attacks
resulting in collisions (two sets of data with the same hash).
MD5 hashes are 128 bits (16 bytes) long,
SHA-1 hashes are 160 bits (20 bytes) long, and SHA-2 (SHA-256
and SHA-512) hashes can be 256 or 512 bits (32 and 64 bytes
respectively) long.
|