00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "SupportedKeyStoredMsg.h"
00019
00020 using namespace CODEX_KeyService;
00021
00022 SupportedKeyStoredMsg::SupportedKeyStoredMsg() :
00023 CODEX_ASN1::Base( false )
00024 {
00025 }
00026
00027 SupportedKeyStoredMsg::SupportedKeyStoredMsg(
00028 const CODEX_Client::KeyStoredMsg& response,
00029 const ArrayType& evidence,
00030 const LabelType& label ) :
00031 CODEX_ASN1::Base( true ),
00032 m_response( response ),
00033 m_evidence( evidence ),
00034 m_label( label )
00035 {
00036 }
00037
00038 SupportedKeyStoredMsg::SupportedKeyStoredMsg(
00039 const SupportedKeyStoredMsg& aOther ) :
00040 CODEX_ASN1::Base( aOther.m_initialized ),
00041 m_response( aOther.m_response ),
00042 m_evidence( aOther.m_evidence ),
00043 m_label( aOther.m_label )
00044 {
00045 }
00046
00047 SupportedKeyStoredMsg::~SupportedKeyStoredMsg()
00048 {
00049 }
00050
00051 void
00052 SupportedKeyStoredMsg::operator=( const SupportedKeyStoredMsg& aOther )
00053 {
00054 m_initialized = aOther.m_initialized;
00055 m_response = aOther.m_response;
00056 m_evidence = aOther.m_evidence;
00057 m_label = aOther.m_label;
00058 }
00059
00060 int
00061 SupportedKeyStoredMsg::marshal( unsigned char ** pp ) const
00062 {
00063 int r=0;
00064 int ret=0;
00065 unsigned char * p;
00066
00067 ret += m_response.marshal(0);
00068 ret += m_evidence.marshal(0);
00069 ret += m_label.marshal(0);
00070 M_ASN1_I2D_seq_total();
00071 m_response.marshal(&p);
00072 m_evidence.marshal(&p);
00073 m_label.marshal(&p);
00074 M_ASN1_I2D_finish();
00075 }
00076
00077 void*
00078 SupportedKeyStoredMsg::unmarshal( void* bogus,
00079 unsigned char ** pp,
00080 long length )
00081 {
00082 if ( m_initialized )
00083 {
00084 return NULL;
00085 }
00086 if ( (NULL == pp) || (NULL == *pp) )
00087 {
00088 return NULL;
00089 }
00090 ASN1_CTX c;
00091 c.pp = pp;
00092 c.q = *pp;
00093 c.error = ERR_R_NESTED_ASN1_ERROR;
00094 int i;
00095
00096 M_ASN1_D2I_Init();
00097 M_ASN1_D2I_start_sequence();
00098 M_ASN1_D2I_get(i, m_response.unmarshal);
00099 M_ASN1_D2I_get(i, m_evidence.unmarshal);
00100 M_ASN1_D2I_get(i, m_label.unmarshal);
00101 if ( !asn1_Finish(&c) )
00102 {
00103 return NULL;
00104 }
00105 *pp=c.p;
00106 m_initialized = true;
00107 return this;
00108 err:
00109 return NULL;
00110 }