# Poco::Crypto

# class KeyPairImpl

Library: Crypto
Package: CryptoCore
Header: Poco/Crypto/KeyPairImpl.h

## Description

Class KeyPairImpl

## Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: ECKeyImpl, RSAKeyImpl

## Member Summary

Member Functions: name, save, size, type

Inherited Functions: duplicate, referenceCount, release

## Types Aliases

### ByteVec

using ByteVec = std::vector < unsigned char >;

### Ptr

using Ptr = Poco::AutoPtr < KeyPairImpl >;

## Enumerations

### Type

KT_RSA_IMPL = 0

KT_EC_IMPL

## Constructors

### KeyPairImpl

KeyPairImpl(
const std::string & name,
Type type
);

Create KeyPairImpl with specified type and name.

## Destructor

### ~KeyPairImpl

virtual ~KeyPairImpl();

Destroys the KeyPairImpl.

## Member Functions

### name

const std::string & name() const;

Returns key pair name

### save

virtual void save(
const std::string & publicKeyFile,
const std::string & privateKeyFile = "",
const std::string & privateKeyPassphrase = ""
) const = 0;

Exports the public and private keys to the given files.

If an empty filename is specified, the corresponding key is not exported.

### save

virtual void save(
std::ostream * pPublicKeyStream,
std::ostream * pPrivateKeyStream = nullptr,
const std::string & privateKeyPassphrase = ""
) const = 0;

Exports the public and private key to the given streams.

If a null pointer is passed for a stream, the corresponding key is not exported.

### size

virtual int size() const = 0;

Returns the key size.

### type

Type type() const;

Returns key pair type