key.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GPGMEPP_KEY_H__
00022 #define __GPGMEPP_KEY_H__
00023
00024 #include <gpgmepp/gpgmefw.h>
00025 #include <gpgmepp/context.h>
00026
00027 #include <sys/time.h>
00028
00029 #include <vector>
00030
00031 namespace GpgME {
00032
00033 class Subkey;
00034 class UserID;
00035
00036
00037
00038
00039
00040 class Key {
00041 friend class Context;
00042 public:
00043 Key();
00044 Key( gpgme_key_t key, bool acquireRef, unsigned int keyListMode=0 );
00045 Key( const Key & key );
00046 ~Key();
00047
00048 static Key null;
00049
00050 const Key & operator=( const Key & other );
00051
00052 bool isNull() const;
00053
00054 UserID userID( unsigned int index ) const;
00055 Subkey subkey( unsigned int index ) const;
00056
00057 unsigned int numUserIDs() const;
00058 unsigned int numSubkeys() const;
00059
00060 std::vector<UserID> userIDs() const;
00061 std::vector<Subkey> subkeys() const;
00062
00063 bool isRevoked() const;
00064 bool isExpired() const;
00065 bool isDisabled() const;
00066 bool isInvalid() const;
00067
00068 bool canEncrypt() const;
00069 bool canSign() const;
00070 bool canCertify() const;
00071 bool canAuthenticate() const;
00072 bool isQualified() const;
00073
00074 bool hasSecret() const;
00075 bool isSecret() const { return hasSecret(); }
00076
00082 bool isRoot() const;
00083
00084 enum OwnerTrust { Unknown=0, Undefined=1, Never=2,
00085 Marginal=3, Full=4, Ultimate=5 };
00086
00087 OwnerTrust ownerTrust() const;
00088 char ownerTrustAsString() const;
00089
00090 typedef Context::Protocol Protocol;
00091 Protocol protocol() const;
00092 const char * protocolAsString() const;
00093
00094 const char * issuerSerial() const;
00095 const char * issuerName() const;
00096 const char * chainID() const;
00097
00098 const char * keyID() const;
00099 const char * shortKeyID() const;
00100 const char * primaryFingerprint() const;
00101
00102 typedef Context::KeyListMode KeyListMode;
00103 unsigned int keyListMode() const;
00104
00105 private:
00106 gpgme_key_t impl() const;
00107 class Private;
00108 Private * d;
00109 };
00110
00111
00112
00113
00114
00115 class Subkey {
00116 public:
00117 Subkey( gpgme_key_t key=0, gpgme_sub_key_t subkey=0 );
00118 Subkey( gpgme_key_t key, unsigned int idx );
00119 Subkey( const Subkey & other );
00120 ~Subkey();
00121
00122 const Subkey & operator=( const Subkey & other );
00123
00124 bool isNull() const;
00125
00126 Key parent() const;
00127
00128 const char * keyID() const;
00129 const char * fingerprint() const;
00130
00131 time_t creationTime() const;
00132 time_t expirationTime() const;
00133 bool neverExpires() const;
00134
00135 bool isRevoked() const;
00136 bool isExpired() const;
00137 bool isInvalid() const;
00138 bool isDisabled() const;
00139
00140 bool canEncrypt() const;
00141 bool canSign() const;
00142 bool canCertify() const;
00143 bool canAuthenticate() const;
00144 bool isQualified() const;
00145
00146 bool isSecred() const;
00147
00148 unsigned int publicKeyAlgorithm() const;
00149 const char * publicKeyAlgorithmAsString() const;
00150
00151 unsigned int length() const;
00152
00153 private:
00154 class Private;
00155 Private * d;
00156 };
00157
00158
00159
00160
00161
00162 class UserID {
00163 public:
00164 class Signature;
00165
00166 UserID( gpgme_key_t key=0, gpgme_user_id_t uid=0 );
00167 UserID( gpgme_key_t key, unsigned int idx );
00168 UserID( const UserID & other );
00169 ~UserID();
00170
00171 const UserID & operator=( const UserID & other );
00172
00173 bool isNull() const;
00174
00175 Key parent() const;
00176
00177 unsigned int numSignatures() const;
00178 Signature signature( unsigned int index ) const;
00179 std::vector<Signature> signatures() const;
00180
00181 const char * id() const;
00182 const char * name() const;
00183 const char * email() const;
00184 const char * comment() const;
00185
00186 enum Validity { Unknown=0, Undefined=1, Never=2,
00187 Marginal=3, Full=4, Ultimate=5 };
00188
00189 Validity validity() const;
00190 char validityAsString() const;
00191
00192 bool isRevoked() const;
00193 bool isInvalid() const;
00194
00195 private:
00196 class Private;
00197 Private * d;
00198 };
00199
00200
00201
00202
00203
00204 class UserID::Signature {
00205 public:
00206 class Notation;
00207
00208 Signature( gpgme_key_t key=0, gpgme_user_id_t uid=0, gpgme_key_sig_t sig=0 );
00209 Signature( gpgme_key_t key, gpgme_user_id_t uid, unsigned int idx );
00210 Signature( const Signature & other );
00211 ~Signature();
00212
00213 const Signature & operator=( const Signature & other );
00214
00215 bool isNull() const;
00216
00217 UserID parent() const;
00218
00219 const char * signerKeyID() const;
00220
00221 const char * algorithmAsString() const;
00222 unsigned int algorithm() const;
00223 time_t creationTime() const;
00224 time_t expirationTime() const;
00225 bool neverExpires() const;
00226
00227 bool isRevokation() const;
00228 bool isInvalid() const;
00229 bool isExpired() const;
00230 bool isExportable() const;
00231
00232 const char * signerUserID() const;
00233 const char * signerName() const;
00234 const char * signerEmail() const;
00235 const char * signerComment() const;
00236
00237 unsigned int certClass() const;
00238
00239 enum Status { NoError = 0, SigExpired, KeyExpired,
00240 BadSignature, NoPublicKey, GeneralError };
00241 Status status() const;
00242 const char * statusAsString() const;
00243
00244 const char * policyURL() const;
00245
00246 unsigned int numNotations() const;
00247 Notation notation( unsigned int idx ) const;
00248 std::vector<Notation> notations() const;
00249
00250 private:
00251 class Private;
00252 Private * d;
00253 };
00254
00255
00256
00257
00258
00259
00260
00261 class UserID::Signature::Notation {
00262 public:
00263 Notation( gpgme_key_t key=0, gpgme_user_id_t uid=0,
00264 gpgme_key_sig_t sig=0, gpgme_sig_notation_t nota=0 );
00265 Notation( gpgme_key_t key, gpgme_user_id_t uid,
00266 gpgme_key_sig_t sig, unsigned int idx );
00267 Notation( const Notation & other );
00268 ~Notation();
00269
00270 const Notation & operator=( const Notation & other );
00271
00272 bool isNull() const;
00273
00274 Signature parent() const;
00275
00276 const char * name() const;
00277 const char * value() const;
00278
00279 private:
00280 class Private;
00281 Private * d;
00282 };
00283
00284 }
00285
00286 #endif // __GPGMEPP_KEY_H__
This file is part of the documentation for libkdenetwork Library Version 3.3.2.