Sponsored Content
Top Forums Programming Encrypt and Decrypt file using RIJNDAEL-128 Post 302958887 by Shre on Tuesday 27th of October 2015 06:37:32 AM
Old 10-27-2015
Encrypt and Decrypt file using RIJNDAEL-128

Hi All,

Can I use MCRYPT - (RIJNDAEL-128) / CBC mode to encrypt and decrypt a file?

I am trying to find some sample C program on internet, which will encrypt and decrypt a file. But was not able to find any thing.

Can some help me with the programming.

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Encrypt & Decrypt a String

Hi Everybody, I have a script that telnet another system. For some reasons, this is should be done by "root", so the root password has been written explicitly in this script, which mean any body read this script will know the root password of the other system. I think the solution is to write... (6 Replies)
Discussion started by: aldowsary
6 Replies

2. Shell Programming and Scripting

encrypt and decrypt password

how do i encrypt and decrypt a password (2 Replies)
Discussion started by: sanwish
2 Replies

3. Solaris

Decrypt Des file - then encrypt

Help.. I need to decrypt a file that was encrypted using DES 56 Bit. I have the encryption key and the block size used but no idea what utility to use.. I then need to encrypt the file using pgp and another key I have.. againt I dont know what utility to use. I am running solaris 9 .... ... (0 Replies)
Discussion started by: frustrated1
0 Replies

4. Shell Programming and Scripting

Encrypt and Decrypt script

Dear Experts, I am using one script name :volume.sh and its written in bash shell script. I just want to encrypt the script so that any one else cannot see it. please tell me the commands how to encrypt the script as well as to decrypt it. Regards, SHARY (9 Replies)
Discussion started by: shary
9 Replies

5. Shell Programming and Scripting

How to encrypt and decrypt a file

How to encrypt and decrypt a file using unix Command? Can any one help me? (2 Replies)
Discussion started by: laknar
2 Replies

6. Shell Programming and Scripting

Encrypt and decrypt a string

