Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Security.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2004 Beeyond Software Holding BV
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00023 #ifndef _CLASS_SECURITY_H
00024 #define _CLASS_SECURITY_H
00025 
00026 #ifdef __cplusplus
00027 
00028 #include "beecrypt/c++/mutex.h"
00029 using beecrypt::mutex;
00030 #include "beecrypt/c++/util/Properties.h"
00031 using beecrypt::util::Properties;
00032 #include "beecrypt/c++/security/Provider.h"
00033 using beecrypt::security::Provider;
00034 #include "beecrypt/c++/security/NoSuchAlgorithmException.h"
00035 using beecrypt::security::NoSuchAlgorithmException;
00036 #include "beecrypt/c++/security/NoSuchProviderException.h"
00037 using beecrypt::security::NoSuchProviderException;
00038 #include "beecrypt/c++/security/cert/CertificateFactory.h"
00039 using beecrypt::security::cert::CertificateFactory;
00040 #include "beecrypt/c++/security/cert/CertPathValidator.h"
00041 using beecrypt::security::cert::CertPathValidator;
00042 #include "beecrypt/c++/crypto/Cipher.h"
00043 using beecrypt::crypto::Cipher;
00044 #include "beecrypt/c++/crypto/KeyAgreement.h"
00045 using beecrypt::crypto::KeyAgreement;
00046 #include "beecrypt/c++/crypto/Mac.h"
00047 using beecrypt::crypto::Mac;
00048 #include "beecrypt/c++/crypto/SecretKeyFactory.h"
00049 using beecrypt::crypto::SecretKeyFactory;
00050 
00051 #include <vector>
00052 using std::vector;
00053 
00054 namespace beecrypt {
00055     namespace security {
00058         class BEECRYPTCXXAPI Security
00059         {
00060             friend class AlgorithmParameterGenerator;
00061             friend class AlgorithmParameters;
00062             friend class CertificateFactory;
00063             friend class CertPathValidator;
00064             friend class Cipher;
00065             friend class KeyAgreement;
00066             friend class KeyFactory;
00067             friend class KeyPairGenerator;
00068             friend class KeyStore;
00069             friend class Mac;
00070             friend class MessageDigest;
00071             friend class SecretKeyFactory;
00072             friend class SecureRandom;
00073             friend class Signature;
00074 
00075         public:
00076             typedef vector<const Provider*> provider_vector;
00077             typedef provider_vector::iterator provider_vector_iterator;
00078 
00079         private:
00080             struct spi
00081             {
00082                 Object* cspi;
00083                 String name;
00084                 const Provider* prov;
00085 
00086                 spi(Object* cspi, const Provider*, const String&);
00087             };
00088 
00089             static spi* getSpi(const String& name, const String& type) throw (NoSuchAlgorithmException);
00090             static spi* getSpi(const String& algo, const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException);
00091             static spi* getSpi(const String& algo, const String& type, const Provider&) throw (NoSuchAlgorithmException);
00092             static spi* getFirstSpi(const String& type);
00093 
00094             static const String& getKeyStoreDefault();
00095 
00096             static bool _init;
00097             static Properties _props;
00098             static mutex _lock;
00099             static provider_vector _providers;
00100 
00101             static void initialize();
00102                 
00103         public:
00104             static int addProvider(const Provider& provider);
00105             static int insertProviderAt(const Provider& provider, size_t position);
00106             static void removeProvider(const String& name);
00107             static const Provider* getProvider(const String& name);
00108             static const provider_vector& getProviders();
00109 
00110             static const String* getProperty(const String& key) throw ();
00111         };
00112     }
00113 }
00114 
00115 #endif
00116 
00117 #endif

Generated on Mon Jun 20 10:09:20 2005 for BeeCrypt by  doxygen 1.4.0