signon 8.54

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | List of all members
CryptoManager Class Reference

Encrypted file system manager. More...

`#include <crypto-manager.h>`

Inheritance diagram for CryptoManager:
[legend]
Collaboration diagram for CryptoManager:
[legend]

## Public Types
enum | FileSystemType { Ext2 = 0, Ext3, Ext4 }
| Supported encrypted partion filesystem type. More...

## Public Member Functions
bool | initialize (const QVariantMap &configuration)
| CryptoManager (QObject *parent=0)
| Constructs a CryptoManager object with the given parent. More...
| ~CryptoManager ()
| Destroys a CryptoManager object. More...
bool | setupFileSystem ()
| Sets up an encrypted file system. More...
bool | deleteFileSystem ()
| Deletes the encrypted file system. More...
bool | mountFileSystem ()
| Mounts the encrypted file system. More...
bool | unmountFileSystem ()
| Unmounts the encrypted file system. More...
QString | fileSystemMountPath () const
QStringList | backupFiles () const
bool | encryptionKeyInUse (const SignOn::Key &key)
bool | addEncryptionKey (const SignOn::Key &key, const SignOn::Key &existingKey)
| Adds an encryption key to one of the available keyslots of the LUKS partition's header. More...
bool | removeEncryptionKey (const SignOn::Key &key, const SignOn::Key &remainingKey)
| Releases an existing used keyslot in the LUKS partition's header. More...

## Detailed Description

Encrypted file system manager.

Uses cryptsetup and LUKS.

Definition at line 45 of file crypto-manager.h.

## Member Enumeration Documentation

enum CryptoManager::FileSystemType

Supported encrypted partion filesystem type.

Enumerator
Ext2 |
Ext3 |
Ext4 |

Definition at line 70 of file crypto-manager.h.

## Constructor & Destructor Documentation

CryptoManager::CryptoManager | ( | QObject * | parent = `0` | ) |

Constructs a CryptoManager object with the given parent.

Parameters

  parent |

Definition at line 82 of file crypto-manager.cpp.

References BLAME, and CryptsetupHandler::loadDmMod().

CryptoManager::~CryptoManager | ( |  | ) |

Destroys a CryptoManager object.

Definition at line 97 of file crypto-manager.cpp.

References unmountFileSystem().

## Member Function Documentation

bool CryptoManager::addEncryptionKey | ( | const SignOn::Key & | key,
|  | const SignOn::Key & | existingKey
| ) |  |

Adds an encryption key to one of the available keyslots of the LUKS partition's header.

Use the `keyTag` parameter in order to store and keep track of the key.

See Also
  isEncryptionKey(const SignOn::Key &key)

Parameters

  key | The key to be added/set.
  existingKey | An already existing key.

Returns
  true, if succeeded, false otherwise.

Definition at line 437 of file crypto-manager.cpp.

References CryptsetupHandler::addKeySlot(), and TRACE.

QStringList CryptoManager::backupFiles | ( |  | ) | const

Returns
  the list of files which need to be backed up.

Definition at line 399 of file crypto-manager.cpp.

bool CryptoManager::deleteFileSystem | ( |  | ) |

Deletes the encrypted file system.

Returns
  true, if successful, false otherwise.

Warning
  use this carefully, this will lead to data loss.

Todo:
  finish implemetation.

Definition at line 383 of file crypto-manager.cpp.

References unmountFileSystem().

bool CryptoManager::encryptionKeyInUse | ( | const SignOn::Key & | key | ) |

Attention
  if the file system is not mounted and the encryption key can access it, this method will cause the file system to be mounted.

Returns
  whether the key `key` is occupying a keyslot in the encrypted file system.

Definition at line 470 of file crypto-manager.cpp.

References mountFileSystem().

QString CryptoManager::fileSystemMountPath | ( |  | ) | const

Returns
  the path of the mounted file system.

Definition at line 394 of file crypto-manager.cpp.

bool CryptoManager::initialize | ( | const QVariantMap & | configuration | ) |

Definition at line 102 of file crypto-manager.cpp.

References TRACE.

bool CryptoManager::mountFileSystem | ( |  | ) |

Mounts the encrypted file system.

Returns
  true, if successful, false otherwise.

Definition at line 258 of file crypto-manager.cpp.

References BLAME, CryptsetupHandler::closeFile(), DEVICE_MAPPER_DIR, LosetupHandler::findAvailableDevice(), CryptsetupHandler::loadDmMod(), CryptsetupHandler::openFile(), LosetupHandler::setupDevice(), TRACE, and unmountFileSystem().

Referenced by encryptionKeyInUse().

bool CryptoManager::removeEncryptionKey | ( | const SignOn::Key & | key,
|  | const SignOn::Key & | remainingKey
| ) |  |

Releases an existing used keyslot in the LUKS partition's header.

Parameters

  key | The key to be removed.
  remainingKey | Another valid key

Attention
  The system cannot remain keyless.

Returns
  true, if succeeded, false otherwise.

Definition at line 455 of file crypto-manager.cpp.

References CryptsetupHandler::removeKeySlot(), and TRACE.

bool CryptoManager::setupFileSystem | ( |  | ) |

Sets up an encrypted file system.

This method is to be called only at the file system creation/formatting. Use mountFileSystem() on subsequent uses. This method handles also the mounting so when using it, a call to mountFileSystem() is not necessary.

Returns
  true, if successful, false otherwise.

Warning
  this method will always format the file system, use carefully.

Definition at line 175 of file crypto-manager.cpp.

References BLAME, CryptsetupHandler::closeFile(), PartitionHandler::createPartitionFile(), DEVICE_MAPPER_DIR, LosetupHandler::findAvailableDevice(), CryptsetupHandler::formatFile(), PartitionHandler::formatPartitionFile(), CryptsetupHandler::loadDmMod(), CryptsetupHandler::openFile(), LosetupHandler::setupDevice(), TRACE, and unmountFileSystem().

bool CryptoManager::unmountFileSystem | ( |  | ) |

Unmounts the encrypted file system.

Returns
  true, if successful, false otherwise.

Definition at line 345 of file crypto-manager.cpp.

References CryptsetupHandler::closeFile(), LosetupHandler::releaseDevice(), and TRACE.

Referenced by deleteFileSystem(), mountFileSystem(), setupFileSystem(), and ~CryptoManager().

The documentation for this class was generated from the following files:

- src/extensions/cryptsetup/crypto-manager.h
- src/extensions/cryptsetup/crypto-manager.cpp