Hi, I want to encrypt and decrypt a string(database password) which will be used in my scripts. encrypt the string while storing in a file and while using it in other scripts it should decrypt. i tried below method. As it can decrypt easily, it is not recommended. encrypt=`perl -e 'print unpack... (5 Replies)
Discussion started by: rohan10k
5 Replies

7. Shell Programming and Scripting

Encrypt and Decrypt

I have script for all oracle prod db. I have hard coded the username / password. I need a mechanism to encode and decode the username / password in a shell script. Another challenge is I use the username and password in a Select command for oracle DB. How can call the decrypted... (2 Replies)
Discussion started by: ilugopal
2 Replies

8. Shell Programming and Scripting

Encrypt Password file and decrypt in a shell script

Hi All, I have stored Oracle database passwords in a hidden file - .pass_file. My shell script reads the hidden file, gets the password and then logs in to the Oracle database and runs some SQL script. My requirement is: I need to provide the shell script to be executed by someone else. So,... (1 Reply)
Discussion started by: sunpraveen
1 Replies

9. Shell Programming and Scripting

Encrypt and decrypt the password in a Shell Script

Hello, I have the following UNIX shell script which connects to the teradata database and executes the SQL Queries. For this, I am passing database name, username and password. I don't want to reveal my password to anyone. So, is there any way that I can encrypt my password and read the... (2 Replies)
Discussion started by: ronitreddy
2 Replies

10. UNIX for Beginners Questions & Answers

Encrypt and Decrypt a File with Password

Hello, I have few files on unix which are payroll related and I need them to encrypt with password so others wouldn't see the data. I use ETL tool and would like to know the unix command that does encryption/decryption to use in the ETL. Thank you, Sri (3 Replies)
Discussion started by: eskay
3 Replies
aes(n)                                                  Advanced Encryption Standard (AES)                                                  aes(n)

__________________________________________________________________________________________________________________________________________________

NAME
aes - Implementation of the AES block cipher SYNOPSIS
package require Tcl 8.2 package require aes ?1.0.1? ::aes::aes ?-mode [ecb|cbc]? ?-dir [encrypt|decrypt]? -key keydata ?-iv vector? ?-hex? ?-out channel? ?-chunksize size? [ -in channel | data ] ::aes::Init mode keydata iv ::aes::Encrypt Key data ::aes::Decrypt Key data ::aes::Reset Key iv ::aes::Final Key _________________________________________________________________ DESCRIPTION
This is an implementation in Tcl of the Advanced Encryption Standard (AES) as published by the U.S. National Institute of Standards and Technology [1]. AES is a 128-bit block cipher with a variable key size of 128, 192 or 256 bits. This implementation supports ECB and CBC modes. COMMANDS
::aes::aes ?-mode [ecb|cbc]? ?-dir [encrypt|decrypt]? -key keydata ?-iv vector? ?-hex? ?-out channel? ?-chunksize size? [ -in channel | data ] Perform the aes algorithm on either the data provided by the argument or on the data read from the -in channel. If an -out channel is given then the result will be written to this channel. The -key option must be given. This parameter takes a binary string of either 16, 24 or 32 bytes in length and is used to generate the key schedule. The -mode and -dir options are optional and default to cbc mode and encrypt respectively. The initialization vector -iv takes a 16 byte binary argument which defaults to all zeros. See MODES OF OPERATION for more about available modes and their uses. AES is a 128-bit block cipher. This means that the data must be provided in units that are a multiple of 16 bytes. PROGRAMMING INTERFACE
Internal state is maintained in an opaque structure that is returned from the Init function. In ECB mode the state is not affected by the input but for CBC mode some input dependent state is maintained and may be reset by calling the Reset function with a new initialization vector value. ::aes::Init mode keydata iv Construct a new AES key schedule using the specified key data and the given initialization vector. The initialization vector is not used with ECB mode but is important for CBC mode. See MODES OF OPERATION for details about cipher modes. ::aes::Encrypt Key data Use a prepared key acquired by calling Init to encrypt the provided data. The data argument should be a binary array that is a mul- tiple of the AES block size of 16 bytes. The result is a binary array the same size as the input of encrypted data. ::aes::Decrypt Key data Decipher data using the key. Note that the same key may be used to encrypt and decrypt data provided that the initialization vector is reset appropriately for CBC mode. ::aes::Reset Key iv Reset the initialization vector. This permits the programmer to re-use a key and avoid the cost of re-generating the key schedule where the same key data is being used multiple times. ::aes::Final Key This should be called to clean up resources associated with Key. Once this function has been called the key may not be used again. MODES OF OPERATION
Electronic Code Book (ECB) ECB is the basic mode of all block ciphers. Each block is encrypted independently and so identical plain text will produce identical output when encrypted with the same key. Any encryption errors will only affect a single block however this is vulnerable to known plaintext attacks. Cipher Block Chaining (CBC) CBC mode uses the output of the last block encryption to affect the current block. An initialization vector of the same size as the cipher block size is used to handle the first block. The initialization vector should be chosen randomly and transmitted as the first block of the output. Errors in encryption affect the current block and the next block after which the cipher will correct itself. CBC is the most commonly used mode in software encryption. EXAMPLES
% set nil_block [string repeat \0 16] % aes::aes -hex -mode cbc -dir encrypt -key $nil_block $nil_block 66e94bd4ef8a2c3b884cfa59ca342b2e set Key [aes::Init cbc $sixteen_bytes_key_data $sixteen_byte_iv] append ciphertext [aes::Encrypt $Key $plaintext] append ciphertext [aes::Encrypt $Key $additional_plaintext] aes::Final $Key REFERENCES
[1] "Advanced Encryption Standard", Federal Information Processing Standards Publication 197, 2001 (http://csrc.nist.gov/publica- tions/fips/fips197/fips-197.pdf) AUTHORS
Thorsten Schloermann, Pat Thoyts BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category aes of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. SEE ALSO
blowfish(n), des(n), md5(n), sha1(n) KEYWORDS
aes, block cipher, data integrity, encryption, security COPYRIGHT
Copyright (c) 2005, Pat Thoyts <patthoyts@users.sourceforge.net> aes 1.0.1 aes(n)
All times are GMT -4. The time now is 05:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy