20 #include <rdpear-common/rdpear_asn1.h>
21 #include <winpr/asn1.h>
23 wStream* rdpear_enc_Checksum(UINT32 cksumtype, krb5_checksum* csum)
32 WinPrAsn1Encoder* enc = WinPrAsn1Encoder_New(WINPR_ASN1_DER);
36 if (!WinPrAsn1EncSeqContainer(enc))
39 if (!WinPrAsn1EncContextualInteger(enc, 0, (WinPrAsn1_INTEGER)cksumtype))
43 octets.data = (BYTE*)csum->contents;
44 octets.len = csum->length;
45 if (!WinPrAsn1EncContextualOctetString(enc, 1, &octets) || !WinPrAsn1EncEndContainer(enc))
48 ret = Stream_New(NULL, 1024);
52 if (!WinPrAsn1EncToStream(enc, ret))
54 Stream_Free(ret, TRUE);
60 WinPrAsn1Encoder_Free(&enc);
64 wStream* rdpear_enc_EncryptedData(UINT32 encType, krb5_data* payload)
74 WinPrAsn1Encoder* enc = WinPrAsn1Encoder_New(WINPR_ASN1_DER);
78 if (!WinPrAsn1EncSeqContainer(enc))
81 if (!WinPrAsn1EncContextualInteger(enc, 0, (WinPrAsn1_INTEGER)encType))
85 octets.data = (BYTE*)payload->data;
86 octets.len = payload->length;
87 if (!WinPrAsn1EncContextualOctetString(enc, 2, &octets) || !WinPrAsn1EncEndContainer(enc))
90 ret = Stream_New(NULL, 1024);
94 if (!WinPrAsn1EncToStream(enc, ret))
96 Stream_Free(ret, TRUE);
102 WinPrAsn1Encoder_Free(&enc);