• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Plasma

  • Plasma
  • Credentials
Public Member Functions | Static Public Member Functions | Friends

Plasma::Credentials Class Reference

This class encapsules someone's identity. More...

#include <credentials.h>

List of all members.

Public Member Functions

 Credentials ()
 Credentials (const Credentials &other)
 ~Credentials ()
bool canSign () const
QString id () const
bool isValid () const
bool isValidSignature (const QByteArray &signature, const QByteArray &message)
QString name () const
Credentials & operator= (const Credentials &other)
QByteArray signMessage (const QByteArray &message)
Credentials toPublicCredentials () const
TrustLevel trustLevel () const

Static Public Member Functions

static Credentials createCredentials (const QString &name)

Friends

QDataStream & operator<< (QDataStream &, const Credentials &)
QDataStream & operator>> (QDataStream &, Credentials &)

Detailed Description

This class encapsules someone's identity.

It contains a unique id that identifies the machine an incoming connection is coming from, it's name (which is not necesarily unique and/or trusted), a public key used to validate messages coming from the machine with this identity, and in the future the possibility to determine whether or not this identity can be trusted based on mechanisms different then pin pairing, e.g. a signature of the key that can be verified by a gpg trusted key.

Definition at line 42 of file credentials.h.


Constructor & Destructor Documentation

Plasma::Credentials::Credentials ( )

Default constructor.

Definition at line 82 of file credentials.cpp.

Plasma::Credentials::Credentials ( const Credentials &  other)

Copy constructor.

Definition at line 87 of file credentials.cpp.

Plasma::Credentials::~Credentials ( )

Definition at line 93 of file credentials.cpp.


Member Function Documentation

bool Plasma::Credentials::canSign ( ) const
Returns:
whether or not this identity can be used for signing a message (whether or not it includes a public key)

Definition at line 193 of file credentials.cpp.

Credentials Plasma::Credentials::createCredentials ( const QString &  name) [static]

Create a new identity with a new set of random public/private keys.

Definition at line 104 of file credentials.cpp.

QString Plasma::Credentials::id ( ) const
Returns:
an id to identify this identity. I use a Hash of the public key as ID. This way we don't have to send the complete public key with every message.

Definition at line 163 of file credentials.cpp.

bool Plasma::Credentials::isValid ( ) const
Returns:
whether or not this is a null identity or an invalid one (hash of key doesn't match id). Maybe isValid() is a better name?

Definition at line 138 of file credentials.cpp.

bool Plasma::Credentials::isValidSignature ( const QByteArray &  signature,
const QByteArray &  message 
)
Returns:
whether or not signature is correct for message.

Definition at line 168 of file credentials.cpp.

QString Plasma::Credentials::name ( ) const
Returns:
the name of this identity. There's however no guarantee that if the name returns e.g. "Santa Claus", this message is actually from Mr. Claus, except if trustLevel returns a sufficiently high trust level.

Definition at line 158 of file credentials.cpp.

Credentials & Plasma::Credentials::operator= ( const Credentials &  other)

Definition at line 98 of file credentials.cpp.

QByteArray Plasma::Credentials::signMessage ( const QByteArray &  message)
Returns:
the signature for the message.

Definition at line 207 of file credentials.cpp.

Credentials Plasma::Credentials::toPublicCredentials ( ) const
Returns:
a Credentials stripped from any private key, so you can be sure it is save to send to somebody.

Definition at line 227 of file credentials.cpp.

TrustLevel Plasma::Credentials::trustLevel ( ) const
Returns:
whether or not this identity can be trusted based on e.g. having the key signed with a trusted GPG key (not yet implemented) or having the key in a designated folder on disk (about to be impl.). If this function returns false, your shell should always instatiate pin pairing before allowing a connection from an untrusted source (AuthorizationRule::PinRequired flag should be set on the rule with setRules).

QString pemFile = KStandardDirs::locate("trustedkeys", id());

if (!pemFile.isEmpty()) { QCA::PublicKey pubKey = QCA::PublicKey::fromPEMFile(pemFile); if (pubKey == d->publicKey) { return true; } }

Definition at line 122 of file credentials.cpp.


Friends And Related Function Documentation

QDataStream& operator<< ( QDataStream &  ,
const Credentials &   
) [friend]

Streaming operators for sending/storing identities.

Definition at line 238 of file credentials.cpp.

QDataStream& operator>> ( QDataStream &  ,
Credentials &   
) [friend]

Definition at line 262 of file credentials.cpp.


The documentation for this class was generated from the following files:
  • credentials.h
  • credentials.cpp

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal