This file is indexed.

/usr/include/signon-extension/SignOn/key-handler.h is in signond-dev 8.56+14.04.20140307-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
 * This file is part of signon
 *
 * Copyright (C) 2011 Nokia Corporation.
 *
 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */
/*!
 * @copyright Copyright (C) 2011 Nokia Corporation.
 * @license LGPL
 */

#ifndef SIGNON_KEY_HANDLER_H
#define SIGNON_KEY_HANDLER_H

#include "SignOn/abstract-key-manager.h"

#include <QObject>
#include <QSet>

namespace SignOn {

class AbstractCryptoManager;

class KeyHandlerPrivate;
typedef QList<SignOn::AbstractKeyManager *> KeyManagersList;

/*!
 * @class KeyHandler
 * @brief Object holding the keys to the secure storage
 *
 * The KeyHandler is where all keys to the secure storage are held. It provides
 * signals to notify when keys are inserted, authorized, removed, disabled, as
 * well as methods to authorize and unauthorize keys.
 */
class SIGNON_EXPORT KeyHandler: public QObject
{
    Q_OBJECT

public:
    enum Authorizations {
        None = 0,
        FormatStorage = 1 << 0, /*!< Formats the secure storage */
    };
    Q_DECLARE_FLAGS(AuthorizeFlags, Authorizations);

    /*!
     * Constructor
     */
    explicit KeyHandler(QObject *parent = 0);

    /*!
     * Destructor
     */
    virtual ~KeyHandler();

    /*!
     * This method initializes the key managers.
     */
    void initialize(AbstractCryptoManager *cryptoManager,
                    const KeyManagersList &keyManagers);

    /*!
     * @returns The CryptoManager.
     */
    AbstractCryptoManager *cryptoManager() const;

    /*!
     * True if all key managers have been initialized and have started
     * reporting their inserted keys.
     */
    bool isReady() const;

    /*!
     * @returns the currently inserted keys.
     */
    QSet<SignOn::Key> insertedKeys() const;

    /*!
     * @param key The key to be tested.
     * @returns true if @key is an authorized key.
     */
    bool keyIsAuthorized(const SignOn::Key &key) const;

    /*!
     * Add @key to the list of keys which can be used to access the secure
     * storage. If the KeyHandler is empty, this method will fail.
     * @param key The key to be authorized.
     * @returns true if the operation was successful.
     * @sa keyAuthorized()
     */
    bool authorizeKey(const SignOn::Key &key, AuthorizeFlags flags = None);

    /*!
     * Remove @key from the list of keys which can be used to access the
     * secure storage. If the KeyHandler is empty, this method will fail.
     * @param key The key to be revoked.
     * @returns true if the operation was successful.
     * @sa keyAuthorizationRevoked()
     */
    bool revokeKeyAuthorization(const SignOn::Key &key);

    /*!
     * Returns true if a new key can be authorized by calling authorizeKey()
     * without specifying the FormatStorage flag (that is, if the KeyHandler
     * knows other keys which can open the storage).
     */
    bool canAddKeyAuthorization() const;

Q_SIGNALS:
    /*!
     * Emitted after all key managers have been initialized and have reported
     * about their inserted keys.
     */
    void ready();

    /*!
     * Emitted when a new key is available. If the key is not yet known to
     * signond, signond will call authorizeKey on the key managers before
     * accepting it.
     * @param key The new key
     */
    void keyInserted(const SignOn::Key key);

    /*!
     * Emitted when a key is disabled. For instance, this signal can be
     * emitted when a password expires or when a hardware key is removed.
     * This signal will be emitted before the action is processed by the
     * KeyHandler; this means that if for instance @key was an authorized key,
     * calling keyIsAuthorized() from this signal's handler will still return
     * true.
     * @param key The key which has been disabled
     */
    void keyDisabled(const SignOn::Key key);

    /*!
     * One of the key managers has asked that @key be removed. This means that
     * the key manager will never provide the same key again, so its
     * authorization to open the secure storage can be revoked.
     * The keyDisabled() signal will always be emitted prior to this one.
     * @param key The key which has been removed.
     */
    void keyRemoved(const SignOn::Key key);

    /*!
     * Emitted when a key authorization has been revoked.
     * @param key The key whose authorization was revoked.
     */
    void keyAuthorizationRevoked(const SignOn::Key key);

    /*!
     * Emitted when a key has been authorized.
     * @param key The key which was authorized.
     */
    void keyAuthorized(const SignOn::Key key);

    /*!
     * Emitted when the last authorized key has been removed.
     */
    void lastAuthorizedKeyRemoved(const SignOn::Key key);

private:
    KeyHandlerPrivate *d_ptr;
    Q_DECLARE_PRIVATE(KeyHandler)
};

} // namespace

#endif // SIGNON_KEY_HANDLER_H