4C Cryptography - Overview

4C Cryptography - Overview

A number of features involving cryptography are available in version 5.2 of 4csrvr. These features include All 4C features involving cryptographic features of any kind use the opensll library. To effectively use any of these features a basic understanding of openssl is helpful.




4C Symetric Key Data Encryption

4C can automatically encrypt/decrypt data in JISAM and JISAM64 files. Automatic data encryption of other types of files and of database tables is not supported. If you need data encryption within a database, use the database to do this. If you need to encrypt a text or binary file or an alpha field, there are system PCLs that will allow your programs to do this.

Symetric key encryption means using the same key for encrypting data and for decrypting it. So, before you can use data encryption in 4C, you must define at least one key and make 4C aware of the key.

4C Encryption keys are stored in one single text file and you make 4C aware of this file by an entry in the SecurityConfig file that looks like:
KeyListFile <KeyFileName>
or
KeyListFile <FullPathToKeyFile>
If you do not specify a full path to the KeyListFile, then 4C will look only in the HOME_4C/security directory for the file. If you leave the file in the HOME_4C/security directory, it should be readonly by root only.

The KeyListFile will have one or more entries to define the symetric keys. Each key has some or all of the following attributes You normally will use the 4cgenkey utility to create keys and then add them to the KeyListFile Enter
4cgenkey --help
to see how tyo use 4cgenkey. A simple command to add an AES 128 bit key using CBC mode to a file named MyKeyList using "TestKey1" as the key name is
     4cgenkey -n TestKey1 -c aes -l 128 -m cbc >>MyKeyList
You can have as many keys in the KeyListFile as you need.

4C will only read the KeyListFile when it first starts or after 4csrvrd has been called with the "-R" option.

Once you have defined some keys, you can specify which data files should be encrypted and how they should be encrypted. You can do this by Some things to keep in mind


4C Cryptographic Signatures

4C will allow an application to use public key cryptography for signing and for verifying signatures. In order to sign a piece of text, you must use the private key from the key pair. In order to verify that a signature is valid for a piece of text you can use either the private key or the public key of the key pair. The following system PCLs can be used with digital signatures. The only type of public keys that 4C can use with digital signatures are RSA and DSA keys.

The demo programs, demo.pkey.1, demo.pkey.2, demo.serial.cr, and demo.serial.chk show ways that these system PCLs can be used.

You can also use public key cryptography to encrypt or decrypt very small amounts of text. This could be used to send a symetric key securely to a remote system. There are 2 additional public key cryptography PCLs that can be used for this. They are sys.pkey_encrypt and sys.pkey_decrypt require a 5.2.8 or later 4csrvr. sys.pkey_encrypt and sys.pkey_decrypt only work with RSA keys.


Encoding/Decoding

Encoding is the process of transforming some data into another form where it can be used by another process or system. Encoding is not the same as encryption. There is no key involved. The only thing necessary to decode encoded data is to know the encoding algorithm. Encoding is especially important when it is necessary to send binary data across a medium that can't handle binary data. The types of encoding that 4C currently supports are. All of the data encryption and decryption PCLs support encoding/decoding the data as well as decoding/decrypting it. In addition, 4C allows you to use the following system PCLs to encode/decode a single 4C alpha field or a file. The file can be any type of file.

Back to Top