# Poco::Crypto

# class CipherKeyImpl

Library: Crypto
Package: Cipher
Header: Poco/Crypto/CipherKeyImpl.h

## Description

An implementation of the CipherKey class for OpenSSL's crypto library.

## Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

## Member Summary

Member Functions: blockSize, cipher, getIV, getKey, ivSize, keySize, mode, name, setIV, setKey

Inherited Functions: duplicate, referenceCount, release

## Types

### ByteVec

typedef std::vector < unsigned char > ByteVec;

### Ptr

typedef Poco::AutoPtr < CipherKeyImpl > Ptr;

## Enumerations

### Mode

Cipher mode of operation. This mode determines how multiple blocks are connected; this is essential to improve security.

MODE_STREAM_CIPHER

Stream cipher

MODE_ECB

Electronic codebook (plain concatenation)

MODE_CBC

Cipher block chaining (default)

MODE_CFB

Cipher feedback

MODE_OFB

Output feedback

## Constructors

### CipherKeyImpl

CipherKeyImpl(
const std::string & name
);

Creates a new CipherKeyImpl object. Autoinitializes key and initialization vector.

### CipherKeyImpl

CipherKeyImpl(
const std::string & name,
const ByteVec & key,
const ByteVec & iv
);

Creates a new CipherKeyImpl object, using the given cipher name, key and initialization vector.

### CipherKeyImpl

CipherKeyImpl(
const std::string & name,
const std::string & passphrase,
const std::string & salt,
int iterationCount
);

Creates a new CipherKeyImpl object, using the given cipher name, passphrase, salt value and iteration count.

## Destructor

### ~CipherKeyImpl

virtual ~CipherKeyImpl();

Destroys the CipherKeyImpl.

## Member Functions

### blockSize

int blockSize() const;

Returns the block size of the Cipher.

### cipher

const EVP_CIPHER * cipher();

Returns the cipher object

### getIV

const ByteVec & getIV() const;

Returns the initialization vector (IV) for the Cipher.

### getKey

const ByteVec & getKey() const;

Returns the key for the Cipher.

### ivSize

int ivSize() const;

Returns the IV size of the Cipher.

### keySize

int keySize() const;

Returns the key size of the Cipher.

### mode

Mode mode() const;

Returns the Cipher's mode of operation.

### name

const std::string & name() const;

Returns the name of the Cipher.

### setIV

void setIV(
const ByteVec & iv
);

Sets the initialization vector (IV) for the Cipher.

### setKey

void setKey(
const ByteVec & key
);

Sets the key for the Cipher.