/*************************************************
* PKCS #10 Header File                           *
* (C) 1999-2003 The Botan Project                *
*************************************************/

#ifndef BOTAN_PKCS10_H__
#define BOTAN_PKCS10_H__

#include <botan/x509_obj.h>
#include <botan/pkcs8.h>
#include <vector>

namespace Botan {

/*************************************************
* PKCS #10 Certificate Request                   *
*************************************************/
class PKCS10_Request : public X509_Object
   {
   public:
      X509_PublicKey* subject_public_key() const;

      SecureVector<byte> get_public_key() const;
      X509_DN get_subject_dn() const;
      AlternativeName get_subject_alt() const;
      Key_Constraints get_constraints() const;
      std::vector<OID> get_ex_constraints() const;

      bool is_CA() const;
      u32bit path_limit() const;

      std::string challenge_password() const;

      PKCS10_Request(DataSource&, X509_Encoding = PEM);
      PKCS10_Request(const std::string&, X509_Encoding = PEM);
   private:
      void force_decode();
      void handle_attribute(const Attribute&);
      void handle_v3_extension(const Extension&);
      SecureVector<byte> pub_key;
      X509_DN subject_dn;
      AlternativeName subject_alt;
      ASN1_String challenge;
      Key_Constraints constraints;
      std::vector<OID> ex_constraints;
      bool is_ca;
      u32bit max_path_len;
   };

}

#endif
