/*************************************************
* DL Scheme Header File                          *
* (C) 1999-2003 The Botan Project                *
*************************************************/

#ifndef BOTAN_DL_ALGO_H__
#define BOTAN_DL_ALGO_H__

#include <botan/dl_param.h>
#include <botan/x509_key.h>
#include <botan/pkcs8.h>

namespace Botan {

/*************************************************
* DL Public Key                                  *
*************************************************/
class DL_Scheme_PublicKey : public virtual X509_PublicKey
   {
   public:
      const DL_Group& get_domain() const { return group; }
      const BigInt& get_y() const { return y; }
      bool check_params() const;
   protected:
      void dl_initialize(const DL_Group&, const BigInt&);
      SecureVector<byte> DER_encode_pub() const;
      void BER_decode_pub(DataSource&);
      DL_Group group;
      BigInt y;
   };

/*************************************************
* DL Private Key                                 *
*************************************************/
class DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
                             public virtual PKCS8_PrivateKey
   {
   public:
      const BigInt& get_x() const { return x; }
   protected:
      SecureVector<byte> DER_encode_priv() const;
      void BER_decode_priv(DataSource&);
      BigInt x;
   };

}

#endif
