Botan 1.10.17
signed_obj.h
Go to the documentation of this file.
1/*
2* EAC SIGNED Object
3* (C) 2007 FlexSecure GmbH
4* 2008 Jack Lloyd
5*
6* Distributed under the terms of the Botan license
7*/
8
9#ifndef BOTAN_EAC_SIGNED_OBJECT_H__
10#define BOTAN_EAC_SIGNED_OBJECT_H__
11
12#include <botan/asn1_obj.h>
13#include <botan/pubkey_enums.h>
14#include <botan/pipe.h>
15#include <vector>
16
17namespace Botan {
18
19/**
20* This class represents abstract signed EAC object
21*/
22class BOTAN_DLL EAC_Signed_Object
23 {
24 public:
25 /**
26 * Get the TBS (to-be-signed) data in this object.
27 * @return DER encoded TBS data of this object
28 */
29 virtual SecureVector<byte> tbs_data() const = 0;
30
31 /**
32 * Get the signature of this object as a concatenation, i.e. if the
33 * signature consists of multiple parts (like in the case of ECDSA)
34 * these will be concatenated.
35 * @return signature as a concatenation of its parts
36 */
37
38 /*
39 NOTE: this is here only because abstract signature objects have
40 not yet been introduced
41 */
43
44 /**
45 * Get the signature algorithm identifier used to sign this object.
46 * @result the signature algorithm identifier
47 */
49
50 /**
51 * Check the signature of this object.
52 * @param key the public key associated with this signed object
53 * @param sig the signature we are checking
54 * @return true if the signature was created by the private key
55 * associated with this public key
56 */
57 bool check_signature(class Public_Key& key,
58 const MemoryRegion<byte>& sig) const;
59
60 /**
61 * Write this object DER encoded into a specified pipe.
62 * @param pipe the pipe to write the encoded object to
63 * @param encoding the encoding type to use
64 */
65 virtual void encode(Pipe& pipe,
66 X509_Encoding encoding = PEM) const = 0;
67
68 /**
69 * BER encode this object.
70 * @return result containing the BER representation of this object.
71 */
73
74 /**
75 * PEM encode this object.
76 * @return result containing the PEM representation of this object.
77 */
78 std::string PEM_encode() const;
79
80 virtual ~EAC_Signed_Object() {}
81 protected:
82 void do_decode();
84
87 std::string PEM_label_pref;
88 std::vector<std::string> PEM_labels_allowed;
89 private:
90 virtual void force_decode() = 0;
91 };
92
93}
94
95#endif
std::vector< std::string > PEM_labels_allowed
Definition signed_obj.h:88
AlgorithmIdentifier signature_algorithm() const
std::string PEM_encode() const
SecureVector< byte > BER_encode() const
bool check_signature(class Public_Key &key, const MemoryRegion< byte > &sig) const
SecureVector< byte > tbs_bits
Definition signed_obj.h:86
virtual SecureVector< byte > tbs_data() const =0
AlgorithmIdentifier sig_algo
Definition signed_obj.h:85
virtual SecureVector< byte > get_concat_sig() const =0
std::string PEM_label_pref
Definition signed_obj.h:87
virtual void encode(Pipe &pipe, X509_Encoding encoding=PEM) const =0