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

NSSCryptoKeyDSA.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * NSSCryptoKeyDSA := DSA Keys
00021  *
00022  * Author(s): Milan Tomic
00023  *
00024  */
00025 
00026 #ifndef NSSCRYPTOKEYDSA_INCLUDE
00027 #define NSSCRYPTOKEYDSA_INCLUDE
00028 
00029 #include <xsec/enc/XSECCryptoKeyDSA.hpp>
00030 
00031 #if defined (HAVE_NSS)
00032 
00033 #include "nss/pk11func.h"
00034 #include "nss/keyhi.h"
00035 #include "nss/nss.h"
00036 
00037 class NSSCryptoProvider;
00038 
00051 class DSIG_EXPORT NSSCryptoKeyDSA : public XSECCryptoKeyDSA {
00052 
00053 public :
00054 
00057     
00067     NSSCryptoKeyDSA(SECKEYPublicKey * pubkey = NULL, SECKEYPrivateKey * privkey = NULL);
00068     
00069     virtual ~NSSCryptoKeyDSA();
00070 
00072 
00075 
00083     virtual XSECCryptoKey::KeyType getKeyType();
00084 
00089     virtual const XMLCh * getProviderName() {return DSIGConstants::s_unicodeStrPROVNSS;}
00090     
00095     virtual XSECCryptoKey * clone();
00096 
00098 
00101 
00116     virtual unsigned int signBase64Signature(unsigned char * hashBuf,
00117                         unsigned int hashLen,
00118                         char * base64SignatureBuf,
00119                         unsigned int base64SignatureBufLen);
00120 
00133     virtual bool verifyBase64Signature(unsigned char * hashBuf, 
00134                          unsigned int hashLen,
00135                          char * base64Signature,
00136                          unsigned int sigLen);
00137 
00139 
00147 
00155     virtual void loadPBase64BigNums(const char * b64, unsigned int len);
00156 
00164     virtual void loadQBase64BigNums(const char * b64, unsigned int len);
00165 
00173     virtual void loadGBase64BigNums(const char * b64, unsigned int len);
00174     
00182     virtual void loadYBase64BigNums(const char * b64, unsigned int len);
00183     
00191     virtual void loadJBase64BigNums(const char * b64, unsigned int len);
00192 
00194 
00197 
00206     unsigned int getPBase64BigNums(char * b64, unsigned int len);
00207 
00216     unsigned int getQBase64BigNums(char * b64, unsigned int len);
00217 
00226     unsigned int getGBase64BigNums(char * b64, unsigned int len);
00227 
00236     unsigned int getYBase64BigNums(char * b64, unsigned int len);
00237 
00239 
00240 private:
00241 
00242     SECKEYPublicKey  *  mp_pubkey;
00243     SECKEYPrivateKey *  mp_privkey;
00244 
00245   SECItem * mp_P;
00246   SECItem * mp_Q;
00247   SECItem * mp_G;
00248   SECItem * mp_Y;
00249 
00250     // Instruct to import from parameters
00251 
00252     void importKey(void);
00253     void loadParamsFromKey(void);
00254 
00255 };
00256 
00257 #endif /* HAVE_NSS */
00258 #endif /* NSSCRYPTOKEYDSA_INCLUDE */

Generated on Sun Jan 28 19:37:22 2007 for XML-Security-C by  doxygen 1.4.2