WvStreams
wvdsa.h
1 /*
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
4  *
5  * DSA cryptography abstractions.
6  */
7 #ifndef __WVDSA_H
8 #define __WVDSA_H
9 
10 #include "wverror.h"
11 #include "wvencoder.h"
12 #include "wvencoderstream.h"
13 
14 struct dsa_st;
15 
23 class WvDSAKey : public WvErrorBase
24 {
25  WvString pub, prv;
26 
27  void init(WvStringParm keystr, bool priv);
28  static WvString hexifypub(struct dsa_st *dsa);
29  static WvString hexifyprv(struct dsa_st *dsa);
30 
31 public:
32  struct dsa_st *dsa;
33 
34  WvDSAKey(const WvDSAKey &k);
35  WvDSAKey(struct dsa_st *_dsa, bool priv); // note: takes ownership
36 
40  WvDSAKey(WvStringParm keystr, bool priv);
41 
45  WvDSAKey(int bits);
46 
47  ~WvDSAKey();
48 
49  virtual bool isok() const;
50 
57  { return prv; }
58 
63  { return pub; }
64 
69  WvString getpem(bool privkey);
70 };
71 
72 
73 #endif // __WVDSA_H
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvErrorBase
A class for managing error numbers and strings.
Definition: wverror.h:23
WvDSAKey::getpem
WvString getpem(bool privkey)
Retrieve the public or private key in PEM encoded format.
Definition: wvdsa.cc:116
WvDSAKey::isok
virtual bool isok() const
By default, returns true if geterr() == 0.
Definition: wvdsa.cc:66
WvDSAKey
An DSA public key or public/private key pair that can be used for encryption.
Definition: wvdsa.h:23
WvDSAKey::public_str
WvString public_str() const
Retrieve the public key as a hexified string.
Definition: wvdsa.h:62
WvDSAKey::private_str
WvString private_str() const
Retrieve the private key as a hexified string returns WvString::null if there is only a public key.
Definition: wvdsa.h:56