/*************************************************
* X.509 Public Key Header File                   *
* (C) 1999-2003 The Botan Project                *
*************************************************/

#ifndef BOTAN_X509_PUBLIC_KEY_H__
#define BOTAN_X509_PUBLIC_KEY_H__

#include <botan/pipe.h>
#include <botan/pk_keys.h>

namespace Botan {

/*************************************************
* X.509 Public Key                               *
*************************************************/
class X509_PublicKey : public virtual PK_Key
   {
   public:
      virtual SecureVector<byte> DER_encode_pub() const = 0;
      virtual void BER_decode_pub(DataSource&) = 0;
      virtual SecureVector<byte> DER_encode_params() const;
      virtual void BER_decode_params(DataSource&);
      virtual ~X509_PublicKey() {}
   };

namespace X509 {

/*************************************************
* X.509 Public Key Encoding/Decoding             *
*************************************************/
void encode(const X509_PublicKey&, Pipe&, X509_Encoding = PEM);
void decode(X509_PublicKey&, DataSource&, X509_Encoding = PEM);
std::string PEM_encode(const X509_PublicKey&);

X509_PublicKey* load_key(DataSource&, X509_Encoding = PEM);
X509_PublicKey* load_key(const SecureVector<byte>&);
X509_PublicKey* load_key(const std::string&, X509_Encoding = PEM);

Key_Constraints find_constraints(const X509_PublicKey&, Key_Constraints);

}

}

#endif
