reSIProcate/stack  9694
WinSecurity.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_WINSECURITY_HXX)
00002 #define RESIP_WINSECURITY_HXX
00003 
00004 #if defined(HAVE_CONFIG_H)
00005   #include "config.h"
00006 #endif
00007 
00008 
00009 #include "resip/stack/ssl/Security.hxx"
00010 #include <wincrypt.h>
00011 
00012 namespace resip
00013 {
00014 
00021 class WinSecurity : public Security
00022 {
00023    public:
00024 
00025       typedef enum
00026       {
00027          ROOT_CA_STORE=1, //"ROOT": predefined system store
00028          CA_STORE=2,      //"CA": predefined system store 
00029          PRIVATE_STORE=3, //"MY": predefined system store; should store the domain certificate/private key
00030          USERS_STORE=4    //"DOMAIN_USERS" (only for server):
00031                           //administrator-defined system store; should store the
00032                           //certificate/private keys for the users associated
00033                           //with the domain
00034       } MsCertStoreType;
00035       //for details on certificate stores, see
00036       //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/certificate_services.asp
00037       WinSecurity(const CipherList& cipherList = ExportableSuite) : Security(cipherList){}
00038 
00039       virtual void preload();
00040       virtual void onReadPEM(const Data& name, PEMType type, Data& buffer) const;
00041       virtual void onWritePEM(const Data& name, PEMType type, const Data& buffer) const;
00042       virtual void onRemovePEM(const Data& name, PEMType type) const;
00043 
00044 
00045    protected:
00046       HCERTSTORE openSystemCertStore(const Data& name);
00047       void getCerts(MsCertStoreType eType);
00048       void closeCertifStore(HCERTSTORE);
00049 };
00050 
00051 }
00052 #endif
00053 
00054 /* ====================================================================
00055  * The Vovida Software License, Version 1.0 
00056  * 
00057  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00058  * 
00059  * Redistribution and use in source and binary forms, with or without
00060  * modification, are permitted provided that the following conditions
00061  * are met:
00062  * 
00063  * 1. Redistributions of source code must retain the above copyright
00064  *    notice, this list of conditions and the following disclaimer.
00065  * 
00066  * 2. Redistributions in binary form must reproduce the above copyright
00067  *    notice, this list of conditions and the following disclaimer in
00068  *    the documentation and/or other materials provided with the
00069  *    distribution.
00070  * 
00071  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00072  *    and "Vovida Open Communication Application Library (VOCAL)" must
00073  *    not be used to endorse or promote products derived from this
00074  *    software without prior written permission. For written
00075  *    permission, please contact vocal@vovida.org.
00076  *
00077  * 4. Products derived from this software may not be called "VOCAL", nor
00078  *    may "VOCAL" appear in their name, without prior written
00079  *    permission of Vovida Networks, Inc.
00080  * 
00081  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00082  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00083  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00084  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00085  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00086  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00087  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00088  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00089  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00090  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00091  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00092  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00093  * DAMAGE.
00094  * 
00095  * ====================================================================
00096  * 
00097  * This software consists of voluntary contributions made by Vovida
00098  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00099  * Inc.  For more information on Vovida Networks, Inc., please see
00100  * <http://www.vovida.org/>.
00101  *
00102  */