WvStreams
wvdsa.h
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2004 Net Integration Technologies, Inc.
00004  *
00005  * DSA cryptography abstractions.
00006  */
00007 #ifndef __WVDSA_H
00008 #define __WVDSA_H
00009 
00010 #include "wverror.h"
00011 #include "wvencoder.h"
00012 #include "wvencoderstream.h"
00013 
00014 struct dsa_st;
00015 
00023 class WvDSAKey : public WvErrorBase
00024 {
00025     WvString pub, prv;
00026 
00027     void init(WvStringParm keystr, bool priv);
00028     static WvString hexifypub(struct dsa_st *dsa);
00029     static WvString hexifyprv(struct dsa_st *dsa);
00030 
00031 public:
00032     struct dsa_st *dsa;
00033 
00034     WvDSAKey(const WvDSAKey &k);
00035     WvDSAKey(struct dsa_st *_dsa, bool priv); // note: takes ownership
00036 
00040     WvDSAKey(WvStringParm keystr, bool priv);
00041 
00045     WvDSAKey(int bits);
00046     
00047     ~WvDSAKey();
00048     
00049     virtual bool isok() const;
00050     
00056     WvString private_str() const
00057         { return prv; }
00058 
00062     WvString public_str() const
00063         { return pub; }
00064     
00069     WvString getpem(bool privkey);
00070 };
00071 
00072 
00073 #endif // __WVDSA_H