17 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 18 # pragma GCC diagnostic push 19 # pragma GCC diagnostic ignored "-Wconversion" 20 # pragma GCC diagnostic ignored "-Wsign-conversion" 215 enum Flag {PUT_OBJECTS=1, PUT_MESSANGE_END_AFTER_EACH_OBJECT=2, PUT_MESSANGE_END_AFTER_ALL_OBJECTS=4, PUT_MESSANGE_SERIES_END_AFTER_ALL_OBJECTS=8};
228 void Put(
const byte *inString,
size_t length);
240 enum State {IDENTIFIER, LENGTH, BODY,
TAIL, ALL_DONE} m_state;
256 bool EndReached()
const;
257 byte PeekByte()
const;
258 void CheckByte(
byte b);
272 void Init(
byte asnTag);
356 if (seqDecoder.
Peek(b) && (b & mask) == tag)
357 reset(
new T(seqDecoder));
364 if (this->
get() != NULL)
365 this->
get()->DEREncode(out);
373 template <
class BASE>
402 virtual OID GetAlgorithmID()
const =0;
425 virtual OID GetAlgorithmID()
const =0;
457 byte buf[
sizeof(w)+1];
461 buf[
sizeof(w)] = w ? 0xff : 0;
467 for (
unsigned int i=0; i<
sizeof(w); i++)
468 buf[i+1] =
byte(w >> (
sizeof(w)-1-i)*8);
470 while (bc > 1 && buf[
sizeof(w)+1-bc] == 0)
472 if (buf[
sizeof(w)+1-bc] & 0x80)
477 out.
Put(buf+
sizeof(w)+1-bc, bc);
478 return 1+lengthBytes+bc;
492 T minValue = 0,
T maxValue =
T(0xffffffff))
495 if (!in.
Get(b) || b != asnTag)
504 if (asnTag ==
BOOLEAN && bc != 1)
511 if (bc != in.
Get(buf, bc))
519 const byte *ptr = buf;
520 while (bc >
sizeof(w) && *ptr == 0)
529 for (
unsigned int i=0; i<bc; i++)
530 w = (w << 8) | ptr[i];
532 if (w < minValue || w > maxValue)
536 #ifdef CRYPTOPP_DOXYGEN_PROCESSING 558 inline bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
559 {
return lhs.m_values == rhs.m_values;}
560 inline bool operator!=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
561 {
return lhs.m_values != rhs.m_values;}
562 inline bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
563 {
return std::lexicographical_compare(lhs.m_values.begin(), lhs.m_values.end(), rhs.m_values.begin(), rhs.m_values.end());}
564 inline ::CryptoPP::OID
operator+(const ::CryptoPP::OID &lhs,
unsigned long rhs)
565 {return ::CryptoPP::OID(lhs)+=rhs;}
571 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 572 # pragma GCC diagnostic pop UnknownOID(const char *err)
Construct an UnknownOID.
lword RemainingLength() const
virtual ~PKCS8PrivateKey()
Utility functions for the Crypto++ library.
size_t DEREncodeUnsigned(BufferedTransformation &out, T w, byte asnTag=INTEGER)
DER Encode unsigned value.
DERSetEncoder(DERSetEncoder &outQueue, byte asnTag=SET|CONSTRUCTED)
Encodes and decodesprivateKeyInfo.
#define NAMESPACE_BEGIN(x)
DERSequenceEncoder(BufferedTransformation &outQueue, byte asnTag=SEQUENCE|CONSTRUCTED)
CRYPTOPP_DLL void CRYPTOPP_API DERReencode(BufferedTransformation &bt, BufferedTransformation &dest)
BER decode and DER re-encode.
Abstract base classes that provide a uniform interface to this library.
void StoreInitialize(const NameValuePairs ¶meters)
void BERDecodeUnsigned(BufferedTransformation &in, T &w, byte asnTag=INTEGER, T minValue=0, T maxValue=T(0xffffffff))
BER Decode unsigned value.
CRYPTOPP_DLL bool CRYPTOPP_API BERLengthDecode(BufferedTransformation &bt, size_t &length)
BER decode a length.
Classes for automatic resource management.
BERSequenceDecoder(BufferedTransformation &inQueue, byte asnTag=SEQUENCE|CONSTRUCTED)
void DEREncode(BufferedTransformation &out)
DER encode optional data.
CRYPTOPP_DLL void CRYPTOPP_API BERDecodeNull(BufferedTransformation &bt)
BER decode NULL.
Acts as a Source for pre-existing, static data.
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString(BufferedTransformation &bt, const byte *str, size_t strLen)
DER encode octet string.
ByteQueue m_optionalAttributes
OID(BufferedTransformation &bt)
Construct an OID.
bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
Pointer that overloads operator ->
const std::string DEFAULT_CHANNEL
Default channel for BufferedTransformation.
Optional data encoder and decoder.
void BERDecode(BERSequenceDecoder &seqDecoder, byte tag, byte mask=~CONSTRUCTED)
BER decode optional data.
std::vector< unsigned int > m_positions
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeBitString(BufferedTransformation &bt, const byte *str, size_t strLen, unsigned int unusedBits=0)
DER encode bit string.
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte asnTag)
BER decode text string.
inline::CryptoPP::OID operator+(const ::CryptoPP::OID &lhs, unsigned long rhs)
unsigned long GetPositionOfObject(unsigned int i) const
Classes for an unlimited queue to store bytes.
CRYPTOPP_DLL void CRYPTOPP_API DEREncodeNull(BufferedTransformation &bt)
DER encode NULL.
virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
UnknownOID()
Construct an UnknownOID.
OID & operator+=(word32 rhs)
Append a value to an OID.
BERSetDecoder(BufferedTransformation &inQueue, byte asnTag=SET|CONSTRUCTED)
ASN.1 encoded object filter.
Interface for encoding and decoding ASN1 objects.
virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
bool IsDefiniteLength() const
std::vector< word32 > m_values
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeBitString(BufferedTransformation &bt, SecByteBlock &str, unsigned int &unusedBits)
DER decode bit string.
bool operator!=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
BERSetDecoder(BERSetDecoder &inQueue, byte asnTag=SET|CONSTRUCTED)
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeTextString(BufferedTransformation &bt, const std::string &str, byte asnTag)
DER encode text string.
#define CRYPTOPP_ASSERT(exp)
virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt)
void BERDecodeError()
Raises a BERDecodeErr.
Data structure used to store byte strings.
#define CRYPTOPP_NO_VTABLE
Implementation of BufferedTransformation's attachment interface.
virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt)
BufferedTransformation & m_outQueue
OID(word32 v)
Construct an OID.
BERSequenceDecoder(BERSequenceDecoder &inQueue, byte asnTag=SEQUENCE|CONSTRUCTED)
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString(BufferedTransformation &bt, SecByteBlock &str)
BER decode octet string.
DERSetEncoder(BufferedTransformation &outQueue, byte asnTag=SET|CONSTRUCTED)
uint8_t const size_t const size
BufferedTransformation & m_inQueue
#define CRYPTOPP_UNUSED(x)
DERSequenceEncoder(DERSequenceEncoder &outQueue, byte asnTag=SEQUENCE|CONSTRUCTED)
void Load(BufferedTransformation &bt)
BER decode ASN.1 object.
Exception thrown when an unknown object identifier is encountered.
Implementation of BufferedTransformation's attachment interface.
std::vector< char * > parameters
CRYPTOPP_DLL size_t CRYPTOPP_API DERLengthEncode(BufferedTransformation &bt, lword length)
DER encode a length.
virtual ~EncodedObjectFilter()
Encodes and decodes subjectPublicKeyInfo.
void Save(BufferedTransformation &bt) const
DER encode ASN.1 object.
unsigned int GetNumberOfCompletedObjects() const
Encode and decode ASN.1 objects with additional information.
bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
Interface for retrieving values given their names.
Exception thrown when an ASN.1 BER decoing error is encountered.