ReactOS 0.4.16-dev-1946-g52006dd
encode.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winerror.h>
#include <wincrypt.h>
#include <snmp.h>
#include "wine/test.h"
Include dependency graph for encode.c:

Go to the source code of this file.

Classes

struct  encodedInt
 
struct  encodedBigInt
 
struct  encodedFiletime
 
struct  EncodedNameValue
 
struct  UnicodeExpectedError
 
struct  UnicodeExpectedResult
 
struct  encodedBits
 
struct  Constraints2
 
struct  EncodedRSAPubKey
 
struct  encodedExtensions
 
struct  encodedPublicKey
 
struct  EncodedNameConstraints
 

Macros

#define RDNA(arr)   oid_ ## arr, CERT_RDN_PRINTABLE_STRING, { sizeof(arr), (LPBYTE)arr }
 
#define RDNIA5(arr)   oid_ ## arr, CERT_RDN_IA5_STRING, { sizeof(arr), (LPBYTE)arr }
 

Functions

void CRYPT_CopyReversed (BYTE *dst, const BYTE *src, size_t len)
 
static void test_encodeInt (DWORD dwEncoding)
 
static void test_decodeInt (DWORD dwEncoding)
 
static void test_encodeEnumerated (DWORD dwEncoding)
 
static void test_decodeEnumerated (DWORD dwEncoding)
 
static void testTimeEncoding (DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
 
static const charprintSystemTime (const SYSTEMTIME *st)
 
static const charprintFileTime (const FILETIME *ft)
 
static void compareTime (const SYSTEMTIME *expected, const FILETIME *got)
 
static void testTimeDecoding (DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
 
static void test_encodeFiletime (DWORD dwEncoding)
 
static void test_decodeFiletime (DWORD dwEncoding)
 
static void test_encodeName (DWORD dwEncoding)
 
static void test_encodeUnicodeName (DWORD dwEncoding)
 
static void compareNameValues (const CERT_NAME_VALUE *expected, const CERT_NAME_VALUE *got)
 
static void compareRDNAttrs (const CERT_RDN_ATTR *expected, const CERT_RDN_ATTR *got)
 
static void compareRDNs (const CERT_RDN *expected, const CERT_RDN *got)
 
static void compareNames (const CERT_NAME_INFO *expected, const CERT_NAME_INFO *got)
 
static void test_decodeName (DWORD dwEncoding)
 
static void test_decodeUnicodeName (DWORD dwEncoding)
 
static void test_encodeNameValue (DWORD dwEncoding)
 
static void test_decodeNameValue (DWORD dwEncoding)
 
static void test_encodeAltName (DWORD dwEncoding)
 
static void test_decodeAltName (DWORD dwEncoding)
 
static void test_encodeUnicodeNameValue (DWORD dwEncoding)
 
static void test_decodeUnicodeNameValue (DWORD dwEncoding)
 
static void test_encodeOctets (DWORD dwEncoding)
 
static void test_decodeOctets (DWORD dwEncoding)
 
static void test_encodeBits (DWORD dwEncoding)
 
static void test_decodeBits (DWORD dwEncoding)
 
static void test_encodeBasicConstraints (DWORD dwEncoding)
 
static void test_decodeBasicConstraints (DWORD dwEncoding)
 
static void test_encodeRsaPublicKey (DWORD dwEncoding)
 
static void test_decodeRsaPublicKey (DWORD dwEncoding)
 
static void test_encodeRsaPublicKey_Bcrypt (DWORD dwEncoding)
 
static void test_decodeRsaPublicKey_Bcrypt (DWORD dwEncoding)
 
static void test_encodeSequenceOfAny (DWORD dwEncoding)
 
static void test_decodeSequenceOfAny (DWORD dwEncoding)
 
static void test_encodeExtensions (DWORD dwEncoding)
 
static void test_decodeExtensions (DWORD dwEncoding)
 
static void test_encodePublicKeyInfo (DWORD dwEncoding)
 
static void comparePublicKeyInfo (const CERT_PUBLIC_KEY_INFO *expected, const CERT_PUBLIC_KEY_INFO *got)
 
static void test_decodePublicKeyInfo (DWORD dwEncoding)
 
static void test_encodeCertToBeSigned (DWORD dwEncoding)
 
static void test_decodeCertToBeSigned (DWORD dwEncoding)
 
static void test_encodeCert (DWORD dwEncoding)
 
static void test_decodeCert (DWORD dwEncoding)
 
static void test_encodeCRLDistPoints (DWORD dwEncoding)
 
static void test_decodeCRLDistPoints (DWORD dwEncoding)
 
static void test_encodeCRLIssuingDistPoint (DWORD dwEncoding)
 
static void compareAltNameEntry (const CERT_ALT_NAME_ENTRY *expected, const CERT_ALT_NAME_ENTRY *got)
 
static void compareAltNameInfo (const CERT_ALT_NAME_INFO *expected, const CERT_ALT_NAME_INFO *got)
 
static void compareDistPointName (const CRL_DIST_POINT_NAME *expected, const CRL_DIST_POINT_NAME *got)
 
static void compareCRLIssuingDistPoints (const CRL_ISSUING_DIST_POINT *expected, const CRL_ISSUING_DIST_POINT *got)
 
static void test_decodeCRLIssuingDistPoint (DWORD dwEncoding)
 
static void test_encodeCRLToBeSigned (DWORD dwEncoding)
 
static void test_decodeCRLToBeSigned (DWORD dwEncoding)
 
static void test_encodeEnhancedKeyUsage (DWORD dwEncoding)
 
static void test_decodeEnhancedKeyUsage (DWORD dwEncoding)
 
static void test_encodeAuthorityKeyId (DWORD dwEncoding)
 
static void test_decodeAuthorityKeyId (DWORD dwEncoding)
 
static void test_encodeAuthorityKeyId2 (DWORD dwEncoding)
 
static void test_decodeAuthorityKeyId2 (DWORD dwEncoding)
 
static void test_encodeAuthorityInfoAccess (DWORD dwEncoding)
 
static void compareAuthorityInfoAccess (LPCSTR header, const CERT_AUTHORITY_INFO_ACCESS *expected, const CERT_AUTHORITY_INFO_ACCESS *got)
 
static void test_decodeAuthorityInfoAccess (DWORD dwEncoding)
 
static void test_encodeCTL (DWORD dwEncoding)
 
static void compareCTLInfo (LPCSTR header, const CTL_INFO *expected, const CTL_INFO *got)
 
static void test_decodeCTL (DWORD dwEncoding)
 
static void test_encodePKCSContentInfo (DWORD dwEncoding)
 
static void test_decodePKCSContentInfo (DWORD dwEncoding)
 
static void test_encodePKCSAttribute (DWORD dwEncoding)
 
static void test_decodePKCSAttribute (DWORD dwEncoding)
 
static void test_encodePKCSAttributes (DWORD dwEncoding)
 
static void test_decodePKCSAttributes (DWORD dwEncoding)
 
static void test_encodePKCSSMimeCapabilities (DWORD dwEncoding)
 
static void compareSMimeCapabilities (LPCSTR header, const CRYPT_SMIME_CAPABILITIES *expected, const CRYPT_SMIME_CAPABILITIES *got)
 
static void test_decodePKCSSMimeCapabilities (DWORD dwEncoding)
 
static void test_encodePKCSSignerInfo (DWORD dwEncoding)
 
static void test_decodePKCSSignerInfo (DWORD dwEncoding)
 
static void test_encodeCMSSignerInfo (DWORD dwEncoding)
 
static void test_decodeCMSSignerInfo (DWORD dwEncoding)
 
static void test_encodeNameConstraints (DWORD dwEncoding)
 
static void test_decodeNameConstraints (DWORD dwEncoding)
 
static void test_encodePolicyQualifierUserNotice (DWORD dwEncoding)
 
static void test_decodePolicyQualifierUserNotice (DWORD dwEncoding)
 
static void test_encodeCertPolicies (DWORD dwEncoding)
 
static void test_decodeCertPolicies (DWORD dwEncoding)
 
static void test_encodeCertPolicyMappings (DWORD dwEncoding)
 
static void test_decodeCertPolicyMappings (DWORD dwEncoding)
 
static void test_encodeCertPolicyConstraints (DWORD dwEncoding)
 
static void test_decodeCertPolicyConstraints (DWORD dwEncoding)
 
static void test_decodeRsaPrivateKey (DWORD dwEncoding)
 
static void testExportPublicKey (HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo)
 
static void testImportPublicKey (HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
 
static void testPortPublicKeyInfo (void)
 
static void test_encodeOCSPRequestInfo (DWORD dwEncoding)
 
static void test_decodeOCSPResponseInfo (DWORD dwEncoding)
 
static void test_decodeOCSPBasicSignedResponseInfo (DWORD dwEncoding)
 
static void test_decodeOCSPBasicResponseInfo (DWORD dwEncoding)
 
 START_TEST (encode)
 

Variables

static const BYTE bin1 [] = {0x02,0x01,0x01}
 
static const BYTE bin2 [] = {0x02,0x01,0x7f}
 
static const BYTE bin3 [] = {0x02,0x02,0x00,0x80}
 
static const BYTE bin4 [] = {0x02,0x02,0x01,0x00}
 
static const BYTE bin5 [] = {0x02,0x01,0x80}
 
static const BYTE bin6 [] = {0x02,0x02,0xff,0x7f}
 
static const BYTE bin7 [] = {0x02,0x04,0xba,0xdd,0xf0,0x0d}
 
static const struct encodedInt ints []
 
static const BYTE bin8 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin9 [] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
 
static const BYTE bin10 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin11 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
 
static const BYTE bin12 [] = {0x02,0x09,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin13 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0}
 
static const struct encodedBigInt bigInts []
 
static const BYTE bin14 [] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const BYTE bin15 [] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
 
static const BYTE bin16 [] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
 
static const BYTE bin17 [] = {0x02,0x0c,0x00,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
 
static const struct encodedBigInt bigUInts []
 
static const BYTE bin18 [] = {0x0a,0x01,0x01}
 
static const BYTE bin19 [] = {0x0a,0x05,0x00,0xff,0xff,0xff,0x80}
 
static const struct encodedInt enums []
 
static const LPCSTR enumeratedTypes []
 
static const BYTE bin20 []
 
static const BYTE bin21 []
 
static const BYTE bin22 []
 
static const struct encodedFiletime times []
 
static const BYTE bin23 []
 
static const BYTE bin24 []
 
static const BYTE bin25 []
 
static const BYTE bin26 []
 
static const BYTE bin27 []
 
static const BYTE bin28 []
 
static const BYTE bin29 []
 
static const BYTE bin30 []
 
static const BYTE bin31 []
 
static const BYTE bin32 []
 
static const BYTE bin33 []
 
static const BYTE bin34 []
 
static const BYTE bin35 []
 
static const BYTE bin36 []
 
static const BYTE bin37 []
 
static const BYTE bin38 []
 
static const char commonName [] = "Juan Lang"
 
static const char surName [] = "Lang"
 
static const BYTE emptySequence [] = { 0x30, 0 }
 
static const BYTE emptyRDNs [] = { 0x30, 0x02, 0x31, 0 }
 
static const BYTE twoRDNs []
 
static const BYTE encodedTwoRDNs []
 
static const BYTE us [] = { 0x55, 0x53 }
 
static const BYTE minnesota []
 
static const BYTE minneapolis []
 
static const BYTE codeweavers []
 
static const BYTE wine []
 
static const BYTE localhostAttr []
 
static const BYTE aric []
 
static CHAR oid_us [] = "2.5.4.6"
 
static CHAR oid_minnesota [] = "2.5.4.8"
 
static CHAR oid_minneapolis [] = "2.5.4.7"
 
static CHAR oid_codeweavers [] = "2.5.4.10"
 
static CHAR oid_wine [] = "2.5.4.11"
 
static CHAR oid_localhostAttr [] = "2.5.4.3"
 
static CHAR oid_aric [] = "1.2.840.113549.1.9.1"
 
static CERT_RDN_ATTR rdnAttrs []
 
static CERT_RDN_ATTR decodedRdnAttrs []
 
static const BYTE encodedRDNAttrs []
 
static const BYTE twoRDNsNoNull []
 
static const BYTE anyType []
 
static const BYTE emptyIndefiniteSequence [] = { 0x30,0x80,0x00,0x00 }
 
static const BYTE twoRDNsExtraBytes []
 
static const char bogusIA5 [] = "\x80"
 
static const char bogusPrintable [] = "~"
 
static const char bogusNumeric [] = "A"
 
static const BYTE bin42 [] = { 0x16,0x02,0x80,0x00 }
 
static const BYTE bin43 [] = { 0x13,0x02,0x7e,0x00 }
 
static const BYTE bin44 [] = { 0x12,0x02,0x41,0x00 }
 
static BYTE octetCommonNameValue []
 
static BYTE numericCommonNameValue []
 
static BYTE printableCommonNameValue []
 
static BYTE t61CommonNameValue []
 
static BYTE videotexCommonNameValue []
 
static BYTE ia5CommonNameValue []
 
static BYTE graphicCommonNameValue []
 
static BYTE visibleCommonNameValue []
 
static BYTE generalCommonNameValue []
 
static BYTE bmpCommonNameValue []
 
static BYTE utf8CommonNameValue []
 
static char embedded_null [] = "foo\0com"
 
static BYTE ia5EmbeddedNull []
 
static struct EncodedNameValue nameValues []
 
static struct EncodedNameValue embeddedNullNameValue
 
static const BYTE emptyURL [] = { 0x30, 0x02, 0x86, 0x00 }
 
static const BYTE emptyURLExtraBytes [] = { 0x30, 0x02, 0x86, 0x00, 0, 0, 0 }
 
static const WCHAR url [] = L"http://winehq.org"
 
static const BYTE encodedURL []
 
static const WCHAR dnsName [] = L"winehq.org"
 
static const BYTE encodedDnsName []
 
static const BYTE localhost [] = { 127, 0, 0, 1 }
 
static const BYTE encodedIPAddr []
 
static const unsigned char encodedCommonName []
 
static const BYTE encodedOidName [] = { 0x30,0x04,0x88,0x02,0x2a,0x03 }
 
static const BYTE encodedDirectoryName []
 
static struct UnicodeExpectedError unicodeErrors []
 
static BYTE oneNumeric [] = { 0x12, 0x01, 0x31 }
 
static BYTE onePrintable [] = { 0x13, 0x01, 0x31 }
 
static BYTE oneTeletex [] = { 0x14, 0x01, 0x31 }
 
static BYTE oneVideotex [] = { 0x15, 0x01, 0x31 }
 
static BYTE oneIA5 [] = { 0x16, 0x01, 0x31 }
 
static BYTE oneGraphic [] = { 0x19, 0x01, 0x31 }
 
static BYTE oneVisible [] = { 0x1a, 0x01, 0x31 }
 
static BYTE oneUniversal [] = { 0x1c, 0x04, 0x00, 0x00, 0x00, 0x31 }
 
static BYTE oneGeneral [] = { 0x1b, 0x01, 0x31 }
 
static BYTE oneBMP [] = { 0x1e, 0x02, 0x00, 0x31 }
 
static BYTE oneUTF8 [] = { 0x0c, 0x01, 0x31 }
 
static BYTE nihongoT61 []
 
static BYTE nihongoGeneral []
 
static BYTE nihongoBMP []
 
static BYTE nihongoUTF8 []
 
static struct UnicodeExpectedResult unicodeResults []
 
static struct UnicodeExpectedResult unicodeWeirdness []
 
static const unsigned char decoded_hi_octet [] = { 'h','i' }
 
static const unsigned char encoded_hi_octet [] = { ASN_OCTETSTRING,2,'h','i' }
 
static const unsigned char decoded_something_long_octet []
 
static const unsigned char encoded_something_long_octet []
 
static const unsigned char encoded_empty_octet [] = { ASN_OCTETSTRING,0 }
 
static const unsigned char encoded_constructed_hi_octet []
 
static const unsigned char encoded_constructed_hi_octet2 []
 
static const unsigned char encoded_constructed_hi_octet3 []
 
static const unsigned char encoded_constructed_hi_octet_invalid_end []
 
static const BYTE bytesToEncode [] = { 0xff, 0xff }
 
static const unsigned char bin52 [] = { 0x03,0x03,0x00,0xff,0xff }
 
static const unsigned char bin53 [] = { 0xff,0xff }
 
static const unsigned char bin54 [] = { 0x03,0x03,0x01,0xff,0xfe }
 
static const unsigned char bin55 [] = { 0xff,0xfe }
 
static const unsigned char bin56 [] = { 0x03,0x02,0x01,0xfe }
 
static const unsigned char bin57 [] = { 0xfe }
 
static const struct encodedBits bits []
 
static const unsigned char bin59 [] = { 0x30,0x00 }
 
static const unsigned char bin60 [] = { 0x30,0x03,0x01,0x01,0xff }
 
static const unsigned char bin61 [] = { 0x30,0x03,0x02,0x01,0x00 }
 
static const unsigned char bin62 [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static const struct Constraints2 constraints2 []
 
static const BYTE emptyConstraint [] = { 0x30, 0x03, 0x03, 0x01, 0x00 }
 
static const BYTE encodedDomainName []
 
static const BYTE constraintWithDomainName []
 
static const unsigned char bin63 [] = { 0x30,0x06,0x01,0x01,0x01,0x02,0x01,0x01 }
 
static const BYTE modulus1 [] = { 0,0,0,1,1,1,1,1 }
 
static const BYTE modulus2 [] = { 1,1,1,1,1,0,0,0 }
 
static const BYTE modulus3 [] = { 0x80,1,1,1,1,0,0,0 }
 
static const BYTE modulus4 [] = { 1,1,1,1,1,0,0,0x80 }
 
static const BYTE mod1_encoded [] = { 0x30,0x0f,0x02,0x08,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x01 }
 
static const BYTE mod2_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x02,0x00,0x01 }
 
static const BYTE mod3_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x80,0x02,0x03,0x02,0x00,0x01 }
 
static const BYTE mod4_encoded [] = { 0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x02,0x00,0x01 }
 
static const struct EncodedRSAPubKey rsaPubKeys []
 
static const BYTE intSequence []
 
static const BYTE mixedSequence []
 
static BYTE crit_ext_data [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static BYTE noncrit_ext_data [] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
 
static CHAR oid_basic_constraints2 [] = szOID_BASIC_CONSTRAINTS2
 
static CERT_EXTENSION criticalExt
 
static CERT_EXTENSION nonCriticalExt
 
static CHAR oid_short [] = "1.1"
 
static CERT_EXTENSION extWithShortOid
 
static const BYTE ext0 [] = { 0x30,0x00 }
 
static const BYTE ext1 []
 
static const BYTE ext2 []
 
static const BYTE ext3 [] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 }
 
static const struct encodedExtensions exts []
 
static const BYTE aKey []
 
static const BYTE params [] = { 0x02, 0x01, 0x01 }
 
static const unsigned char bin64 []
 
static const unsigned char bin65 []
 
static const unsigned char bin66 []
 
static const unsigned char bin67 []
 
static const unsigned char bin68 []
 
static const unsigned char bin69 []
 
static const unsigned char bin70 []
 
static const unsigned char bin71 []
 
static unsigned char bin72 [] = { 0x05,0x00}
 
static CHAR oid_bogus [] = "1.2.3"
 
static CHAR oid_rsa [] = szOID_RSA
 
static const struct encodedPublicKey pubKeys []
 
static const BYTE v1Cert []
 
static const BYTE v2Cert []
 
static const BYTE v3Cert []
 
static const BYTE v4Cert []
 
static const BYTE v1CertWithConstraints []
 
static const BYTE v1CertWithSerial []
 
static const BYTE bigCert []
 
static const BYTE v1CertWithPubKey []
 
static const BYTE v1CertWithPubKeyNoNull []
 
static const BYTE v1CertWithSubjectKeyId []
 
static const BYTE v1CertWithIssuerUniqueId []
 
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId []
 
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull []
 
static const BYTE serialNum [] = { 0x01 }
 
static const BYTE hash []
 
static const BYTE signedBigCert []
 
static const BYTE signedBigCertWithIndefiniteSeq []
 
static const BYTE emptyDistPoint [] = { 0x30, 0x02, 0x30, 0x00 }
 
static const BYTE distPointWithUrl []
 
static const BYTE distPointWithReason []
 
static const BYTE distPointWithIssuer []
 
static const BYTE distPointWithUrlAndIssuer []
 
static const BYTE crlReason
 
static const BYTE badFlagsIDP [] = { 0x30,0x06,0x81,0x01,0xff,0x82,0x01,0xff }
 
static const BYTE emptyNameIDP [] = { 0x30,0x04,0xa0,0x02,0xa0,0x00 }
 
static const BYTE urlIDP []
 
static const BYTE v1CRL []
 
static const BYTE v2CRL []
 
static const BYTE v1CRLWithIssuer []
 
static const BYTE v1CRLWithIssuerAndEmptyEntry []
 
static const BYTE v1CRLWithIssuerAndEntry []
 
static const BYTE v1CRLWithEntryExt []
 
static const BYTE v1CRLWithExt []
 
static const BYTE v2CRLWithExt []
 
static const BYTE verisignCRL []
 
static const BYTE verisignCRLWithLotsOfEntries []
 
static const LPCSTR keyUsages []
 
static const BYTE encodedUsage []
 
static BYTE keyId [] = { 1,2,3,4 }
 
static const BYTE authorityKeyIdWithId []
 
static const BYTE authorityKeyIdWithIssuer []
 
static const BYTE authorityKeyIdWithSerial [] = { 0x30,0x03,0x82,0x01,0x01 }
 
static const BYTE authorityKeyIdWithIssuerUrl []
 
static const BYTE authorityInfoAccessWithUrl []
 
static const BYTE authorityInfoAccessWithUrlAndIPAddr []
 
static const BYTE emptyCTL []
 
static const BYTE emptyCTLWithVersion1 []
 
static const BYTE ctlWithUsageIdentifier []
 
static const BYTE ctlWithListIdentifier []
 
static const BYTE ctlWithSequenceNumber []
 
static const BYTE ctlWithThisUpdate []
 
static const BYTE ctlWithThisAndNextUpdate []
 
static const BYTE ctlWithAlgId []
 
static const BYTE ctlWithBogusEntry []
 
static const BYTE ctlWithOneEntry []
 
static const BYTE ctlWithTwoEntries []
 
static const BYTE signedCTL []
 
static const BYTE signedCTLWithCTLInnerContent []
 
static const BYTE emptyPKCSContentInfo [] = { 0x30,0x04,0x06,0x02,0x2a,0x03 }
 
static const BYTE emptyPKCSContentInfoExtraBytes []
 
static const BYTE bogusPKCSContentInfo []
 
static const BYTE intPKCSContentInfo []
 
static BYTE bogusDER [] = { 1 }
 
static const BYTE indefiniteSignedPKCSContent []
 
static const BYTE content_abcd []
 
static const BYTE encoded_abcd []
 
static const BYTE content_constructed_abcd []
 
static const BYTE emptyPKCSAttr []
 
static const BYTE bogusPKCSAttr []
 
static const BYTE intPKCSAttr []
 
static const BYTE emptyPKCSAttributes [] = { 0x31,0x00 }
 
static const BYTE singlePKCSAttributes []
 
static const BYTE doublePKCSAttributes []
 
static const BYTE singleCapability []
 
static const BYTE twoCapabilities []
 
static const BYTE singleCapabilitywithNULL []
 
static BYTE encodedCommonNameNoNull []
 
static const BYTE minimalPKCSSigner []
 
static const BYTE PKCSSignerWithSerial []
 
static const BYTE PKCSSignerWithHashAlgo []
 
static const BYTE PKCSSignerWithHashAndEncryptionAlgo []
 
static const BYTE PKCSSignerWithHash []
 
static const BYTE PKCSSignerWithAuthAttr []
 
static const BYTE CMSSignerWithKeyId []
 
static BYTE emptyDNSPermittedConstraints []
 
static BYTE emptyDNSExcludedConstraints []
 
static BYTE DNSExcludedConstraints []
 
static BYTE permittedAndExcludedConstraints []
 
static BYTE permittedAndExcludedWithMinConstraints []
 
static BYTE permittedAndExcludedWithMinMaxConstraints []
 
static CERT_GENERAL_SUBTREE emptyDNSSubtree
 
static CERT_GENERAL_SUBTREE DNSSubtree
 
static CERT_GENERAL_SUBTREE IPAddressSubtree
 
static CERT_GENERAL_SUBTREE IPAddressWithMinSubtree
 
static CERT_GENERAL_SUBTREE IPAddressWithMinMaxSubtree
 
static const struct EncodedNameConstraints encodedNameConstraints []
 
static const BYTE noticeWithDisplayText []
 
static char org [] = "Wine"
 
static int noticeNumbers [] = { 2,3 }
 
static BYTE noticeWithReference []
 
static char oid_any_policy [] = "2.5.29.32.0"
 
static const BYTE policiesWithAnyPolicy []
 
static char oid1 [] = "1.2.3"
 
static char oid_user_notice [] = "1.3.6.1.5.5.7.2.2"
 
static const BYTE twoPolicies []
 
static const BYTE policyMappingWithOneMapping []
 
static const BYTE policyMappingWithTwoMappings []
 
static const LPCSTR mappingOids []
 
static const BYTE policyConstraintsWithRequireExplicit []
 
static const BYTE policyConstraintsWithInhibitMapping []
 
static const BYTE policyConstraintsWithBoth []
 
static const BYTE rsaPrivKeyDer []
 
static const BYTE rsaPrivKeyModulus []
 
static const BYTE rsaPrivKeyPrime1 []
 
static const BYTE rsaPrivKeyPrime2 []
 
static const BYTE rsaPrivKeyExponent1 []
 
static const BYTE rsaPrivKeyExponent2 []
 
static const BYTE rsaPrivKeyCoefficient []
 
static const BYTE rsaPrivKeyPrivateExponent []
 
static const BYTE expiredCert []
 
static const char cspName [] = "WineCryptTemp"
 
static const BYTE ocsp_response []
 
static const BYTE ocsp_response2 []
 
static const BYTE ocsp_basic_signed_response []
 
static const BYTE ocsp_basic_response []
 
static const BYTE ocsp_basic_response2 []
 
static const BYTE ocsp_basic_response_revoked []
 
static const BYTE ocsp_signature []
 
static const BYTE ocsp_basic_signed_response_with_cert []
 

Macro Definition Documentation

◆ RDNA

#define RDNA (   arr)    oid_ ## arr, CERT_RDN_PRINTABLE_STRING, { sizeof(arr), (LPBYTE)arr }

Definition at line 685 of file encode.c.

◆ RDNIA5

#define RDNIA5 (   arr)    oid_ ## arr, CERT_RDN_IA5_STRING, { sizeof(arr), (LPBYTE)arr }

Definition at line 686 of file encode.c.

Function Documentation

◆ compareAltNameEntry()

static void compareAltNameEntry ( const CERT_ALT_NAME_ENTRY expected,
const CERT_ALT_NAME_ENTRY got 
)
static

Definition at line 3864 of file encode.c.

3866{
3867 ok(expected->dwAltNameChoice == got->dwAltNameChoice,
3868 "Expected name choice %ld, got %ld\n", expected->dwAltNameChoice,
3869 got->dwAltNameChoice);
3870 if (expected->dwAltNameChoice == got->dwAltNameChoice)
3871 {
3872 switch (got->dwAltNameChoice)
3873 {
3877 case CERT_ALT_NAME_URL:
3879 ok((!expected->pwszURL && !got->pwszURL) ||
3880 (!expected->pwszURL && !lstrlenW(got->pwszURL)) ||
3881 (!got->pwszURL && !lstrlenW(expected->pwszURL)) ||
3882 !lstrcmpW(expected->pwszURL, got->pwszURL),
3883 "Unexpected name\n");
3884 break;
3888 ok(got->IPAddress.cbData == expected->IPAddress.cbData,
3889 "Unexpected IP address length %ld\n", got->IPAddress.cbData);
3890 ok(!memcmp(got->IPAddress.pbData, expected->IPAddress.pbData,
3891 got->IPAddress.cbData), "Unexpected value\n");
3892 break;
3893 }
3894 }
3895}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
BOOL expected
Definition: store.c:2000
LPWSTR pwszURL
Definition: wincrypt.h:348
DWORD dwAltNameChoice
Definition: wincrypt.h:342
CRYPT_DATA_BLOB IPAddress
Definition: wincrypt.h:349
BYTE * pbData
Definition: wincrypt.h:112
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:360
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:358
#define CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:361
#define CERT_ALT_NAME_EDI_PARTY_NAME
Definition: wincrypt.h:359
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:355
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:356
#define CERT_ALT_NAME_REGISTERED_ID
Definition: wincrypt.h:362
#define CERT_ALT_NAME_X400_ADDRESS
Definition: wincrypt.h:357

Referenced by compareAltNameInfo(), compareAuthorityInfoAccess(), and test_decodeNameConstraints().

◆ compareAltNameInfo()

static void compareAltNameInfo ( const CERT_ALT_NAME_INFO expected,
const CERT_ALT_NAME_INFO got 
)
static

Definition at line 3897 of file encode.c.

3899{
3900 DWORD i;
3901
3902 ok(expected->cAltEntry == got->cAltEntry, "Expected %ld entries, got %ld\n",
3903 expected->cAltEntry, got->cAltEntry);
3904 for (i = 0; i < min(expected->cAltEntry, got->cAltEntry); i++)
3905 compareAltNameEntry(&expected->rgAltEntry[i], &got->rgAltEntry[i]);
3906}
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void compareAltNameEntry(const CERT_ALT_NAME_ENTRY *expected, const CERT_ALT_NAME_ENTRY *got)
Definition: encode.c:3864
#define min(a, b)
Definition: monoChain.cc:55
PCERT_ALT_NAME_ENTRY rgAltEntry
Definition: wincrypt.h:366

Referenced by compareDistPointName().

◆ compareAuthorityInfoAccess()

static void compareAuthorityInfoAccess ( LPCSTR  header,
const CERT_AUTHORITY_INFO_ACCESS expected,
const CERT_AUTHORITY_INFO_ACCESS got 
)
static

Definition at line 5306 of file encode.c.

5309{
5310 DWORD i;
5311
5312 ok(expected->cAccDescr == got->cAccDescr,
5313 "%s: expected %ld access descriptions, got %ld\n", header,
5314 expected->cAccDescr, got->cAccDescr);
5315 for (i = 0; i < expected->cAccDescr; i++)
5316 {
5317 ok(!strcmp(expected->rgAccDescr[i].pszAccessMethod,
5318 got->rgAccDescr[i].pszAccessMethod), "%s[%ld]: expected %s, got %s\n",
5319 header, i, expected->rgAccDescr[i].pszAccessMethod,
5321 compareAltNameEntry(&expected->rgAccDescr[i].AccessLocation,
5322 &got->rgAccDescr[i].AccessLocation);
5323 }
5324}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
CERT_ALT_NAME_ENTRY AccessLocation
Definition: wincrypt.h:479
PCERT_ACCESS_DESCRIPTION rgAccDescr
Definition: wincrypt.h:484

Referenced by test_decodeAuthorityInfoAccess().

◆ compareCRLIssuingDistPoints()

static void compareCRLIssuingDistPoints ( const CRL_ISSUING_DIST_POINT expected,
const CRL_ISSUING_DIST_POINT got 
)
static

Definition at line 3917 of file encode.c.

3919{
3920 compareDistPointName(&expected->DistPointName, &got->DistPointName);
3921 ok(got->fOnlyContainsUserCerts == expected->fOnlyContainsUserCerts,
3922 "Unexpected fOnlyContainsUserCerts\n");
3923 ok(got->fOnlyContainsCACerts == expected->fOnlyContainsCACerts,
3924 "Unexpected fOnlyContainsCACerts\n");
3925 ok(got->OnlySomeReasonFlags.cbData == expected->OnlySomeReasonFlags.cbData,
3926 "Unexpected reason flags\n");
3927 ok(got->fIndirectCRL == expected->fIndirectCRL,
3928 "Unexpected fIndirectCRL\n");
3929}
static void compareDistPointName(const CRL_DIST_POINT_NAME *expected, const CRL_DIST_POINT_NAME *got)
Definition: encode.c:3908
CRL_DIST_POINT_NAME DistPointName
Definition: wincrypt.h:576
CRYPT_BIT_BLOB OnlySomeReasonFlags
Definition: wincrypt.h:579

Referenced by test_decodeCRLIssuingDistPoint().

◆ compareCTLInfo()

static void compareCTLInfo ( LPCSTR  header,
const CTL_INFO expected,
const CTL_INFO got 
)
static

Definition at line 5618 of file encode.c.

5620{
5621 DWORD i, j, k;
5622
5623 ok(expected->dwVersion == got->dwVersion,
5624 "%s: expected version %ld, got %ld\n", header, expected->dwVersion,
5625 got->dwVersion);
5626 ok(expected->SubjectUsage.cUsageIdentifier ==
5628 "%s: expected %ld usage identifiers, got %ld\n", header,
5629 expected->SubjectUsage.cUsageIdentifier,
5631 for (i = 0; i < expected->SubjectUsage.cUsageIdentifier; i++)
5632 ok(!strcmp(expected->SubjectUsage.rgpszUsageIdentifier[i],
5634 "%s[%ld]: expected %s, got %s\n", header, i,
5635 expected->SubjectUsage.rgpszUsageIdentifier[i],
5637 ok(expected->ListIdentifier.cbData == got->ListIdentifier.cbData,
5638 "%s: expected list identifier of %ld bytes, got %ld\n", header,
5639 expected->ListIdentifier.cbData, got->ListIdentifier.cbData);
5640 if (expected->ListIdentifier.cbData)
5641 ok(!memcmp(expected->ListIdentifier.pbData, got->ListIdentifier.pbData,
5642 expected->ListIdentifier.cbData),
5643 "%s: unexpected list identifier value\n", header);
5644 ok(expected->SequenceNumber.cbData == got->SequenceNumber.cbData,
5645 "%s: expected sequence number of %ld bytes, got %ld\n", header,
5646 expected->SequenceNumber.cbData, got->SequenceNumber.cbData);
5647 if (expected->SequenceNumber.cbData)
5648 ok(!memcmp(expected->SequenceNumber.pbData, got->SequenceNumber.pbData,
5649 expected->SequenceNumber.cbData),
5650 "%s: unexpected sequence number value\n", header);
5651 ok(!memcmp(&expected->ThisUpdate, &got->ThisUpdate, sizeof(FILETIME)),
5652 "%s: expected this update = (%ld, %ld), got (%ld, %ld)\n", header,
5653 expected->ThisUpdate.dwLowDateTime, expected->ThisUpdate.dwHighDateTime,
5655 ok(!memcmp(&expected->NextUpdate, &got->NextUpdate, sizeof(FILETIME)),
5656 "%s: expected next update = (%ld, %ld), got (%ld, %ld)\n", header,
5657 expected->NextUpdate.dwLowDateTime, expected->NextUpdate.dwHighDateTime,
5659 if (expected->SubjectAlgorithm.pszObjId &&
5660 *expected->SubjectAlgorithm.pszObjId && !got->SubjectAlgorithm.pszObjId)
5661 ok(0, "%s: expected subject algorithm %s, got NULL\n", header,
5662 expected->SubjectAlgorithm.pszObjId);
5663 if (expected->SubjectAlgorithm.pszObjId && got->SubjectAlgorithm.pszObjId)
5664 ok(!strcmp(expected->SubjectAlgorithm.pszObjId,
5666 "%s: expected subject algorithm %s, got %s\n", header,
5667 expected->SubjectAlgorithm.pszObjId, got->SubjectAlgorithm.pszObjId);
5668 ok(expected->SubjectAlgorithm.Parameters.cbData ==
5670 "%s: expected subject algorithm parameters of %ld bytes, got %ld\n", header,
5671 expected->SubjectAlgorithm.Parameters.cbData,
5673 if (expected->SubjectAlgorithm.Parameters.cbData)
5674 ok(!memcmp(expected->SubjectAlgorithm.Parameters.pbData,
5676 expected->SubjectAlgorithm.Parameters.cbData),
5677 "%s: unexpected subject algorithm parameter value\n", header);
5678 ok(expected->cCTLEntry == got->cCTLEntry,
5679 "%s: expected %ld CTL entries, got %ld\n", header, expected->cCTLEntry,
5680 got->cCTLEntry);
5681 for (i = 0; i < expected->cCTLEntry; i++)
5682 {
5683 ok(expected->rgCTLEntry[i].SubjectIdentifier.cbData ==
5685 "%s[%ld]: expected subject identifier of %ld bytes, got %ld\n",
5686 header, i, expected->rgCTLEntry[i].SubjectIdentifier.cbData,
5688 if (expected->rgCTLEntry[i].SubjectIdentifier.cbData)
5689 ok(!memcmp(expected->rgCTLEntry[i].SubjectIdentifier.pbData,
5691 expected->rgCTLEntry[i].SubjectIdentifier.cbData),
5692 "%s[%ld]: unexpected subject identifier value\n",
5693 header, i);
5694 for (j = 0; j < expected->rgCTLEntry[i].cAttribute; j++)
5695 {
5696 ok(!strcmp(expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5698 "%s[%ld][%ld]: expected attribute OID %s, got %s\n", header, i, j,
5699 expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5701 for (k = 0; k < expected->rgCTLEntry[i].rgAttribute[j].cValue; k++)
5702 {
5703 ok(expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData ==
5705 "%s[%ld][%ld][%ld]: expected value of %ld bytes, got %ld\n",
5706 header, i, j, k,
5707 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData,
5709 if (expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData)
5710 ok(!memcmp(
5711 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].pbData,
5713 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData),
5714 "%s[%ld][%ld][%ld]: unexpected value\n",
5715 header, i, j, k);
5716 }
5717 }
5718 }
5719 ok(expected->cExtension == got->cExtension,
5720 "%s: expected %ld extensions, got %ld\n", header, expected->cExtension,
5721 got->cExtension);
5722 for (i = 0; i < expected->cExtension; i++)
5723 {
5724 ok(!strcmp(expected->rgExtension[i].pszObjId,
5725 got->rgExtension[i].pszObjId), "%s[%ld]: expected %s, got %s\n",
5726 header, i, expected->rgExtension[i].pszObjId,
5727 got->rgExtension[i].pszObjId);
5728 ok(expected->rgExtension[i].fCritical == got->rgExtension[i].fCritical,
5729 "%s[%ld]: expected fCritical = %d, got %d\n", header, i,
5730 expected->rgExtension[i].fCritical, got->rgExtension[i].fCritical);
5731 ok(expected->rgExtension[i].Value.cbData ==
5732 got->rgExtension[i].Value.cbData,
5733 "%s[%ld]: expected extension value to have %ld bytes, got %ld\n",
5734 header, i, expected->rgExtension[i].Value.cbData,
5735 got->rgExtension[i].Value.cbData);
5736 if (expected->rgExtension[i].Value.cbData)
5737 ok(!memcmp(expected->rgExtension[i].Value.pbData,
5738 got->rgExtension[i].Value.pbData,
5739 expected->rgExtension[i].Value.cbData),
5740 "%s[%ld]: unexpected extension value\n", header, i);
5741 }
5742}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int k
Definition: mpi.c:3369
LPSTR pszObjId
Definition: wincrypt.h:239
CRYPT_OBJID_BLOB Value
Definition: wincrypt.h:241
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:136
PCRYPT_DATA_BLOB rgValue
Definition: wincrypt.h:607
CRYPT_DATA_BLOB SubjectIdentifier
Definition: wincrypt.h:836
PCRYPT_ATTRIBUTE rgAttribute
Definition: wincrypt.h:838
CRYPT_INTEGER_BLOB SequenceNumber
Definition: wincrypt.h:845
DWORD cExtension
Definition: wincrypt.h:851
DWORD dwVersion
Definition: wincrypt.h:842
CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm
Definition: wincrypt.h:848
FILETIME NextUpdate
Definition: wincrypt.h:847
PCTL_ENTRY rgCTLEntry
Definition: wincrypt.h:850
CRYPT_DATA_BLOB ListIdentifier
Definition: wincrypt.h:844
DWORD cCTLEntry
Definition: wincrypt.h:849
CTL_USAGE SubjectUsage
Definition: wincrypt.h:843
FILETIME ThisUpdate
Definition: wincrypt.h:846
PCERT_EXTENSION rgExtension
Definition: wincrypt.h:852
DWORD cUsageIdentifier
Definition: wincrypt.h:831
LPSTR * rgpszUsageIdentifier
Definition: wincrypt.h:832
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by test_decodeCTL().

◆ compareDistPointName()

static void compareDistPointName ( const CRL_DIST_POINT_NAME expected,
const CRL_DIST_POINT_NAME got 
)
static

Definition at line 3908 of file encode.c.

3910{
3911 ok(got->dwDistPointNameChoice == expected->dwDistPointNameChoice,
3912 "Unexpected name choice %ld\n", got->dwDistPointNameChoice);
3914 compareAltNameInfo(&(expected->FullName), &(got->FullName));
3915}
static void compareAltNameInfo(const CERT_ALT_NAME_INFO *expected, const CERT_ALT_NAME_INFO *got)
Definition: encode.c:3897
CERT_ALT_NAME_INFO FullName
Definition: wincrypt.h:518
DWORD dwDistPointNameChoice
Definition: wincrypt.h:516
#define CRL_DIST_POINT_FULL_NAME
Definition: wincrypt.h:523

Referenced by compareCRLIssuingDistPoints().

◆ compareNames()

static void compareNames ( const CERT_NAME_INFO expected,
const CERT_NAME_INFO got 
)
static

Definition at line 1002 of file encode.c.

1004{
1005 ok(got->cRDN == expected->cRDN, "Expected %ld RDNs, got %ld\n",
1006 expected->cRDN, got->cRDN);
1007 if (got->cRDN)
1008 {
1009 DWORD i;
1010
1011 for (i = 0; i < got->cRDN; i++)
1012 compareRDNs(&expected->rgRDN[i], &got->rgRDN[i]);
1013 }
1014}
static void compareRDNs(const CERT_RDN *expected, const CERT_RDN *got)
Definition: encode.c:989
PCERT_RDN rgRDN
Definition: wincrypt.h:277

Referenced by test_decodeName(), and test_decodeUnicodeName().

◆ compareNameValues()

static void compareNameValues ( const CERT_NAME_VALUE expected,
const CERT_NAME_VALUE got 
)
static

Definition at line 955 of file encode.c.

957{
958 ok(got->dwValueType == expected->dwValueType,
959 "Expected string type %ld, got %ld\n", expected->dwValueType,
960 got->dwValueType);
961 ok(got->Value.cbData == expected->Value.cbData ||
962 got->Value.cbData == expected->Value.cbData - sizeof(WCHAR) /* Win8 */,
963 "String type %ld: unexpected data size, got %ld, expected %ld\n",
964 expected->dwValueType, got->Value.cbData, expected->Value.cbData);
965 if (got->Value.cbData && got->Value.pbData)
966 ok(!memcmp(got->Value.pbData, expected->Value.pbData,
967 min(got->Value.cbData, expected->Value.cbData)),
968 "String type %ld: unexpected value\n", expected->dwValueType);
969}
DWORD dwValueType
Definition: wincrypt.h:281
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:282
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by compareRDNAttrs(), and test_decodeNameValue().

◆ comparePublicKeyInfo()

static void comparePublicKeyInfo ( const CERT_PUBLIC_KEY_INFO expected,
const CERT_PUBLIC_KEY_INFO got 
)
static

Definition at line 2909 of file encode.c.

2911{
2912 ok(!strcmp(expected->Algorithm.pszObjId, got->Algorithm.pszObjId),
2913 "Expected OID %s, got %s\n", expected->Algorithm.pszObjId,
2914 got->Algorithm.pszObjId);
2915 ok(expected->Algorithm.Parameters.cbData ==
2917 "Expected parameters of %ld bytes, got %ld\n",
2918 expected->Algorithm.Parameters.cbData, got->Algorithm.Parameters.cbData);
2919 if (expected->Algorithm.Parameters.cbData)
2920 ok(!memcmp(expected->Algorithm.Parameters.pbData,
2922 "Unexpected algorithm parameters\n");
2923 ok(expected->PublicKey.cbData == got->PublicKey.cbData,
2924 "Expected public key of %ld bytes, got %ld\n",
2925 expected->PublicKey.cbData, got->PublicKey.cbData);
2926 if (expected->PublicKey.cbData)
2927 ok(!memcmp(expected->PublicKey.pbData, got->PublicKey.pbData,
2928 got->PublicKey.cbData), "Unexpected public key value\n");
2929}
CRYPT_BIT_BLOB PublicKey
Definition: wincrypt.h:235
CRYPT_ALGORITHM_IDENTIFIER Algorithm
Definition: wincrypt.h:234
BYTE * pbData
Definition: wincrypt.h:206

Referenced by test_decodePublicKeyInfo().

◆ compareRDNAttrs()

static void compareRDNAttrs ( const CERT_RDN_ATTR expected,
const CERT_RDN_ATTR got 
)
static

Definition at line 971 of file encode.c.

973{
974 if (expected->pszObjId && *expected->pszObjId)
975 {
976 ok(got->pszObjId != NULL, "Expected OID %s, got NULL\n",
977 expected->pszObjId);
978 if (got->pszObjId)
979 {
980 ok(!strcmp(got->pszObjId, expected->pszObjId),
981 "Got unexpected OID %s, expected %s\n", got->pszObjId,
982 expected->pszObjId);
983 }
984 }
985 compareNameValues((const CERT_NAME_VALUE *)&expected->dwValueType,
986 (const CERT_NAME_VALUE *)&got->dwValueType);
987}
#define NULL
Definition: types.h:112
static void compareNameValues(const CERT_NAME_VALUE *expected, const CERT_NAME_VALUE *got)
Definition: encode.c:955
LPSTR pszObjId
Definition: wincrypt.h:265
DWORD dwValueType
Definition: wincrypt.h:266

Referenced by compareRDNs().

◆ compareRDNs()

static void compareRDNs ( const CERT_RDN expected,
const CERT_RDN got 
)
static

Definition at line 989 of file encode.c.

990{
991 ok(got->cRDNAttr == expected->cRDNAttr,
992 "Expected %ld RDN attrs, got %ld\n", expected->cRDNAttr, got->cRDNAttr);
993 if (got->cRDNAttr)
994 {
995 DWORD i;
996
997 for (i = 0; i < got->cRDNAttr; i++)
998 compareRDNAttrs(&expected->rgRDNAttr[i], &got->rgRDNAttr[i]);
999 }
1000}
static void compareRDNAttrs(const CERT_RDN_ATTR *expected, const CERT_RDN_ATTR *got)
Definition: encode.c:971
DWORD cRDNAttr
Definition: wincrypt.h:271
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:272

Referenced by compareNames().

◆ compareSMimeCapabilities()

static void compareSMimeCapabilities ( LPCSTR  header,
const CRYPT_SMIME_CAPABILITIES expected,
const CRYPT_SMIME_CAPABILITIES got 
)
static

Definition at line 6430 of file encode.c.

6432{
6433 DWORD i;
6434
6435 ok(got->cCapability == expected->cCapability,
6436 "%s: expected %ld capabilities, got %ld\n", header, expected->cCapability,
6437 got->cCapability);
6438 for (i = 0; i < expected->cCapability; i++)
6439 {
6440 ok(!strcmp(expected->rgCapability[i].pszObjId,
6441 got->rgCapability[i].pszObjId), "%s[%ld]: expected %s, got %s\n",
6442 header, i, expected->rgCapability[i].pszObjId,
6443 got->rgCapability[i].pszObjId);
6444 ok(expected->rgCapability[i].Parameters.cbData ==
6446 "%s[%ld]: expected %ld bytes, got %ld\n", header, i,
6447 expected->rgCapability[i].Parameters.cbData,
6449 if (expected->rgCapability[i].Parameters.cbData)
6450 ok(!memcmp(expected->rgCapability[i].Parameters.pbData,
6452 expected->rgCapability[i].Parameters.cbData),
6453 "%s[%ld]: unexpected value\n", header, i);
6454 }
6455}
PCRYPT_SMIME_CAPABILITY rgCapability
Definition: wincrypt.h:805
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:800

Referenced by test_decodePKCSSMimeCapabilities().

◆ compareTime()

static void compareTime ( const SYSTEMTIME expected,
const FILETIME got 
)
static

Definition at line 493 of file encode.c.

494{
495 SYSTEMTIME st;
496
497 FileTimeToSystemTime(got, &st);
498 ok(expected->wYear == st.wYear &&
499 expected->wMonth == st.wMonth &&
500 expected->wDay == st.wDay &&
501 expected->wHour == st.wHour &&
502 expected->wMinute == st.wMinute &&
503 expected->wSecond == st.wSecond &&
504 abs(expected->wMilliseconds - st.wMilliseconds) <= 1,
505 "Got unexpected value for time decoding:\nexpected %s, got %s\n",
507}
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
#define abs(i)
Definition: fconv.c:206
static const char * printFileTime(const FILETIME *ft)
Definition: encode.c:482
static const char * printSystemTime(const SYSTEMTIME *st)
Definition: encode.c:473
WORD wMilliseconds
Definition: minwinbase.h:263
WORD wSecond
Definition: minwinbase.h:262
WORD wMinute
Definition: minwinbase.h:261

Referenced by testTimeDecoding().

◆ CRYPT_CopyReversed()

void CRYPT_CopyReversed ( BYTE dst,
const BYTE src,
size_t  len 
)

Definition at line 30 of file encode.c.

31{
32 DWORD i;
33 for (i = 0; i < len; i++) {
34 dst[len - i - 1] = src[i];
35 }
36}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722

Referenced by test_decodeRsaPublicKey_Bcrypt(), and test_encodeRsaPublicKey_Bcrypt().

◆ printFileTime()

static const char * printFileTime ( const FILETIME ft)
static

Definition at line 482 of file encode.c.

483{
484 static char buf[64];
485 SYSTEMTIME st;
486
487 FileTimeToSystemTime(ft, &st);
488 sprintf(buf, "%02d-%02d-%04d %02d:%02d:%02d.%03d", st.wMonth, st.wDay,
489 st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
490 return buf;
491}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf
Definition: sprintf.c:45

Referenced by compareTime().

◆ printSystemTime()

static const char * printSystemTime ( const SYSTEMTIME st)
static

Definition at line 473 of file encode.c.

474{
475 static char buf[64];
476
477 sprintf(buf, "%02d-%02d-%04d %02d:%02d:%02d.%03d", st->wMonth, st->wDay,
478 st->wYear, st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
479 return buf;
480}

Referenced by compareTime().

◆ START_TEST()

START_TEST ( encode  )

Definition at line 9066 of file encode.c.

9067{
9068 static const DWORD encodings[] = { X509_ASN_ENCODING, PKCS_7_ASN_ENCODING,
9070 DWORD i;
9071
9072 for (i = 0; i < ARRAY_SIZE(encodings); i++)
9073 {
9074 test_encodeInt(encodings[i]);
9075 test_decodeInt(encodings[i]);
9076 test_encodeEnumerated(encodings[i]);
9077 test_decodeEnumerated(encodings[i]);
9078 test_encodeFiletime(encodings[i]);
9079 test_decodeFiletime(encodings[i]);
9080 test_encodeName(encodings[i]);
9081 test_decodeName(encodings[i]);
9082 test_encodeUnicodeName(encodings[i]);
9083 test_decodeUnicodeName(encodings[i]);
9084 test_encodeNameValue(encodings[i]);
9085 test_decodeNameValue(encodings[i]);
9086 test_encodeUnicodeNameValue(encodings[i]);
9087 test_decodeUnicodeNameValue(encodings[i]);
9088 test_encodeAltName(encodings[i]);
9089 test_decodeAltName(encodings[i]);
9090 test_encodeOctets(encodings[i]);
9091 test_decodeOctets(encodings[i]);
9092 test_encodeBits(encodings[i]);
9093 test_decodeBits(encodings[i]);
9094 test_encodeBasicConstraints(encodings[i]);
9095 test_decodeBasicConstraints(encodings[i]);
9096 test_encodeRsaPublicKey(encodings[i]);
9097 test_decodeRsaPublicKey(encodings[i]);
9100 test_encodeSequenceOfAny(encodings[i]);
9101 test_decodeSequenceOfAny(encodings[i]);
9102 test_encodeExtensions(encodings[i]);
9103 test_decodeExtensions(encodings[i]);
9104 test_encodePublicKeyInfo(encodings[i]);
9105 test_decodePublicKeyInfo(encodings[i]);
9106 test_encodeCertToBeSigned(encodings[i]);
9107 test_decodeCertToBeSigned(encodings[i]);
9108 test_encodeCert(encodings[i]);
9109 test_decodeCert(encodings[i]);
9110 test_encodeCRLDistPoints(encodings[i]);
9111 test_decodeCRLDistPoints(encodings[i]);
9114 test_encodeCRLToBeSigned(encodings[i]);
9115 test_decodeCRLToBeSigned(encodings[i]);
9116 test_encodeEnhancedKeyUsage(encodings[i]);
9117 test_decodeEnhancedKeyUsage(encodings[i]);
9118 test_encodeAuthorityKeyId(encodings[i]);
9119 test_decodeAuthorityKeyId(encodings[i]);
9120 test_encodeAuthorityKeyId2(encodings[i]);
9121 test_decodeAuthorityKeyId2(encodings[i]);
9124 test_encodeCTL(encodings[i]);
9125 test_decodeCTL(encodings[i]);
9126 test_encodePKCSContentInfo(encodings[i]);
9127 test_decodePKCSContentInfo(encodings[i]);
9128 test_encodePKCSAttribute(encodings[i]);
9129 test_decodePKCSAttribute(encodings[i]);
9130 test_encodePKCSAttributes(encodings[i]);
9131 test_decodePKCSAttributes(encodings[i]);
9134 test_encodePKCSSignerInfo(encodings[i]);
9135 test_decodePKCSSignerInfo(encodings[i]);
9136 test_encodeCMSSignerInfo(encodings[i]);
9137 test_decodeCMSSignerInfo(encodings[i]);
9138 test_encodeNameConstraints(encodings[i]);
9139 test_decodeNameConstraints(encodings[i]);
9142 test_encodeCertPolicies(encodings[i]);
9143 test_decodeCertPolicies(encodings[i]);
9144 test_encodeCertPolicyMappings(encodings[i]);
9145 test_decodeCertPolicyMappings(encodings[i]);
9148 test_decodeRsaPrivateKey(encodings[i]);
9149#ifdef __REACTOS__
9150 if ((GetVersion() & 0xFF) > 5) // These tests crash on Server 2003
9151 {
9152#endif
9153 test_encodeOCSPRequestInfo(encodings[i]);
9154 test_decodeOCSPResponseInfo(encodings[i]);
9157#ifdef __REACTOS__
9158 }
9159#endif
9160 }
9162}
#define ARRAY_SIZE(A)
Definition: main.h:20
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
static void test_decodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3260
static void test_decodeOctets(DWORD dwEncoding)
Definition: encode.c:1952
static void test_encodeEnumerated(DWORD dwEncoding)
Definition: encode.c:372
static void test_encodeName(DWORD dwEncoding)
Definition: encode.c:726
static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7404
static void test_decodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4992
static void test_decodeName(DWORD dwEncoding)
Definition: encode.c:1022
static void test_encodeAltName(DWORD dwEncoding)
Definition: encode.c:1401
static void test_encodeInt(DWORD dwEncoding)
Definition: encode.c:93
static void test_decodeCTL(DWORD dwEncoding)
Definition: encode.c:5780
static void test_encodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2344
static void test_decodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3931
static void test_decodeOCSPBasicSignedResponseInfo(DWORD dwEncoding)
Definition: encode.c:8857
static void test_decodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7728
static void test_decodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6298
static void test_decodeOCSPResponseInfo(DWORD dwEncoding)
Definition: encode.c:8596
static void test_encodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6136
static void test_encodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6374
static void test_decodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:7017
static void test_encodeCTL(DWORD dwEncoding)
Definition: encode.c:5445
static void test_decodeNameValue(DWORD dwEncoding)
Definition: encode.c:1318
static void test_encodeExtensions(DWORD dwEncoding)
Definition: encode.c:2745
static void test_decodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6191
static void test_encodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7808
static void test_encodeOCSPRequestInfo(DWORD dwEncoding)
Definition: encode.c:8422
static void test_decodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2227
static void test_decodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2931
static void test_encodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7523
static void test_decodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5141
static void test_decodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3665
static void test_decodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6730
static void test_encodeCert(DWORD dwEncoding)
Definition: encode.c:3462
static void test_decodeInt(DWORD dwEncoding)
Definition: encode.c:205
static void test_decodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7578
static void test_decodeBits(DWORD dwEncoding)
Definition: encode.c:2080
static void test_encodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5235
static void test_encodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2167
static void test_encodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3574
static void test_encodeBits(DWORD dwEncoding)
Definition: encode.c:2051
static void test_decodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2435
static void test_encodeFiletime(DWORD dwEncoding)
Definition: encode.c:547
static void test_decodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7331
static void test_encodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1757
static void test_decodeExtensions(DWORD dwEncoding)
Definition: encode.c:2769
static void test_encodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4841
static void test_decodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6457
static void test_decodeAltName(DWORD dwEncoding)
Definition: encode.c:1514
static void test_decodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4873
static void test_decodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5326
static void test_encodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4030
static void test_encodeNameValue(DWORD dwEncoding)
Definition: encode.c:1268
static void test_encodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:858
static void test_encodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2626
static void test_decodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7450
static void test_encodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6246
static void test_encodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:5962
static void test_encodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2883
static void test_encodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3796
static void test_encodeRsaPublicKey_Bcrypt(DWORD dwEncoding)
Definition: encode.c:2499
static void test_decodeOCSPBasicResponseInfo(DWORD dwEncoding)
Definition: encode.c:8897
static void test_encodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7664
static void test_decodeRsaPublicKey_Bcrypt(DWORD dwEncoding)
Definition: encode.c:2552
static void test_encodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6859
static void test_encodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6573
static void test_decodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4691
static void test_decodeCert(DWORD dwEncoding)
Definition: encode.c:3485
static void test_encodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4933
static void test_encodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7192
static void testPortPublicKeyInfo(void)
Definition: encode.c:8399
static void test_encodeOctets(DWORD dwEncoding)
Definition: encode.c:1896
static void test_decodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1858
static void test_decodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7875
static void test_decodeFiletime(DWORD dwEncoding)
Definition: encode.c:592
static void test_decodeRsaPrivateKey(DWORD dwEncoding)
Definition: encode.c:8152
static void test_decodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:6069
static void test_decodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2670
static void test_decodeEnumerated(DWORD dwEncoding)
Definition: encode.c:405
static void test_encodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5072
static void test_decodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:1121
static void test_encodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3083
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2503

◆ test_decodeAltName()

static void test_decodeAltName ( DWORD  dwEncoding)
static

Definition at line 1514 of file encode.c.

1515{
1516 static const BYTE unimplementedType[] = { 0x30, 0x06, 0x85, 0x04, 0x7f,
1517 0x00, 0x00, 0x01 };
1518 static const BYTE bogusType[] = { 0x30, 0x06, 0x89, 0x04, 0x7f, 0x00, 0x00,
1519 0x01 };
1520 static const BYTE dns_embedded_null[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1521 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1522 static const BYTE dns_embedded_bell[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1523 0x6f,0x2e,0x63,0x6f,0x6d,0x07,0x62,0x61,0x64,0x64,0x69,0x65 };
1524 static const BYTE url_embedded_null[] = { 0x30,0x10,0x86,0x0e,0x66,0x6f,
1525 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1526 BOOL ret;
1527 BYTE *buf = NULL;
1528 DWORD bufSize = 0;
1530
1531 /* Test some bogus ones first */
1533 unimplementedType, sizeof(unimplementedType), CRYPT_DECODE_ALLOC_FLAG,
1534 NULL, &buf, &bufSize);
1536 "Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
1538 bogusType, sizeof(bogusType), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
1539 &bufSize);
1541 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
1542 /* Now expected cases */
1545 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1546 if (ret)
1547 {
1549
1550 ok(info->cAltEntry == 0, "Expected 0 entries, got %ld\n",
1551 info->cAltEntry);
1552 LocalFree(buf);
1553 }
1556 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1557 if (ret)
1558 {
1560
1561 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1562 info->cAltEntry);
1563 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1564 "Expected CERT_ALT_NAME_URL, got %ld\n",
1565 info->rgAltEntry[0].dwAltNameChoice);
1566 ok(info->rgAltEntry[0].pwszURL == NULL || !*info->rgAltEntry[0].pwszURL,
1567 "Expected empty URL\n");
1568 LocalFree(buf);
1569 }
1572 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1575 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1576 if (ret)
1577 {
1579
1580 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1581 info->cAltEntry);
1582 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1583 "Expected CERT_ALT_NAME_URL, got %ld\n",
1584 info->rgAltEntry[0].dwAltNameChoice);
1585 ok(!lstrcmpW(info->rgAltEntry[0].pwszURL, url), "Unexpected URL\n");
1586 LocalFree(buf);
1587 }
1590 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1591 if (ret)
1592 {
1594
1595 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1596 info->cAltEntry);
1597 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1598 "Expected CERT_ALT_NAME_DNS_NAME, got %ld\n",
1599 info->rgAltEntry[0].dwAltNameChoice);
1600 ok(!lstrcmpW(info->rgAltEntry[0].pwszDNSName, dnsName),
1601 "Unexpected DNS name\n");
1602 LocalFree(buf);
1603 }
1606 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1607 if (ret)
1608 {
1610
1611 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1612 info->cAltEntry);
1613 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_IP_ADDRESS,
1614 "Expected CERT_ALT_NAME_IP_ADDRESS, got %ld\n",
1615 info->rgAltEntry[0].dwAltNameChoice);
1616 ok(info->rgAltEntry[0].IPAddress.cbData == sizeof(localhost),
1617 "Unexpected IP address length %ld\n",
1618 info->rgAltEntry[0].IPAddress.cbData);
1619 ok(!memcmp(info->rgAltEntry[0].IPAddress.pbData, localhost,
1620 sizeof(localhost)), "Unexpected IP address value\n");
1621 LocalFree(buf);
1622 }
1625 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1626 if (ret)
1627 {
1629
1630 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1631 info->cAltEntry);
1632 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_REGISTERED_ID,
1633 "Expected CERT_ALT_NAME_REGISTERED_ID, got %ld\n",
1634 info->rgAltEntry[0].dwAltNameChoice);
1635 ok(!strcmp(info->rgAltEntry[0].pszRegisteredID, "1.2.3"),
1636 "Expected OID 1.2.3, got %s\n", info->rgAltEntry[0].pszRegisteredID);
1637 LocalFree(buf);
1638 }
1642 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1643 if (ret)
1644 {
1646
1647 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1648 info->cAltEntry);
1649 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME,
1650 "Expected CERT_ALT_NAME_DIRECTORY_NAME, got %ld\n",
1651 info->rgAltEntry[0].dwAltNameChoice);
1652 ok(info->rgAltEntry[0].DirectoryName.cbData ==
1653 sizeof(encodedCommonName), "Unexpected directory name length %ld\n",
1654 info->rgAltEntry[0].DirectoryName.cbData);
1655 ok(!memcmp(info->rgAltEntry[0].DirectoryName.pbData,
1657 "Unexpected directory name value\n");
1658 LocalFree(buf);
1659 }
1661 dns_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1662 NULL, &buf, &bufSize);
1663#if defined(__REACTOS__) && defined(_M_AMD64)
1664 if ((GetVersion() & 0xFFFF) != 0x0006) // Next test fails on Vista x64
1665#endif
1666 ok(!ret, "expected failure\n");
1667 /* An embedded bell character is allowed, however. */
1669 dns_embedded_bell, sizeof(dns_embedded_bell), CRYPT_DECODE_ALLOC_FLAG,
1670 NULL, &buf, &bufSize);
1671 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1672 if (ret)
1673 {
1675
1676 ok(info->cAltEntry == 1, "Expected 1 entries, got %ld\n",
1677 info->cAltEntry);
1678 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1679 "Expected CERT_ALT_NAME_DNS_NAME, got %ld\n",
1680 info->rgAltEntry[0].dwAltNameChoice);
1681 LocalFree(buf);
1682 }
1684 url_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1685 NULL, &buf, &bufSize);
1686#if defined(__REACTOS__) && defined(_M_AMD64)
1687 if ((GetVersion() & 0xFFFF) != 0x0006) // Next test fails on Vista x64
1688#endif
1689 ok(!ret, "expected failure\n");
1690}
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLsizei bufSize
Definition: glext.h:6040
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
static const BYTE encodedIPAddr[]
Definition: encode.c:1392
static const WCHAR dnsName[]
Definition: encode.c:1388
static const unsigned char encodedCommonName[]
Definition: encode.c:1394
static const BYTE encodedOidName[]
Definition: encode.c:1396
static const BYTE emptyURLExtraBytes[]
Definition: encode.c:1383
static const WCHAR url[]
Definition: encode.c:1384
static const BYTE emptySequence[]
Definition: encode.c:658
static const BYTE encodedURL[]
Definition: encode.c:1385
static const BYTE localhost[]
Definition: encode.c:1391
static const BYTE emptyURL[]
Definition: encode.c:1382
static const BYTE encodedDnsName[]
Definition: encode.c:1389
static const BYTE encodedDirectoryName[]
Definition: encode.c:1397
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3612
#define X509_ALTERNATE_NAME
Definition: wincrypt.h:3529
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:4502
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:4510
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_decodeAuthorityInfoAccess()

static void test_decodeAuthorityInfoAccess ( DWORD  dwEncoding)
static

Definition at line 5326 of file encode.c.

5327{
5328 static char oid1[] = "1.2.3";
5329 static char oid2[] = "1.5.6";
5330 BOOL ret;
5331 LPBYTE buf = NULL;
5332 DWORD size = 0;
5333
5336 &buf, &size);
5337 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
5338 if (ret)
5339 {
5341
5342 compareAuthorityInfoAccess("empty AIA", &aia,
5344 LocalFree(buf);
5345 buf = NULL;
5346 }
5350 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
5351 if (ret)
5352 {
5353 CERT_ACCESS_DESCRIPTION accessDescription;
5355
5356 accessDescription.pszAccessMethod = oid1;
5358 accessDescription.AccessLocation.pwszURL = (LPWSTR)url;
5359 aia.cAccDescr = 1;
5360 aia.rgAccDescr = &accessDescription;
5361 compareAuthorityInfoAccess("AIA with URL", &aia,
5363 LocalFree(buf);
5364 buf = NULL;
5365 }
5369 NULL, &buf, &size);
5370 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
5371 if (ret)
5372 {
5373 CERT_ACCESS_DESCRIPTION accessDescription[2];
5375
5376 accessDescription[0].pszAccessMethod = oid1;
5377 accessDescription[0].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5378 accessDescription[0].AccessLocation.pwszURL = (LPWSTR)url;
5379 accessDescription[1].pszAccessMethod = oid2;
5381 accessDescription[1].AccessLocation.IPAddress.cbData = sizeof(encodedIPAddr);
5382 accessDescription[1].AccessLocation.IPAddress.pbData = (LPBYTE)encodedIPAddr;
5383 aia.cAccDescr = 2;
5384 aia.rgAccDescr = accessDescription;
5385 compareAuthorityInfoAccess("AIA with URL and IP addr", &aia,
5387 LocalFree(buf);
5388 buf = NULL;
5389 }
5393 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
5394 buf = calloc(1, size);
5395 if (buf)
5396 {
5400 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
5401 free(buf);
5402 }
5403}
#define free
Definition: debug_ros.c:5
static WCHAR aia[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1601
GLsizeiptr size
Definition: glext.h:5919
static const BYTE authorityInfoAccessWithUrl[]
Definition: encode.c:5227
static const BYTE authorityInfoAccessWithUrlAndIPAddr[]
Definition: encode.c:5230
static void compareAuthorityInfoAccess(LPCSTR header, const CERT_AUTHORITY_INFO_ACCESS *expected, const CERT_AUTHORITY_INFO_ACCESS *got)
Definition: encode.c:5306
static char oid1[]
Definition: encode.c:7512
#define calloc
Definition: rosglue.h:14
unsigned char * LPBYTE
Definition: typedefs.h:53
#define X509_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3551
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId()

static void test_decodeAuthorityKeyId ( DWORD  dwEncoding)
static

Definition at line 4992 of file encode.c.

4993{
4994 BOOL ret;
4995 LPBYTE buf = NULL;
4996 DWORD size = 0;
4997
5000 &buf, &size);
5001 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5002 if (ret)
5003 {
5005
5006 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %ld\n",
5007 size);
5008 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5009 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5010 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5011 LocalFree(buf);
5012 }
5016 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5017 if (ret)
5018 {
5020
5021 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %ld\n",
5022 size);
5023 ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5024 ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5025 "Unexpected key id\n");
5026 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5027 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5028 LocalFree(buf);
5029 }
5033 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5034 if (ret)
5035 {
5037
5038 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %ld\n",
5039 size);
5040 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5041 ok(info->CertIssuer.cbData == sizeof(encodedCommonName),
5042 "Unexpected issuer len\n");
5043 ok(!memcmp(info->CertIssuer.pbData, encodedCommonName,
5044 sizeof(encodedCommonName)), "Unexpected issuer\n");
5045 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5046 LocalFree(buf);
5047 }
5051 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5052 if (ret)
5053 {
5055
5056 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %ld\n",
5057 size);
5058 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5059 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5060 ok(info->CertSerialNumber.cbData == sizeof(serialNum),
5061 "Unexpected serial number len\n");
5062 ok(!memcmp(info->CertSerialNumber.pbData, serialNum, sizeof(serialNum)),
5063 "Unexpected serial number\n");
5064 LocalFree(buf);
5065 }
5066}
static const BYTE serialNum[]
Definition: encode.c:3081
static const BYTE authorityKeyIdWithIssuer[]
Definition: encode.c:4928
static const BYTE authorityKeyIdWithId[]
Definition: encode.c:4926
static const BYTE authorityKeyIdWithSerial[]
Definition: encode.c:4931
static BYTE keyId[]
Definition: encode.c:4925
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3526

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId2()

static void test_decodeAuthorityKeyId2 ( DWORD  dwEncoding)
static

Definition at line 5141 of file encode.c.

5142{
5143 BOOL ret;
5144 LPBYTE buf = NULL;
5145 DWORD size = 0;
5146
5149 &buf, &size);
5150 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5151 if (ret)
5152 {
5154
5155 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %ld\n",
5156 size);
5157 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5158 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5159 "Expected no issuer name entries\n");
5160 ok(info->AuthorityCertSerialNumber.cbData == 0,
5161 "Expected no serial number\n");
5162 LocalFree(buf);
5163 }
5167 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5168 if (ret)
5169 {
5171
5172 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %ld\n",
5173 size);
5174 ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5175 ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5176 "Unexpected key id\n");
5177 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5178 "Expected no issuer name entries\n");
5179 ok(info->AuthorityCertSerialNumber.cbData == 0,
5180 "Expected no serial number\n");
5181 LocalFree(buf);
5182 }
5186 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5187 if (ret)
5188 {
5190
5191 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %ld\n",
5192 size);
5193 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5194 ok(info->AuthorityCertIssuer.cAltEntry == 1,
5195 "Expected 1 issuer entry, got %ld\n",
5196 info->AuthorityCertIssuer.cAltEntry);
5197 ok(info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice ==
5198 CERT_ALT_NAME_URL, "Expected CERT_ALT_NAME_URL, got %ld\n",
5199 info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice);
5200 ok(!lstrcmpW(info->AuthorityCertIssuer.rgAltEntry[0].pwszURL,
5201 url), "Unexpected URL\n");
5202 ok(info->AuthorityCertSerialNumber.cbData == 0,
5203 "Expected no serial number\n");
5204 LocalFree(buf);
5205 }
5209 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5210 if (ret)
5211 {
5213
5214 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %ld\n",
5215 size);
5216 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5217 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5218 "Expected no issuer name entries\n");
5219 ok(info->AuthorityCertSerialNumber.cbData == sizeof(serialNum),
5220 "Unexpected serial number len\n");
5221 ok(!memcmp(info->AuthorityCertSerialNumber.pbData, serialNum,
5222 sizeof(serialNum)), "Unexpected serial number\n");
5223 LocalFree(buf);
5224 }
5225}
static const BYTE authorityKeyIdWithIssuerUrl[]
Definition: encode.c:5068
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3550

Referenced by START_TEST().

◆ test_decodeBasicConstraints()

static void test_decodeBasicConstraints ( DWORD  dwEncoding)
static

Definition at line 2227 of file encode.c.

2228{
2229 static const BYTE inverted[] = { 0x30, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01,
2230 0xff };
2231 static const struct Constraints2 badBool = { { TRUE, TRUE, 1 }, bin63 };
2232 DWORD i;
2233 BOOL ret;
2234 BYTE *buf = NULL;
2235 DWORD bufSize = 0;
2236
2237 /* First test with simpler info2 */
2238 for (i = 0; i < ARRAY_SIZE(constraints2); i++)
2239 {
2243 ok(ret, "CryptDecodeObjectEx failed for item %ld: %08lx\n", i,
2244 GetLastError());
2245 if (ret)
2246 {
2249
2250 ok(!memcmp(info, &constraints2[i].info, sizeof(*info)),
2251 "Unexpected value for item %ld\n", i);
2252 LocalFree(buf);
2253 }
2254 }
2255 /* Check with the order of encoded elements inverted */
2256 buf = (PBYTE)1;
2258 inverted, inverted[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
2259 &bufSize);
2261 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
2262 ok(!buf, "Expected buf to be set to NULL\n");
2263 /* Check with a non-DER bool */
2265 badBool.encoded, badBool.encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
2266 &buf, &bufSize);
2267 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2268 if (ret)
2269 {
2272
2273 ok(!memcmp(info, &badBool.info, sizeof(*info)), "Unexpected value\n");
2274 LocalFree(buf);
2275 }
2276 /* Check with a non-basic constraints value */
2281 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
2282 /* Now check with the more complex CERT_BASIC_CONSTRAINTS_INFO */
2285 &buf, &bufSize);
2286 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2287 if (ret)
2288 {
2290
2291 ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2292 ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2293 ok(info->cSubtreesConstraint == 0, "Expected no subtree constraints\n");
2294 LocalFree(buf);
2295 }
2299 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2300 if (ret)
2301 {
2303
2304 ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2305 ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2306 ok(info->cSubtreesConstraint == 1, "Expected a subtree constraint\n");
2307 if (info->cSubtreesConstraint && info->rgSubtreesConstraint)
2308 {
2309 ok(info->rgSubtreesConstraint[0].cbData ==
2310 sizeof(encodedDomainName), "Wrong size %ld\n",
2311 info->rgSubtreesConstraint[0].cbData);
2312 ok(!memcmp(info->rgSubtreesConstraint[0].pbData, encodedDomainName,
2313 sizeof(encodedDomainName)), "Unexpected value\n");
2314 }
2315 LocalFree(buf);
2316 }
2317}
#define TRUE
Definition: types.h:120
static const unsigned char bin63[]
Definition: encode.c:2225
static const BYTE emptyConstraint[]
Definition: encode.c:2156
static const BYTE constraintWithDomainName[]
Definition: encode.c:2161
static const struct Constraints2 constraints2[]
Definition: encode.c:2143
static const BYTE encodedDomainName[]
Definition: encode.c:2157
BYTE * PBYTE
Definition: pedump.c:66
CERT_BASIC_CONSTRAINTS2_INFO info
Definition: encode.c:2135
const BYTE * encoded
Definition: encode.c:2136
#define X509_BASIC_CONSTRAINTS2
Definition: wincrypt.h:3532
#define X509_BASIC_CONSTRAINTS
Definition: wincrypt.h:3530

Referenced by START_TEST().

◆ test_decodeBits()

static void test_decodeBits ( DWORD  dwEncoding)
static

Definition at line 2080 of file encode.c.

2081{
2082 static const BYTE ber[] = "\x03\x02\x01\xff";
2083 static const BYTE berDecoded = 0xfe;
2084 DWORD i;
2085 BOOL ret;
2086 BYTE *buf = NULL;
2087 DWORD bufSize = 0;
2088
2089 /* normal cases */
2090 for (i = 0; i < ARRAY_SIZE(bits); i++)
2091 {
2092 ret = CryptDecodeObjectEx(dwEncoding, X509_BITS, bits[i].encoded,
2093 bits[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
2094 &bufSize);
2095 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2096 if (ret)
2097 {
2099
2100 ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + bits[i].cbDecoded,
2101 "Got unexpected size %ld\n", bufSize);
2102 blob = (CRYPT_BIT_BLOB *)buf;
2103 ok(blob->cbData == bits[i].cbDecoded,
2104 "Got unexpected length %ld, expected %ld\n", blob->cbData,
2105 bits[i].cbDecoded);
2106 if (blob->cbData && bits[i].cbDecoded)
2107 ok(!memcmp(blob->pbData, bits[i].decoded, bits[i].cbDecoded),
2108 "Unexpected value\n");
2109 LocalFree(buf);
2110 }
2111 }
2112 /* special case: check that something that's valid in BER but not in DER
2113 * decodes successfully
2114 */
2115 ret = CryptDecodeObjectEx(dwEncoding, X509_BITS, ber, ber[1] + 2,
2117 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2118 if (ret)
2119 {
2121
2122 ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + sizeof(berDecoded),
2123 "Got unexpected size %ld\n", bufSize);
2124 blob = (CRYPT_BIT_BLOB *)buf;
2125 ok(blob->cbData == sizeof(berDecoded),
2126 "Got unexpected length %ld\n", blob->cbData);
2127 if (blob->cbData)
2128 ok(*blob->pbData == berDecoded, "Unexpected value\n");
2129 LocalFree(buf);
2130 }
2131}
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
Definition: image.c:134
#define X509_BITS
Definition: wincrypt.h:3544

Referenced by START_TEST().

◆ test_decodeCert()

static void test_decodeCert ( DWORD  dwEncoding)
static

Definition at line 3485 of file encode.c.

3486{
3487 BOOL ret;
3488 BYTE *buf = NULL;
3489 DWORD size = 0;
3490
3493 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3494 if (ret)
3495 {
3497
3498 ok(info->ToBeSigned.cbData == sizeof(bigCert),
3499 "Wrong cert size %ld\n", info->ToBeSigned.cbData);
3500 ok(!memcmp(info->ToBeSigned.pbData, bigCert, info->ToBeSigned.cbData),
3501 "Unexpected cert\n");
3502 ok(info->Signature.cbData == sizeof(hash),
3503 "Wrong signature size %ld\n", info->Signature.cbData);
3504 ok(!memcmp(info->Signature.pbData, hash, info->Signature.cbData),
3505 "Unexpected signature\n");
3506 LocalFree(buf);
3507 }
3508 /* A signed cert decodes as a CERT_INFO too */
3511 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3512 if (ret)
3513 {
3515
3516 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3517 ok(info->SerialNumber.cbData == 1,
3518 "Expected serial number size 1, got %ld\n", info->SerialNumber.cbData);
3519 ok(*info->SerialNumber.pbData == *serialNum,
3520 "Expected serial number %d, got %d\n", *serialNum,
3521 *info->SerialNumber.pbData);
3522 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3523 "Wrong size %ld\n", info->Issuer.cbData);
3524 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3525 "Unexpected issuer\n");
3526 ok(info->Subject.cbData == sizeof(encodedCommonName),
3527 "Wrong size %ld\n", info->Subject.cbData);
3528 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3529 info->Subject.cbData), "Unexpected subject\n");
3530 LocalFree(buf);
3531 }
3534 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3535 if (ret)
3536 {
3538
3539 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3540 ok(info->SerialNumber.cbData == 1,
3541 "Expected serial number size 1, got %ld\n", info->SerialNumber.cbData);
3542 ok(*info->SerialNumber.pbData == *serialNum,
3543 "Expected serial number %d, got %d\n", *serialNum,
3544 *info->SerialNumber.pbData);
3545 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3546 "Wrong size %ld\n", info->Issuer.cbData);
3547 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3548 "Unexpected issuer\n");
3549 ok(info->Subject.cbData == sizeof(encodedCommonName),
3550 "Wrong size %ld\n", info->Subject.cbData);
3551 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3552 info->Subject.cbData), "Unexpected subject\n");
3553 LocalFree(buf);
3554 }
3555}
static const BYTE bigCert[]
Definition: encode.c:3008
static const BYTE signedBigCert[]
Definition: encode.c:3390
static const BYTE signedBigCertWithIndefiniteSeq[]
Definition: encode.c:3425
Definition: _hash_fun.h:40
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3518
#define X509_CERT
Definition: wincrypt.h:3517

Referenced by START_TEST().

◆ test_decodeCertPolicies()

static void test_decodeCertPolicies ( DWORD  dwEncoding)
static

Definition at line 7578 of file encode.c.

7579{
7580 BOOL ret;
7582 DWORD size;
7583
7586 &info, &size);
7587 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7588 if (ret)
7589 {
7590 ok(info->cPolicyInfo == 0, "unexpected policy info %ld\n",
7591 info->cPolicyInfo);
7592 LocalFree(info);
7593 }
7597 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7598 if (ret)
7599 {
7600 ok(info->cPolicyInfo == 1, "unexpected policy info %ld\n",
7601 info->cPolicyInfo);
7602 ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7603 "unexpected policy id %s\n",
7604 info->rgPolicyInfo[0].pszPolicyIdentifier);
7605 ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7606 "unexpected policy qualifier count %ld\n",
7607 info->rgPolicyInfo[0].cPolicyQualifier);
7608 LocalFree(info);
7609 }
7611 twoPolicies, sizeof(twoPolicies),
7613 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7614 if (ret)
7615 {
7616 ok(info->cPolicyInfo == 2, "unexpected policy info %ld\n",
7617 info->cPolicyInfo);
7618 ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7619 "unexpected policy id %s\n",
7620 info->rgPolicyInfo[0].pszPolicyIdentifier);
7621 ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7622 "unexpected policy qualifier count %ld\n",
7623 info->rgPolicyInfo[0].cPolicyQualifier);
7624 ok(!strcmp(info->rgPolicyInfo[1].pszPolicyIdentifier, oid1),
7625 "unexpected policy id %s\n",
7626 info->rgPolicyInfo[1].pszPolicyIdentifier);
7627 ok(info->rgPolicyInfo[1].cPolicyQualifier == 1,
7628 "unexpected policy qualifier count %ld\n",
7629 info->rgPolicyInfo[1].cPolicyQualifier);
7630 ok(!strcmp(
7631 info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId,
7632 oid_user_notice), "unexpected policy qualifier id %s\n",
7633 info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId);
7634 ok(info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData ==
7635 sizeof(noticeWithReference), "unexpected qualifier size %ld\n",
7636 info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData);
7637 ok(!memcmp(
7638 info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.pbData,
7640 "unexpected qualifier value\n");
7641 LocalFree(info);
7642 }
7644 twoPolicies, sizeof(twoPolicies), 0, NULL, NULL, &size);
7645 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7646 info = calloc(1, size);
7647 if (info)
7648 {
7650 twoPolicies, sizeof(twoPolicies), 0, NULL, info, &size);
7651 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7652 free(info);
7653 }
7654}
static char oid_any_policy[]
Definition: encode.c:7508
static const BYTE twoPolicies[]
Definition: encode.c:7514
static char oid_user_notice[]
Definition: encode.c:7513
static const BYTE policiesWithAnyPolicy[]
Definition: encode.c:7509
static BYTE noticeWithReference[]
Definition: encode.c:7397
#define X509_CERT_POLICIES
Definition: wincrypt.h:3533

Referenced by START_TEST().

◆ test_decodeCertPolicyConstraints()

static void test_decodeCertPolicyConstraints ( DWORD  dwEncoding)
static

Definition at line 7875 of file encode.c.

7876{
7878 DWORD size;
7879 BOOL ret;
7880
7881 /* Again, even though CAs must not issue such constraints, they can be
7882 * decoded.
7883 */
7886 &info, &size);
7887 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7888 if (ret)
7889 {
7890 ok(!info->fRequireExplicitPolicy,
7891 "expected require explicit = FALSE\n");
7892 ok(!info->fInhibitPolicyMapping,
7893 "expected implicit mapping = FALSE\n");
7894 LocalFree(info);
7895 }
7899 NULL, &info, &size);
7900 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7901 if (ret)
7902 {
7903 ok(info->fRequireExplicitPolicy,
7904 "expected require explicit = TRUE\n");
7905 ok(info->dwRequireExplicitPolicySkipCerts == 0, "expected 0, got %ld\n",
7906 info->dwRequireExplicitPolicySkipCerts);
7907 ok(!info->fInhibitPolicyMapping,
7908 "expected implicit mapping = FALSE\n");
7909 LocalFree(info);
7910 }
7914 NULL, &info, &size);
7915 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7916 if (ret)
7917 {
7918 ok(!info->fRequireExplicitPolicy,
7919 "expected require explicit = FALSE\n");
7920 ok(info->fInhibitPolicyMapping,
7921 "expected implicit mapping = TRUE\n");
7922 ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %ld\n",
7923 info->dwInhibitPolicyMappingSkipCerts);
7924 LocalFree(info);
7925 }
7929 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7930 if (ret)
7931 {
7932 ok(info->fRequireExplicitPolicy,
7933 "expected require explicit = TRUE\n");
7934 ok(info->dwRequireExplicitPolicySkipCerts == 1, "expected 1, got %ld\n",
7935 info->dwRequireExplicitPolicySkipCerts);
7936 ok(info->fInhibitPolicyMapping,
7937 "expected implicit mapping = TRUE\n");
7938 ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %ld\n",
7939 info->dwInhibitPolicyMappingSkipCerts);
7940 LocalFree(info);
7941 }
7942}
static const BYTE policyConstraintsWithRequireExplicit[]
Definition: encode.c:7801
static const BYTE policyConstraintsWithInhibitMapping[]
Definition: encode.c:7803
static const BYTE policyConstraintsWithBoth[]
Definition: encode.c:7805
#define X509_POLICY_CONSTRAINTS
Definition: wincrypt.h:3579

Referenced by START_TEST().

◆ test_decodeCertPolicyMappings()

static void test_decodeCertPolicyMappings ( DWORD  dwEncoding)
static

Definition at line 7728 of file encode.c.

7729{
7730 DWORD size, i;
7732 BOOL ret;
7733
7734 /* Each of the mapping OIDs is equivalent, so check with all of them */
7735 for (i = 0; i < ARRAY_SIZE(mappingOids); i++)
7736 {
7737 ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i],
7739 &info, &size);
7740 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7741 if (ret)
7742 {
7743 ok(info->cPolicyMapping == 0,
7744 "expected 0 policy mappings, got %ld\n", info->cPolicyMapping);
7745 LocalFree(info);
7746 }
7747 ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i],
7750 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7751 if (ret)
7752 {
7753 ok(info->cPolicyMapping == 1,
7754 "expected 1 policy mappings, got %ld\n", info->cPolicyMapping);
7755 ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7756 "unexpected issuer policy %s\n",
7757 info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7758 ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7759 "2.3.4"), "unexpected subject policy %s\n",
7760 info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7761 LocalFree(info);
7762 }
7763 ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i],
7766 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7767 if (ret)
7768 {
7769 ok(info->cPolicyMapping == 2,
7770 "expected 2 policy mappings, got %ld\n", info->cPolicyMapping);
7771 ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7772 "unexpected issuer policy %s\n",
7773 info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7774 ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7775 "2.3.4"), "unexpected subject policy %s\n",
7776 info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7777 ok(!strcmp(info->rgPolicyMapping[1].pszIssuerDomainPolicy, "1.3.4"),
7778 "unexpected issuer policy %s\n",
7779 info->rgPolicyMapping[1].pszIssuerDomainPolicy);
7780 ok(!strcmp(info->rgPolicyMapping[1].pszSubjectDomainPolicy,
7781 "2.5.6"), "unexpected subject policy %s\n",
7782 info->rgPolicyMapping[1].pszSubjectDomainPolicy);
7783 LocalFree(info);
7784 }
7785 ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i],
7787 NULL, NULL, &size);
7788 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7789 info = calloc(1, size);
7790 if (info)
7791 {
7792 ret = CryptDecodeObjectEx(dwEncoding, mappingOids[i],
7794 NULL, info, &size);
7795 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7796 free(info);
7797 }
7798 }
7799}
static const BYTE policyMappingWithTwoMappings[]
Definition: encode.c:7658
static const BYTE policyMappingWithOneMapping[]
Definition: encode.c:7656
static const LPCSTR mappingOids[]
Definition: encode.c:7661

Referenced by START_TEST().

◆ test_decodeCertToBeSigned()

static void test_decodeCertToBeSigned ( DWORD  dwEncoding)
static

Definition at line 3260 of file encode.c.

3261{
3262 static const BYTE *corruptCerts[] = { v1Cert, v2Cert, v3Cert, v4Cert,
3264 BOOL ret;
3265 BYTE *buf = NULL;
3266 DWORD size = 0, i;
3267
3268 /* Test with NULL pbEncoded */
3272 "Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
3273
3277 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
3278
3279 /* The following certs all fail with CRYPT_E_ASN1_CORRUPT or
3280 * CRYPT_E_ASN1_BADTAG, because at a minimum a cert must have a non-zero
3281 * serial number, an issuer, a subject, and a public key.
3282 */
3283 for (i = 0; i < ARRAY_SIZE(corruptCerts); i++)
3284 {
3286 corruptCerts[i], corruptCerts[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
3287 &buf, &size);
3288 ok(!ret, "Expected failure\n");
3289 }
3290 /* The following succeeds, even though v1 certs are not allowed to have
3291 * extensions.
3292 */
3296 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3297 if (ret)
3298 {
3300
3301 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3302 ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %ld\n",
3303 info->dwVersion);
3304 ok(info->cExtension == 1, "expected 1 extension, got %ld\n",
3305 info->cExtension);
3306 LocalFree(buf);
3307 }
3308 /* The following also succeeds, even though V1 certs are not allowed to
3309 * have issuer unique ids.
3310 */
3315 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3316 if (ret)
3317 {
3319
3320 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3321 ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %ld\n",
3322 info->dwVersion);
3323 ok(info->IssuerUniqueId.cbData == sizeof(serialNum),
3324 "unexpected issuer unique id size %ld\n", info->IssuerUniqueId.cbData);
3325 ok(!memcmp(info->IssuerUniqueId.pbData, serialNum, sizeof(serialNum)),
3326 "unexpected issuer unique id value\n");
3327 LocalFree(buf);
3328 }
3329 /* Now check with serial number, subject and issuer specified */
3332 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3333 if (ret)
3334 {
3336
3337 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3338 ok(info->SerialNumber.cbData == 1,
3339 "Expected serial number size 1, got %ld\n", info->SerialNumber.cbData);
3340 ok(*info->SerialNumber.pbData == *serialNum,
3341 "Expected serial number %d, got %d\n", *serialNum,
3342 *info->SerialNumber.pbData);
3343 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3344 "Wrong size %ld\n", info->Issuer.cbData);
3345 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3346 "Unexpected issuer\n");
3347 ok(info->Subject.cbData == sizeof(encodedCommonName),
3348 "Wrong size %ld\n", info->Subject.cbData);
3349 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3350 info->Subject.cbData), "Unexpected subject\n");
3351 LocalFree(buf);
3352 }
3353 /* Check again with pub key specified */
3356 &buf, &size);
3357 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3358 if (ret)
3359 {
3361
3362 ok(size >= sizeof(CERT_INFO), "Wrong size %ld\n", size);
3363 ok(info->SerialNumber.cbData == 1,
3364 "Expected serial number size 1, got %ld\n", info->SerialNumber.cbData);
3365 ok(*info->SerialNumber.pbData == *serialNum,
3366 "Expected serial number %d, got %d\n", *serialNum,
3367 *info->SerialNumber.pbData);
3368 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3369 "Wrong size %ld\n", info->Issuer.cbData);
3370 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3371 "Unexpected issuer\n");
3372 ok(info->Subject.cbData == sizeof(encodedCommonName),
3373 "Wrong size %ld\n", info->Subject.cbData);
3374 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3375 info->Subject.cbData), "Unexpected subject\n");
3376 ok(!strcmp(info->SubjectPublicKeyInfo.Algorithm.pszObjId,
3377 szOID_RSA_RSA), "Expected szOID_RSA_RSA, got %s\n",
3378 info->SubjectPublicKeyInfo.Algorithm.pszObjId);
3379 ok(info->SubjectPublicKeyInfo.PublicKey.cbData == sizeof(aKey),
3380 "Wrong size %ld\n", info->SubjectPublicKeyInfo.PublicKey.cbData);
3381 ok(!memcmp(info->SubjectPublicKeyInfo.PublicKey.pbData, aKey,
3382 sizeof(aKey)), "Unexpected public key\n");
3383 LocalFree(buf);
3384 }
3385}
#define STATUS_ACCESS_VIOLATION
static const BYTE v3Cert[]
Definition: encode.c:2984
static const BYTE v1Cert[]
Definition: encode.c:2974
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId[]
Definition: encode.c:3056
static const BYTE v1CertWithPubKey[]
Definition: encode.c:3018
static const BYTE v2Cert[]
Definition: encode.c:2979
static const BYTE v1CertWithConstraints[]
Definition: encode.c:2994
static const BYTE v1CertWithSerial[]
Definition: encode.c:3001
static const BYTE aKey[]
Definition: encode.c:2832
static const BYTE v1CertWithSubjectKeyId[]
Definition: encode.c:3041
static const BYTE v1CertWithIssuerUniqueId[]
Definition: encode.c:3051
static const BYTE v4Cert[]
Definition: encode.c:2989
#define CERT_V1
Definition: wincrypt.h:2803
#define szOID_RSA_RSA
Definition: wincrypt.h:3168
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:4501

Referenced by START_TEST().

◆ test_decodeCMSSignerInfo()

static void test_decodeCMSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 7017 of file encode.c.

7018{
7019 BOOL ret;
7020 LPBYTE buf = NULL;
7021 DWORD size = 0;
7023 static const char oid1[] = "1.2.3", oid2[] = "1.5.6";
7024
7025 /* A CMS signer can't be decoded without a serial number. */
7026 SetLastError(0xdeadbeef);
7030 ok(!ret, "expected failure\n");
7032 "Expected CRYPT_E_ASN1_CORRUPT, got %lx\n", GetLastError());
7036 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
7037 if (ret)
7038 {
7040 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
7041 info->dwVersion);
7042 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7043 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %ld\n",
7044 info->SignerId.dwIdChoice);
7045 ok(info->SignerId.IssuerSerialNumber.Issuer.cbData ==
7046 sizeof(encodedCommonNameNoNull), "Unexpected size %ld\n",
7047 info->SignerId.IssuerSerialNumber.Issuer.cbData);
7048 ok(!memcmp(info->SignerId.IssuerSerialNumber.Issuer.pbData,
7050 info->SignerId.IssuerSerialNumber.Issuer.cbData),
7051 "Unexpected value\n");
7052 ok(info->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
7053 sizeof(serialNum), "Unexpected size %ld\n",
7054 info->SignerId.IssuerSerialNumber.SerialNumber.cbData);
7055 ok(!memcmp(info->SignerId.IssuerSerialNumber.SerialNumber.pbData,
7056 serialNum, sizeof(serialNum)), "Unexpected value\n");
7057 LocalFree(buf);
7058 }
7062 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
7063 if (ret)
7064 {
7066 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
7067 info->dwVersion);
7068 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7069 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %ld\n",
7070 info->SignerId.dwIdChoice);
7071 ok(info->SignerId.IssuerSerialNumber.Issuer.cbData ==
7072 sizeof(encodedCommonNameNoNull), "Unexpected size %ld\n",
7073 info->SignerId.IssuerSerialNumber.Issuer.cbData);
7074 ok(!memcmp(info->SignerId.IssuerSerialNumber.Issuer.pbData,
7076 info->SignerId.IssuerSerialNumber.Issuer.cbData),
7077 "Unexpected value\n");
7078 ok(info->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
7079 sizeof(serialNum), "Unexpected size %ld\n",
7080 info->SignerId.IssuerSerialNumber.SerialNumber.cbData);
7081 ok(!memcmp(info->SignerId.IssuerSerialNumber.SerialNumber.pbData,
7082 serialNum, sizeof(serialNum)), "Unexpected value\n");
7083 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7084 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7085 LocalFree(buf);
7086 }
7090 NULL, &buf, &size);
7091 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
7092 if (ret)
7093 {
7095 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
7096 info->dwVersion);
7097 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7098 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %ld\n",
7099 info->SignerId.dwIdChoice);
7100 ok(info->SignerId.IssuerSerialNumber.Issuer.cbData ==
7101 sizeof(encodedCommonNameNoNull), "Unexpected size %ld\n",
7102 info->SignerId.IssuerSerialNumber.Issuer.cbData);
7103 ok(!memcmp(info->SignerId.IssuerSerialNumber.Issuer.pbData,
7105 info->SignerId.IssuerSerialNumber.Issuer.cbData),
7106 "Unexpected value\n");
7107 ok(info->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
7108 sizeof(serialNum), "Unexpected size %ld\n",
7109 info->SignerId.IssuerSerialNumber.SerialNumber.cbData);
7110 ok(!memcmp(info->SignerId.IssuerSerialNumber.SerialNumber.pbData,
7111 serialNum, sizeof(serialNum)), "Unexpected value\n");
7112 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7113 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7114 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, oid2),
7115 "Expected %s, got %s\n", oid2, info->HashEncryptionAlgorithm.pszObjId);
7116 LocalFree(buf);
7117 }
7121 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
7122 if (ret)
7123 {
7125 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
7126 info->dwVersion);
7127 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7128 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %ld\n",
7129 info->SignerId.dwIdChoice);
7130 ok(info->SignerId.IssuerSerialNumber.Issuer.cbData ==
7131 sizeof(encodedCommonNameNoNull), "Unexpected size %ld\n",
7132 info->SignerId.IssuerSerialNumber.Issuer.cbData);
7133 ok(!memcmp(info->SignerId.IssuerSerialNumber.Issuer.pbData,
7135 info->SignerId.IssuerSerialNumber.Issuer.cbData),
7136 "Unexpected value\n");
7137 ok(info->SignerId.IssuerSerialNumber.SerialNumber.cbData ==
7138 sizeof(serialNum), "Unexpected size %ld\n",
7139 info->SignerId.IssuerSerialNumber.SerialNumber.cbData);
7140 ok(!memcmp(info->SignerId.IssuerSerialNumber.SerialNumber.pbData,
7141 serialNum, sizeof(serialNum)), "Unexpected value\n");
7142 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7143 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7144 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, oid2),
7145 "Expected %s, got %s\n", oid2, info->HashEncryptionAlgorithm.pszObjId);
7146 ok(info->EncryptedHash.cbData == sizeof(hash), "Unexpected size %ld\n",
7147 info->EncryptedHash.cbData);
7148 ok(!memcmp(info->EncryptedHash.pbData, hash, sizeof(hash)),
7149 "Unexpected value\n");
7150 LocalFree(buf);
7151 }
7155 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
7156 if (ret)
7157 {
7159 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
7160 info->dwVersion);
7161 ok(info->SignerId.dwIdChoice == CERT_ID_KEY_IDENTIFIER,
7162 "Expected CERT_ID_KEY_IDENTIFIER, got %ld\n",
7163 info->SignerId.dwIdChoice);
7164 ok(info->SignerId.KeyId.cbData == sizeof(serialNum),
7165 "Unexpected size %ld\n", info->SignerId.KeyId.cbData);
7166 ok(!memcmp(info->SignerId.KeyId.pbData, serialNum, sizeof(serialNum)),
7167 "Unexpected value\n");
7168 LocalFree(buf);
7169 }
7170}
#define SetLastError(x)
Definition: compat.h:752
static const BYTE CMSSignerWithKeyId[]
Definition: encode.c:6855
static const BYTE minimalPKCSSigner[]
Definition: encode.c:6539
static const BYTE PKCSSignerWithHashAndEncryptionAlgo[]
Definition: encode.c:6553
static const BYTE PKCSSignerWithHash[]
Definition: encode.c:6558
static BYTE encodedCommonNameNoNull[]
Definition: encode.c:6536
static const BYTE PKCSSignerWithHashAlgo[]
Definition: encode.c:6548
static const BYTE PKCSSignerWithSerial[]
Definition: encode.c:6543
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3838
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3839
#define CMS_SIGNER_INFO
Definition: wincrypt.h:3595

Referenced by START_TEST().

◆ test_decodeCRLDistPoints()

static void test_decodeCRLDistPoints ( DWORD  dwEncoding)
static

Definition at line 3665 of file encode.c.

3666{
3667 BOOL ret;
3668 BYTE *buf = NULL;
3669 DWORD size = 0;
3673
3676 &buf, &size);
3677 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3678 if (ret)
3679 {
3681 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3682 "Wrong size %ld\n", size);
3683 ok(info->cDistPoint == 1, "Expected 1 dist points, got %ld\n",
3684 info->cDistPoint);
3685 point = info->rgDistPoint;
3686 ok(point->DistPointName.dwDistPointNameChoice == CRL_DIST_POINT_NO_NAME,
3687 "Expected CRL_DIST_POINT_NO_NAME, got %ld\n",
3688 point->DistPointName.dwDistPointNameChoice);
3689 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3690 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3691 LocalFree(buf);
3692 }
3695 &buf, &size);
3696 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3697 if (ret)
3698 {
3700 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3701 "Wrong size %ld\n", size);
3702 ok(info->cDistPoint == 1, "Expected 1 dist points, got %ld\n",
3703 info->cDistPoint);
3704 point = info->rgDistPoint;
3705 ok(point->DistPointName.dwDistPointNameChoice ==
3707 "Expected CRL_DIST_POINT_FULL_NAME, got %ld\n",
3708 point->DistPointName.dwDistPointNameChoice);
3709 ok(point->DistPointName.FullName.cAltEntry == 1,
3710 "Expected 1 name entry, got %ld\n",
3711 point->DistPointName.FullName.cAltEntry);
3712 entry = point->DistPointName.FullName.rgAltEntry;
3713 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3714 "Expected CERT_ALT_NAME_URL, got %ld\n", entry->dwAltNameChoice);
3715 ok(!lstrcmpW(entry->pwszURL, url), "Unexpected name\n");
3716 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3717 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3718 LocalFree(buf);
3719 }
3722 NULL, &buf, &size);
3723 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3724 if (ret)
3725 {
3727 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3728 "Wrong size %ld\n", size);
3729 ok(info->cDistPoint == 1, "Expected 1 dist points, got %ld\n",
3730 info->cDistPoint);
3731 point = info->rgDistPoint;
3732 ok(point->DistPointName.dwDistPointNameChoice ==
3734 "Expected CRL_DIST_POINT_NO_NAME, got %ld\n",
3735 point->DistPointName.dwDistPointNameChoice);
3736 ok(point->ReasonFlags.cbData == sizeof(crlReason),
3737 "Expected reason length\n");
3738 ok(!memcmp(point->ReasonFlags.pbData, &crlReason, sizeof(crlReason)),
3739 "Unexpected reason\n");
3740 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3741 LocalFree(buf);
3742 }
3746 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3747 if (ret)
3748 {
3750 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3751 "Wrong size %ld\n", size);
3752 ok(info->cDistPoint == 1, "Expected 1 dist points, got %ld\n",
3753 info->cDistPoint);
3754 point = info->rgDistPoint;
3755 ok(point->DistPointName.dwDistPointNameChoice ==
3757 "Expected CRL_DIST_POINT_FULL_NAME, got %ld\n",
3758 point->DistPointName.dwDistPointNameChoice);
3759 ok(point->DistPointName.FullName.cAltEntry == 1,
3760 "Expected 1 name entry, got %ld\n",
3761 point->DistPointName.FullName.cAltEntry);
3762 entry = point->DistPointName.FullName.rgAltEntry;
3763 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3764 "Expected CERT_ALT_NAME_URL, got %ld\n", entry->dwAltNameChoice);
3765 ok(!lstrcmpW(entry->pwszURL, url), "Unexpected name\n");
3766 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3767 ok(point->CRLIssuer.cAltEntry == 1,
3768 "Expected 1 issuer entry, got %ld\n", point->CRLIssuer.cAltEntry);
3769 entry = point->CRLIssuer.rgAltEntry;
3770 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3771 "Expected CERT_ALT_NAME_URL, got %ld\n", entry->dwAltNameChoice);
3772 ok(!lstrcmpW(entry->pwszURL, url), "Unexpected name\n");
3773 LocalFree(buf);
3774 }
3777 NULL, NULL, &size);
3778 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3779 buf = calloc(1, size);
3780 if (buf)
3781 {
3784 NULL, buf, &size);
3785 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3786 free(buf);
3787 }
3788}
POINTL point
Definition: edittest.c:50
uint32_t entry
Definition: isohybrid.c:63
static const BYTE emptyDistPoint[]
Definition: encode.c:3557
static const BYTE distPointWithUrl[]
Definition: encode.c:3558
static const BYTE crlReason
Definition: encode.c:3571
static const BYTE distPointWithReason[]
Definition: encode.c:3561
static const BYTE distPointWithUrlAndIssuer[]
Definition: encode.c:3566
Definition: wincrypt.h:341
#define CRL_DIST_POINT_NO_NAME
Definition: wincrypt.h:522
struct _CRL_DIST_POINTS_INFO * PCRL_DIST_POINTS_INFO
#define X509_CRL_DIST_POINTS
Definition: wincrypt.h:3554

Referenced by START_TEST().

◆ test_decodeCRLIssuingDistPoint()

static void test_decodeCRLIssuingDistPoint ( DWORD  dwEncoding)
static

Definition at line 3931 of file encode.c.

3932{
3933 BOOL ret;
3934 BYTE *buf = NULL;
3935 DWORD size = 0;
3936 CRL_ISSUING_DIST_POINT point = { { 0 } };
3937
3940 &buf, &size);
3941 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3942 if (ret)
3943 {
3945 LocalFree(buf);
3946 }
3949 &buf, &size);
3950 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3951 if (ret)
3952 {
3953 point.fOnlyContainsUserCerts = point.fOnlyContainsCACerts = TRUE;
3955 LocalFree(buf);
3956 }
3959 &buf, &size);
3960 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3961 if (ret)
3962 {
3963 point.fOnlyContainsCACerts = point.fOnlyContainsUserCerts = FALSE;
3964 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3965 point.DistPointName.FullName.cAltEntry = 0;
3967 LocalFree(buf);
3968 }
3971 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
3972 if (ret)
3973 {
3975
3976 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3977 entry.pwszURL = (LPWSTR)url;
3978 point.DistPointName.FullName.cAltEntry = 1;
3979 point.DistPointName.FullName.rgAltEntry = &entry;
3981 LocalFree(buf);
3982 }
3983}
#define FALSE
Definition: types.h:117
static const BYTE badFlagsIDP[]
Definition: encode.c:3790
static void compareCRLIssuingDistPoints(const CRL_ISSUING_DIST_POINT *expected, const CRL_ISSUING_DIST_POINT *got)
Definition: encode.c:3917
static const BYTE emptyNameIDP[]
Definition: encode.c:3791
static const BYTE urlIDP[]
Definition: encode.c:3792
#define X509_ISSUING_DIST_POINT
Definition: wincrypt.h:3576

Referenced by START_TEST().

◆ test_decodeCRLToBeSigned()

static void test_decodeCRLToBeSigned ( DWORD  dwEncoding)
static

Definition at line 4691 of file encode.c.

4692{
4693 static const BYTE *corruptCRLs[] = { v1CRL, v2CRL };
4694 BOOL ret;
4695 BYTE *buf = NULL;
4696 DWORD size = 0, i;
4697
4698 for (i = 0; i < ARRAY_SIZE(corruptCRLs); i++)
4699 {
4701 corruptCRLs[i], corruptCRLs[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
4702 &buf, &size);
4704 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
4705 }
4706 /* at a minimum, a CRL must contain an issuer: */
4709 &buf, &size);
4710 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4711 if (ret)
4712 {
4713 CRL_INFO *info = (CRL_INFO *)buf;
4714
4715 ok(size >= sizeof(CRL_INFO), "Wrong size %ld\n", size);
4716 ok(info->cCRLEntry == 0, "Expected 0 CRL entries, got %ld\n",
4717 info->cCRLEntry);
4718 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4719 "Wrong issuer size %ld\n", info->Issuer.cbData);
4720 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4721 "Unexpected issuer\n");
4722 LocalFree(buf);
4723 }
4724 /* check decoding with an empty CRL entry */
4729 "Expected CRYPT_E_ASN1_CORRUPT or CRYPT_E_BAD_ENCODE, got %08lx\n",
4730 GetLastError());
4731 /* with a real CRL entry */
4735 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4736 if (ret)
4737 {
4738 CRL_INFO *info = (CRL_INFO *)buf;
4740
4741 ok(size >= sizeof(CRL_INFO), "Wrong size %ld\n", size);
4742 ok(info->cCRLEntry == 1, "Expected 1 CRL entries, got %ld\n",
4743 info->cCRLEntry);
4744 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4745 entry = info->rgCRLEntry;
4746 ok(entry->SerialNumber.cbData == 1,
4747 "Expected serial number size 1, got %ld\n",
4748 entry->SerialNumber.cbData);
4749 ok(*entry->SerialNumber.pbData == *serialNum,
4750 "Expected serial number %d, got %d\n", *serialNum,
4751 *entry->SerialNumber.pbData);
4752 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4753 "Wrong issuer size %ld\n", info->Issuer.cbData);
4754 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4755 "Unexpected issuer\n");
4756 LocalFree(buf);
4757 }
4758 /* a real CRL from verisign that has extensions */
4761 NULL, &buf, &size);
4762 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4763 if (ret)
4764 {
4765 CRL_INFO *info = (CRL_INFO *)buf;
4766
4767 ok(size >= sizeof(CRL_INFO), "Wrong size %ld\n", size);
4768 ok(info->cCRLEntry == 3, "Expected 3 CRL entries, got %ld\n",
4769 info->cCRLEntry);
4770 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4771 ok(info->cExtension == 2, "Expected 2 extensions, got %ld\n",
4772 info->cExtension);
4773 LocalFree(buf);
4774 }
4775 /* another real CRL from verisign that has lots of entries */
4779 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4780 if (ret)
4781 {
4782 CRL_INFO *info = (CRL_INFO *)buf;
4783
4784 ok(size >= sizeof(CRL_INFO), "Got size %ld\n", size);
4785 ok(info->cCRLEntry == 209, "Expected 209 CRL entries, got %ld\n",
4786 info->cCRLEntry);
4787 ok(info->cExtension == 0, "Expected 0 extensions, got %ld\n",
4788 info->cExtension);
4789 LocalFree(buf);
4790 }
4791 /* and finally, with an extension */
4794 NULL, &buf, &size);
4795 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4796 if (ret)
4797 {
4798 CRL_INFO *info = (CRL_INFO *)buf;
4800
4801 ok(size >= sizeof(CRL_INFO), "Wrong size %ld\n", size);
4802 ok(info->cCRLEntry == 1, "Expected 1 CRL entries, got %ld\n",
4803 info->cCRLEntry);
4804 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4805 entry = info->rgCRLEntry;
4806 ok(entry->SerialNumber.cbData == 1,
4807 "Expected serial number size 1, got %ld\n",
4808 entry->SerialNumber.cbData);
4809 ok(*entry->SerialNumber.pbData == *serialNum,
4810 "Expected serial number %d, got %d\n", *serialNum,
4811 *entry->SerialNumber.pbData);
4812 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4813 "Wrong issuer size %ld\n", info->Issuer.cbData);
4814 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4815 "Unexpected issuer\n");
4816 ok(info->cExtension == 1, "Expected 1 extensions, got %ld\n",
4817 info->cExtension);
4818 LocalFree(buf);
4819 }
4822 NULL, &buf, &size);
4823 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4824 if (ret)
4825 {
4826 CRL_INFO *info = (CRL_INFO *)buf;
4827
4828 ok(info->cExtension == 1, "Expected 1 extensions, got %ld\n",
4829 info->cExtension);
4830 LocalFree(buf);
4831 }
4832}
static const BYTE v1CRL[]
Definition: encode.c:3985
static const BYTE v2CRLWithExt[]
Definition: encode.c:4022
static const BYTE v2CRL[]
Definition: encode.c:3988
static const BYTE verisignCRL[]
Definition: encode.c:4146
static const BYTE v1CRLWithExt[]
Definition: encode.c:4015
static const BYTE v1CRLWithIssuerAndEmptyEntry[]
Definition: encode.c:3996
static const BYTE verisignCRLWithLotsOfEntries[]
Definition: encode.c:4181
static const BYTE v1CRLWithIssuerAndEntry[]
Definition: encode.c:4002
static const BYTE v1CRLWithIssuer[]
Definition: encode.c:3991
Definition: wincrypt.h:496
#define X509_CERT_CRL_TO_BE_SIGNED
Definition: wincrypt.h:3519
#define CRYPT_E_BAD_ENCODE
Definition: winerror.h:4419

Referenced by START_TEST().

◆ test_decodeCTL()

static void test_decodeCTL ( DWORD  dwEncoding)
static

Definition at line 5780 of file encode.c.

5781{
5782 static char oid1[] = "1.2.3";
5783 static char oid2[] = "1.5.6";
5784 static BYTE nullData[] = { 5,0 };
5785 char *pOid1 = oid1;
5786 BOOL ret;
5787 BYTE *buf = NULL;
5788 DWORD size = 0;
5789 CTL_INFO info;
5790 SYSTEMTIME thisUpdate = { 2005, 6, 1, 6, 16, 10, 0, 0 };
5791 CTL_ENTRY ctlEntry[2];
5792 CRYPT_ATTRIBUTE attr1, attr2;
5793 CRYPT_ATTR_BLOB value1, value2;
5794
5795 memset(&info, 0, sizeof(info));
5796 ret = CryptDecodeObjectEx(dwEncoding, PKCS_CTL, emptyCTL, sizeof(emptyCTL),
5798 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5799 if (ret)
5800 {
5801 compareCTLInfo("empty CTL", &info, (CTL_INFO *)buf);
5802 LocalFree(buf);
5803 buf = NULL;
5804 }
5805 info.dwVersion = 1;
5808 &size);
5809 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5810 if (ret)
5811 {
5812 compareCTLInfo("v1 CTL", &info, (CTL_INFO *)buf);
5813 LocalFree(buf);
5814 buf = NULL;
5815 }
5816 info.dwVersion = 0;
5817 info.SubjectUsage.cUsageIdentifier = 1;
5818 info.SubjectUsage.rgpszUsageIdentifier = &pOid1;
5821 &buf, &size);
5822 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5823 if (ret)
5824 {
5825 compareCTLInfo("CTL with usage identifier", &info, (CTL_INFO *)buf);
5826 LocalFree(buf);
5827 buf = NULL;
5828 }
5829 info.SubjectUsage.cUsageIdentifier = 0;
5830 info.ListIdentifier.cbData = sizeof(serialNum);
5831 info.ListIdentifier.pbData = (LPBYTE)serialNum;
5834 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5835 if (ret)
5836 {
5837 compareCTLInfo("CTL with list identifier", &info, (CTL_INFO *)buf);
5838 LocalFree(buf);
5839 buf = NULL;
5840 }
5841 info.ListIdentifier.cbData = 0;
5842 info.SequenceNumber.cbData = sizeof(serialNum);
5843 info.SequenceNumber.pbData = (LPBYTE)serialNum;
5846 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5847 if (ret)
5848 {
5849 compareCTLInfo("CTL with sequence number", &info, (CTL_INFO *)buf);
5850 LocalFree(buf);
5851 buf = NULL;
5852 }
5853 info.SequenceNumber.cbData = 0;
5854 SystemTimeToFileTime(&thisUpdate, &info.ThisUpdate);
5857 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5858 if (ret)
5859 {
5860 compareCTLInfo("CTL with this update", &info, (CTL_INFO *)buf);
5861 LocalFree(buf);
5862 buf = NULL;
5863 }
5864 SystemTimeToFileTime(&thisUpdate, &info.NextUpdate);
5867 &buf, &size);
5868 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5869 if (ret)
5870 {
5871 compareCTLInfo("CTL with this and next update", &info, (CTL_INFO *)buf);
5872 LocalFree(buf);
5873 buf = NULL;
5874 }
5875 info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0;
5876 info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0;
5877 info.SubjectAlgorithm.pszObjId = oid2;
5878 info.SubjectAlgorithm.Parameters.cbData = sizeof(nullData);
5879 info.SubjectAlgorithm.Parameters.pbData = nullData;
5882 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5883 if (ret)
5884 {
5885 compareCTLInfo("CTL with algorithm identifier", &info, (CTL_INFO *)buf);
5886 LocalFree(buf);
5887 buf = NULL;
5888 }
5889 SetLastError(0xdeadbeef);
5893 "expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %08lx\n",
5894 GetLastError());
5895 info.SubjectAlgorithm.Parameters.cbData = 0;
5896 info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0;
5897 info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0;
5898 info.SubjectAlgorithm.pszObjId = NULL;
5899 value1.cbData = sizeof(emptySequence);
5900 value1.pbData = (LPBYTE)emptySequence;
5901 attr1.pszObjId = oid1;
5902 attr1.cValue = 1;
5903 attr1.rgValue = &value1;
5904 ctlEntry[0].SubjectIdentifier.cbData = sizeof(serialNum);
5906 ctlEntry[0].cAttribute = 1;
5907 ctlEntry[0].rgAttribute = &attr1;
5908 info.cCTLEntry = 1;
5909 info.rgCTLEntry = ctlEntry;
5910 SetLastError(0xdeadbeef);
5913 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5914 if (ret)
5915 {
5916 compareCTLInfo("CTL with one entry", &info, (CTL_INFO *)buf);
5917 LocalFree(buf);
5918 buf = NULL;
5919 }
5920 value2.cbData = sizeof(encodedIPAddr);
5921 value2.pbData = (LPBYTE)encodedIPAddr;
5922 attr2.pszObjId = oid2;
5923 attr2.cValue = 1;
5924 attr2.rgValue = &value2;
5925 ctlEntry[1].SubjectIdentifier.cbData = sizeof(serialNum);
5927 ctlEntry[1].cAttribute = 1;
5928 ctlEntry[1].rgAttribute = &attr2;
5929 info.cCTLEntry = 2;
5932 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
5933 if (ret)
5934 {
5935 compareCTLInfo("CTL with two entries", &info, (CTL_INFO *)buf);
5936 LocalFree(buf);
5937 buf = NULL;
5938 }
5939 /* A signed CTL isn't decodable, even if the inner content is a CTL */
5940 SetLastError(0xdeadbeef);
5944 "expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
5945 SetLastError(0xdeadbeef);
5946 ret = CryptDecodeObjectEx(dwEncoding, PKCS_CTL,
5950 "expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
5951}
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
static const BYTE emptyCTL[]
Definition: encode.c:5405
static const BYTE ctlWithOneEntry[]
Definition: encode.c:5434
static const BYTE ctlWithUsageIdentifier[]
Definition: encode.c:5411
static const BYTE emptyCTLWithVersion1[]
Definition: encode.c:5408
static const BYTE ctlWithThisAndNextUpdate[]
Definition: encode.c:5423
static const BYTE ctlWithTwoEntries[]
Definition: encode.c:5438
static const BYTE signedCTL[]
Definition: encode.c:5744
static const BYTE signedCTLWithCTLInnerContent[]
Definition: encode.c:5759
static void compareCTLInfo(LPCSTR header, const CTL_INFO *expected, const CTL_INFO *got)
Definition: encode.c:5618
static const BYTE ctlWithListIdentifier[]
Definition: encode.c:5414
static const BYTE ctlWithThisUpdate[]
Definition: encode.c:5420
static const BYTE ctlWithSequenceNumber[]
Definition: encode.c:5417
static const BYTE ctlWithBogusEntry[]
Definition: encode.c:5430
static const BYTE ctlWithAlgId[]
Definition: encode.c:5427
#define memset(x, y, z)
Definition: compat.h:39
Definition: wincrypt.h:835
DWORD cAttribute
Definition: wincrypt.h:837
#define PKCS_CTL
Definition: wincrypt.h:3556

Referenced by START_TEST().

◆ test_decodeEnhancedKeyUsage()

static void test_decodeEnhancedKeyUsage ( DWORD  dwEncoding)
static

Definition at line 4873 of file encode.c.

4874{
4875 BOOL ret;
4876 LPBYTE buf = NULL;
4877 DWORD size = 0;
4878
4881 &buf, &size);
4882 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4883 if (ret)
4884 {
4886
4887 ok(size >= sizeof(CERT_ENHKEY_USAGE),
4888 "Wrong size %ld\n", size);
4889 ok(usage->cUsageIdentifier == 0, "Expected 0 CRL entries, got %ld\n",
4890 usage->cUsageIdentifier);
4891 LocalFree(buf);
4892 }
4895 &buf, &size);
4896 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4897 if (ret)
4898 {
4900 DWORD i;
4901
4902 ok(size >= sizeof(CERT_ENHKEY_USAGE),
4903 "Wrong size %ld\n", size);
4904 ok(usage->cUsageIdentifier == ARRAY_SIZE(keyUsages),
4905 "Wrong CRL entries count %ld\n", usage->cUsageIdentifier);
4906 for (i = 0; i < usage->cUsageIdentifier; i++)
4907 ok(!strcmp(usage->rgpszUsageIdentifier[i], keyUsages[i]),
4908 "Expected OID %s, got %s\n", keyUsages[i],
4909 usage->rgpszUsageIdentifier[i]);
4910 LocalFree(buf);
4911 }
4913 encodedUsage, sizeof(encodedUsage), 0, NULL, NULL, &size);
4914 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4915 buf = calloc(1, size);
4916 if (buf)
4917 {
4919 encodedUsage, sizeof(encodedUsage), 0, NULL, buf, &size);
4920 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
4921 free(buf);
4922 }
4923}
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static const LPCSTR keyUsages[]
Definition: encode.c:4834
static const BYTE encodedUsage[]
Definition: encode.c:4836
#define X509_ENHANCED_KEY_USAGE
Definition: wincrypt.h:3555

Referenced by START_TEST().

◆ test_decodeEnumerated()

static void test_decodeEnumerated ( DWORD  dwEncoding)
static

Definition at line 405 of file encode.c.

406{
407 DWORD i, j;
408
409 for (i = 0; i < ARRAY_SIZE(enumeratedTypes); i++)
410 {
411 for (j = 0; j < ARRAY_SIZE(enums); j++)
412 {
413 BOOL ret;
414 DWORD bufSize = sizeof(int);
415 int val;
416
418 enums[j].encoded, enums[j].encoded[1] + 2, 0, NULL,
419 &val, &bufSize);
420 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
421 ok(bufSize == sizeof(int),
422 "Got unexpected size %ld for enumerated\n", bufSize);
423 ok(val == enums[j].val, "Unexpected value %d, expected %d\n",
424 val, enums[j].val);
425 }
426 }
427}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLuint GLfloat * val
Definition: glext.h:7180
static const struct encodedInt enums[]
Definition: encode.c:361
static const LPCSTR enumeratedTypes[]
Definition: encode.c:369

Referenced by START_TEST().

◆ test_decodeExtensions()

static void test_decodeExtensions ( DWORD  dwEncoding)
static

Definition at line 2769 of file encode.c.

2770{
2771 DWORD i;
2772
2773 for (i = 0; i < ARRAY_SIZE(exts); i++)
2774 {
2775 BOOL ret;
2776 BYTE *buf = NULL;
2777 DWORD bufSize = 0;
2778
2780 exts[i].encoded, exts[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2781 NULL, &buf, &bufSize);
2782 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2783 if (ret)
2784 {
2786 DWORD j;
2787
2788 ok(ext->cExtension == exts[i].exts.cExtension,
2789 "Expected %ld extensions, see %ld\n", exts[i].exts.cExtension,
2790 ext->cExtension);
2791 for (j = 0; j < min(ext->cExtension, exts[i].exts.cExtension); j++)
2792 {
2793 ok(!strcmp(ext->rgExtension[j].pszObjId,
2794 exts[i].exts.rgExtension[j].pszObjId),
2795 "Expected OID %s, got %s\n",
2796 exts[i].exts.rgExtension[j].pszObjId,
2797 ext->rgExtension[j].pszObjId);
2798 ok(!memcmp(ext->rgExtension[j].Value.pbData,
2799 exts[i].exts.rgExtension[j].Value.pbData,
2800 exts[i].exts.rgExtension[j].Value.cbData),
2801 "Unexpected value\n");
2802 }
2803 LocalFree(buf);
2804 }
2806 exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, NULL, &bufSize);
2807 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2808 buf = calloc(1, bufSize);
2809 if (buf)
2810 {
2812 exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, buf, &bufSize);
2813 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2814 free(buf);
2815 }
2816 }
2817}
static const WCHAR *const ext[]
Definition: module.c:53
static const struct encodedExtensions exts[]
Definition: encode.c:2738
#define X509_EXTENSIONS
Definition: wincrypt.h:3521

Referenced by START_TEST().

◆ test_decodeFiletime()

static void test_decodeFiletime ( DWORD  dwEncoding)
static

Definition at line 592 of file encode.c.

593{
594 static const struct encodedFiletime otherTimes[] = {
595 { { 1945, 6, 1, 6, 16, 10, 0, 0 }, bin23 },
596 { { 1945, 6, 1, 6, 16, 10, 0, 999 }, bin24 },
597 { { 1945, 6, 1, 6, 17, 10, 0, 0 }, bin25 },
598 { { 1945, 6, 1, 6, 15, 10, 0, 0 }, bin26 },
599 { { 1945, 6, 1, 6, 14, 55, 0, 0 }, bin27 },
600 { { 2145, 6, 1, 6, 16, 0, 0, 0 }, bin28 },
601 { { 2045, 6, 1, 6, 16, 10, 0, 0 }, bin29 },
602 { { 2045, 6, 1, 6, 16, 10, 0, 0 }, bin30 },
603 { { 2045, 6, 1, 6, 17, 10, 0, 0 }, bin31 },
604 { { 2045, 6, 1, 6, 15, 10, 0, 0 }, bin32 },
605 { { 2045, 6, 1, 6, 17, 10, 0, 0 }, bin33 },
606 { { 2045, 6, 1, 6, 15, 10, 0, 0 }, bin34 },
607 };
608 /* An oddball case that succeeds in Windows, but doesn't seem correct
609 { { 2145, 6, 1, 2, 11, 31, 0, 0 }, "\x18" "\x13" "21450606161000-9999" },
610 */
611 static const unsigned char *bogusTimes[] = {
612 /* oddly, this succeeds on Windows, with year 2765
613 "\x18" "\x0f" "21r50606161000Z",
614 */
615 bin35,
616 bin36,
617 bin37,
618 bin38,
619 };
620 DWORD i, size;
621 FILETIME ft1 = { 0 }, ft2 = { 0 };
622 BOOL ret;
623
624 /* Check bogus length with non-NULL buffer */
626 ok(ret, "SystemTimeToFileTime failed: %ld\n", GetLastError());
627 size = 1;
629 times[0].encodedTime, times[0].encodedTime[1] + 2, 0, NULL, &ft2, &size);
631 "Expected ERROR_MORE_DATA, got %ld\n", GetLastError());
632 /* Normal tests */
633 for (i = 0; i < ARRAY_SIZE(times); i++)
634 {
636 testTimeDecoding(dwEncoding, PKCS_UTC_TIME, &times[i]);
638 }
639 for (i = 0; i < ARRAY_SIZE(otherTimes); i++)
640 {
641 testTimeDecoding(dwEncoding, X509_CHOICE_OF_TIME, &otherTimes[i]);
642 testTimeDecoding(dwEncoding, PKCS_UTC_TIME, &otherTimes[i]);
643 testTimeDecoding(dwEncoding, szOID_RSA_signingTime, &otherTimes[i]);
644 }
645 for (i = 0; i < ARRAY_SIZE(bogusTimes); i++)
646 {
647 size = sizeof(ft1);
649 bogusTimes[i], bogusTimes[i][1] + 2, 0, NULL, &ft1, &size);
651 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
652 }
653}
#define ERROR_MORE_DATA
Definition: dderror.h:13
static const BYTE bin35[]
Definition: encode.c:583
static const BYTE bin33[]
Definition: encode.c:579
static const BYTE bin38[]
Definition: encode.c:589
static const BYTE bin27[]
Definition: encode.c:567
static const BYTE bin36[]
Definition: encode.c:585
static const BYTE bin32[]
Definition: encode.c:577
static const BYTE bin26[]
Definition: encode.c:565
static const BYTE bin30[]
Definition: encode.c:573
static const BYTE bin28[]
Definition: encode.c:569
static const BYTE bin31[]
Definition: encode.c:575
static const struct encodedFiletime times[]
Definition: encode.c:541
static void testTimeDecoding(DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
Definition: encode.c:509
static const BYTE bin23[]
Definition: encode.c:559
static const BYTE bin37[]
Definition: encode.c:587
static const BYTE bin24[]
Definition: encode.c:561
static const BYTE bin34[]
Definition: encode.c:581
static const BYTE bin25[]
Definition: encode.c:563
static const BYTE bin29[]
Definition: encode.c:571
SYSTEMTIME sysTime
Definition: encode.c:431
const BYTE * encodedTime
Definition: encode.c:432
#define PKCS_UTC_TIME
Definition: wincrypt.h:3534
#define X509_CHOICE_OF_TIME
Definition: wincrypt.h:3549
#define szOID_RSA_signingTime
Definition: wincrypt.h:3192

Referenced by START_TEST().

◆ test_decodeInt()

static void test_decodeInt ( DWORD  dwEncoding)
static

Definition at line 205 of file encode.c.

206{
207 static const BYTE bigInt[] = { 2, 5, 0xff, 0xfe, 0xff, 0xfe, 0xff };
208 static const BYTE testStr[] = { 0x16, 4, 't', 'e', 's', 't' };
209 static const BYTE longForm[] = { 2, 0x81, 0x01, 0x01 };
210 static const BYTE bigBogus[] = { 0x02, 0x84, 0x01, 0xff, 0xff, 0xf9 };
211 static const BYTE extraBytes[] = { 2, 1, 1, 0, 0, 0, 0 };
212 BYTE *buf = NULL;
213 DWORD bufSize = 0;
214 int i;
215 BOOL ret;
216
217 /* CryptDecodeObjectEx with NULL bufSize crashes..
218 ret = CryptDecodeObjectEx(3, X509_INTEGER, &ints[0].encoded,
219 ints[0].encoded[1] + 2, 0, NULL, NULL, NULL);
220 */
221 /* check bogus encoding */
222 ret = CryptDecodeObjectEx(3, X509_INTEGER, (BYTE *)&ints[0].encoded,
223 ints[0].encoded[1] + 2, 0, NULL, NULL, &bufSize);
225 "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
226 /* check with NULL integer buffer */
227 ret = CryptDecodeObjectEx(dwEncoding, X509_INTEGER, NULL, 0, 0, NULL, NULL,
228 &bufSize);
230 "Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
231 /* check with a valid, but too large, integer */
232 ret = CryptDecodeObjectEx(dwEncoding, X509_INTEGER, bigInt, bigInt[1] + 2,
235 "Expected CRYPT_E_ASN1_LARGE, got %ld\n", GetLastError());
236 /* check with a DER-encoded string */
237 ret = CryptDecodeObjectEx(dwEncoding, X509_INTEGER, testStr, testStr[1] + 2,
240 "Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
241 for (i = 0; i < ARRAY_SIZE(ints); i++)
242 {
243 /* When the output buffer is NULL, this always succeeds */
244 SetLastError(0xdeadbeef);
246 ints[i].encoded, ints[i].encoded[1] + 2, 0, NULL, NULL,
247 &bufSize);
248 ok(ret && GetLastError() == NOERROR,
249 "Expected success and NOERROR, got %ld\n", GetLastError());
251 ints[i].encoded, ints[i].encoded[1] + 2,
253 ok(ret, "CryptDecodeObjectEx failed: %ld\n", GetLastError());
254 ok(bufSize == sizeof(int), "Wrong size %ld\n", bufSize);
255 ok(buf != NULL, "Expected allocated buffer\n");
256 if (ret)
257 {
258 ok(!memcmp(buf, &ints[i].val, bufSize), "Expected %d, got %d\n",
259 ints[i].val, *(int *)buf);
260 LocalFree(buf);
261 }
262 }
263 for (i = 0; i < ARRAY_SIZE(bigInts); i++)
264 {
266 bigInts[i].encoded, bigInts[i].encoded[1] + 2, 0, NULL, NULL,
267 &bufSize);
268 ok(ret && GetLastError() == NOERROR,
269 "Expected success and NOERROR, got %ld\n", GetLastError());
271 bigInts[i].encoded, bigInts[i].encoded[1] + 2,
273 ok(ret, "CryptDecodeObjectEx failed: %ld\n", GetLastError());
274 ok(bufSize >= sizeof(CRYPT_INTEGER_BLOB), "Wrong size %ld\n", bufSize);
275 ok(buf != NULL, "Expected allocated buffer\n");
276 if (ret)
277 {
279
280 ok(blob->cbData == strlen((const char*)bigInts[i].decoded),
281 "Expected len %d, got %ld\n", lstrlenA((const char*)bigInts[i].decoded),
282 blob->cbData);
283 ok(!memcmp(blob->pbData, bigInts[i].decoded, blob->cbData),
284 "Unexpected value\n");
285 LocalFree(buf);
286 }
287 }
288 for (i = 0; i < ARRAY_SIZE(bigUInts); i++)
289 {
291 bigUInts[i].encoded, bigUInts[i].encoded[1] + 2, 0, NULL, NULL,
292 &bufSize);
293 ok(ret && GetLastError() == NOERROR,
294 "Expected success and NOERROR, got %ld\n", GetLastError());
296 bigUInts[i].encoded, bigUInts[i].encoded[1] + 2,
298 ok(ret, "CryptDecodeObjectEx failed: %ld\n", GetLastError());
299 ok(bufSize >= sizeof(CRYPT_INTEGER_BLOB), "Wrong size %ld\n", bufSize);
300 ok(buf != NULL, "Expected allocated buffer\n");
301 if (ret)
302 {
304
305 ok(blob->cbData == strlen((const char*)bigUInts[i].val),
306 "Expected len %d, got %ld\n", lstrlenA((const char*)bigUInts[i].val),
307 blob->cbData);
308 ok(!memcmp(blob->pbData, bigUInts[i].val, blob->cbData),
309 "Unexpected value\n");
310 LocalFree(buf);
311 }
312 }
313 /* Decode the value 1 with long-form length */
314 ret = CryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, longForm,
315 sizeof(longForm), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
316 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
317 if (ret)
318 {
319 ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf);
320 LocalFree(buf);
321 }
322 /* check with extra bytes at the end */
323 ret = CryptDecodeObjectEx(dwEncoding, X509_INTEGER, extraBytes,
324 sizeof(extraBytes), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
325 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
326 if (ret)
327 {
328 ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf);
329 LocalFree(buf);
330 }
331 /* Try to decode some bogus large items */
332 /* The buffer size is smaller than the encoded length, so this should fail
333 * with CRYPT_E_ASN1_EOD if it's being decoded.
334 * Under XP it fails with CRYPT_E_ASN1_LARGE, which means there's a limit
335 * on the size decoded, but in ME it fails with CRYPT_E_ASN1_EOD or crashes.
336 * So this test unfortunately isn't useful.
337 ret = CryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, tooBig,
338 0x7fffffff, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
339 ok(!ret && GetLastError() == CRYPT_E_ASN1_LARGE,
340 "Expected CRYPT_E_ASN1_LARGE, got %08x\n", GetLastError());
341 */
342 /* This will try to decode the buffer and overflow it, check that it's
343 * caught.
344 */
345 if (0)
346 {
347 /* a large buffer isn't guaranteed to crash, it depends on memory allocation order */
348 ret = CryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, bigBogus,
349 0x01ffffff, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
351 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
352 }
353}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const struct encodedInt ints[]
Definition: encode.c:52
static const struct encodedBigInt bigUInts[]
Definition: encode.c:88
static const struct encodedBigInt bigInts[]
Definition: encode.c:77
#define X509_MULTI_BYTE_UINT
Definition: wincrypt.h:3557
#define X509_MULTI_BYTE_INTEGER
Definition: wincrypt.h:3546
#define X509_INTEGER
Definition: wincrypt.h:3545
#define NOERROR
Definition: winerror.h:3448
#define CRYPT_E_ASN1_LARGE
Definition: winerror.h:4503

Referenced by START_TEST().

◆ test_decodeName()

static void test_decodeName ( DWORD  dwEncoding)
static

Definition at line 1022 of file encode.c.

1023{
1024 BYTE *buf = NULL;
1025 DWORD bufSize = 0;
1026 BOOL ret;
1027 CERT_RDN rdn;
1028 CERT_NAME_INFO info = { 1, &rdn };
1029
1030 /* test empty name */
1031 bufSize = 0;
1033 emptySequence[1] + 2,
1035 &buf, &bufSize);
1036 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1037 /* Interestingly, in Windows, if cRDN is 0, rgRGN may not be NULL. My
1038 * decoder works the same way, so only test the count.
1039 */
1040 if (ret)
1041 {
1042 ok(bufSize == sizeof(CERT_NAME_INFO), "Wrong bufSize %ld\n", bufSize);
1043 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1044 "Expected 0 RDNs in empty info, got %ld\n",
1045 ((CERT_NAME_INFO *)buf)->cRDN);
1046 LocalFree(buf);
1047 }
1048 /* test empty name with indefinite-length encoding */
1051 &buf, &bufSize);
1052 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1053 if (ret)
1054 {
1055 ok(bufSize == sizeof(CERT_NAME_INFO), "Wrong bufSize %ld\n", bufSize);
1056 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1057 "Expected 0 RDNs in empty info, got %ld\n",
1058 ((CERT_NAME_INFO *)buf)->cRDN);
1059 LocalFree(buf);
1060 }
1061 /* test empty RDN */
1062 bufSize = 0;
1064 emptyRDNs[1] + 2,
1066 &buf, &bufSize);
1067 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1068 if (ret)
1069 {
1071
1072 ok(bufSize == sizeof(CERT_NAME_INFO) + sizeof(CERT_RDN) &&
1073 info->cRDN == 1 && info->rgRDN && info->rgRDN[0].cRDNAttr == 0,
1074 "Got unexpected value for empty RDN\n");
1075 LocalFree(buf);
1076 }
1077 /* test two RDN attrs */
1078 bufSize = 0;
1080 twoRDNs[1] + 2,
1082 &buf, &bufSize);
1083 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1084 if (ret)
1085 {
1086 static CHAR oid_sur_name[] = szOID_SUR_NAME,
1087 oid_common_name[] = szOID_COMMON_NAME;
1088
1089 CERT_RDN_ATTR attrs[] = {
1090 { oid_sur_name, CERT_RDN_PRINTABLE_STRING, { sizeof(surName),
1091 (BYTE *)surName } },
1092 { oid_common_name, CERT_RDN_PRINTABLE_STRING, { sizeof(commonName),
1093 (BYTE *)commonName } },
1094 };
1095
1096 rdn.cRDNAttr = ARRAY_SIZE(attrs);
1097 rdn.rgRDNAttr = attrs;
1099 LocalFree(buf);
1100 }
1101 /* test that two RDN attrs with extra bytes succeeds */
1102 bufSize = 0;
1104 sizeof(twoRDNsExtraBytes), 0, NULL, NULL, &bufSize);
1105 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1106 /* And, a slightly more complicated name */
1107 buf = NULL;
1108 bufSize = 0;
1111 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1112 if (ret)
1113 {
1117 LocalFree(buf);
1118 }
1119}
static const char surName[]
Definition: encode.c:656
static const BYTE twoRDNsExtraBytes[]
Definition: encode.c:1017
static CERT_RDN_ATTR decodedRdnAttrs[]
Definition: encode.c:702
static const BYTE emptyIndefiniteSequence[]
Definition: encode.c:1016
static const char commonName[]
Definition: encode.c:655
static const BYTE encodedRDNAttrs[]
Definition: encode.c:713
static void compareNames(const CERT_NAME_INFO *expected, const CERT_NAME_INFO *got)
Definition: encode.c:1002
static const BYTE twoRDNs[]
Definition: encode.c:660
static const BYTE emptyRDNs[]
Definition: encode.c:659
#define X509_NAME
Definition: wincrypt.h:3524
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2927
#define CRYPT_DECODE_SHARE_OID_STRING_FLAG
Definition: wincrypt.h:3610
#define szOID_SUR_NAME
Definition: wincrypt.h:3291
#define szOID_COMMON_NAME
Definition: wincrypt.h:3290
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_decodeNameConstraints()

static void test_decodeNameConstraints ( DWORD  dwEncoding)
static

Definition at line 7331 of file encode.c.

7332{
7333 BOOL ret;
7334 DWORD i;
7335 CERT_NAME_CONSTRAINTS_INFO *constraints;
7336
7344 for (i = 0; i < ARRAY_SIZE(encodedNameConstraints); i++)
7345 {
7346 DWORD size;
7347
7349 encodedNameConstraints[i].encoded.pbData,
7350 encodedNameConstraints[i].encoded.cbData,
7351 CRYPT_DECODE_ALLOC_FLAG, NULL, &constraints, &size);
7352 ok(ret, "%ld: CryptDecodeObjectEx failed: %08lx\n", i, GetLastError());
7353 if (ret)
7354 {
7355 DWORD j;
7356
7357 if (constraints->cPermittedSubtree !=
7358 encodedNameConstraints[i].constraints.cPermittedSubtree)
7359 fprintf(stderr, "%ld: expected %lu permitted, got %lu\n", i,
7361 constraints->cPermittedSubtree);
7362 if (constraints->cPermittedSubtree ==
7363 encodedNameConstraints[i].constraints.cPermittedSubtree)
7364 {
7365 for (j = 0; j < constraints->cPermittedSubtree; j++)
7366 {
7368 &encodedNameConstraints[i].constraints.rgPermittedSubtree[j].Base);
7369 }
7370 }
7371 if (constraints->cExcludedSubtree !=
7372 encodedNameConstraints[i].constraints.cExcludedSubtree)
7373 fprintf(stderr, "%ld: expected %lu excluded, got %lu\n", i,
7375 constraints->cExcludedSubtree);
7376 if (constraints->cExcludedSubtree ==
7377 encodedNameConstraints[i].constraints.cExcludedSubtree)
7378 {
7379 for (j = 0; j < constraints->cExcludedSubtree; j++)
7380 {
7382 &encodedNameConstraints[i].constraints.rgExcludedSubtree[j].Base);
7383 }
7384 }
7385 LocalFree(constraints);
7386 }
7387 }
7388}
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static CERT_GENERAL_SUBTREE IPAddressWithMinSubtree
Definition: encode.c:7308
static CERT_GENERAL_SUBTREE DNSSubtree
Definition: encode.c:7304
static CERT_GENERAL_SUBTREE IPAddressSubtree
Definition: encode.c:7306
static CERT_GENERAL_SUBTREE IPAddressWithMinMaxSubtree
Definition: encode.c:7310
static const struct EncodedNameConstraints encodedNameConstraints[]
Definition: encode.c:7313
CERT_ALT_NAME_ENTRY Base
Definition: wincrypt.h:584
PCERT_GENERAL_SUBTREE rgPermittedSubtree
Definition: wincrypt.h:592
PCERT_GENERAL_SUBTREE rgExcludedSubtree
Definition: wincrypt.h:594
#define X509_NAME_CONSTRAINTS
Definition: wincrypt.h:3577

Referenced by START_TEST().

◆ test_decodeNameValue()

static void test_decodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1318 of file encode.c.

1319{
1320 int i;
1321 BYTE *buf = NULL;
1322 DWORD bufSize = 0;
1323 BOOL ret;
1324
1325 for (i = 0; i < ARRAY_SIZE(nameValues); i++)
1326 {
1328 nameValues[i].encoded, nameValues[i].encoded[1] + 2,
1330 &buf, &bufSize);
1331 ok(ret, "Value type %ld: CryptDecodeObjectEx failed: %08lx\n",
1332 nameValues[i].value.dwValueType, GetLastError());
1333 if (ret)
1334 {
1336 (const CERT_NAME_VALUE *)buf);
1337 LocalFree(buf);
1338 }
1339 }
1341 embeddedNullNameValue.encoded, embeddedNullNameValue.encodedSize,
1343 &buf, &bufSize);
1344 /* Some Windows versions disallow name values with embedded NULLs, so
1345 * either success or failure is acceptable.
1346 */
1347 if (ret)
1348 {
1349 CERT_NAME_VALUE rdnEncodedValue = { CERT_RDN_ENCODED_BLOB,
1350 { sizeof(ia5EmbeddedNull), ia5EmbeddedNull } };
1351 CERT_NAME_VALUE embeddedNullValue = { CERT_RDN_IA5_STRING,
1352 { sizeof(embedded_null) - 1, (BYTE *)embedded_null } };
1353 const CERT_NAME_VALUE *got = (const CERT_NAME_VALUE *)buf,
1354 *expected = NULL;
1355
1356 /* Some Windows versions decode name values with embedded NULLs,
1357 * others leave them encoded, even with the same version of crypt32.
1358 * Accept either.
1359 */
1362 "Expected CERT_RDN_ENCODED_BLOB or CERT_RDN_IA5_STRING, got %ld\n",
1363 got->dwValueType);
1365 expected = &rdnEncodedValue;
1366 else if (got->dwValueType == CERT_RDN_IA5_STRING)
1367 expected = &embeddedNullValue;
1368 if (expected)
1369 {
1370 ok(got->Value.cbData == expected->Value.cbData,
1371 "String type %ld: unexpected data size, got %ld, expected %ld\n",
1372 got->dwValueType, got->Value.cbData, expected->Value.cbData);
1373 if (got->Value.cbData && got->Value.pbData)
1374 ok(!memcmp(got->Value.pbData, expected->Value.pbData,
1375 min(got->Value.cbData, expected->Value.cbData)),
1376 "String type %ld: unexpected value\n", expected->dwValueType);
1377 }
1378 LocalFree(buf);
1379 }
1380}
static struct EncodedNameValue embeddedNullNameValue
Definition: encode.c:1264
static char embedded_null[]
Definition: encode.c:1223
static struct EncodedNameValue nameValues[]
Definition: encode.c:1227
static BYTE ia5EmbeddedNull[]
Definition: encode.c:1224
Definition: pdh_main.c:96
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2931
#define X509_NAME_VALUE
Definition: wincrypt.h:3522
#define CERT_RDN_ENCODED_BLOB
Definition: wincrypt.h:2924

Referenced by START_TEST().

◆ test_decodeOCSPBasicResponseInfo()

static void test_decodeOCSPBasicResponseInfo ( DWORD  dwEncoding)
static

Definition at line 8897 of file encode.c.

8898{
8899 static const BYTE resp_id[] = {
8900 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5,
8901 0x95, 0x76, 0xb9, 0xf4};
8902 static const BYTE resp_id2[] = {
8903 0xa4, 0x8d, 0xe5, 0xbe, 0x7c, 0x79, 0xe4, 0x70, 0x23, 0x6d, 0x2e, 0x29, 0x34, 0xad, 0x23, 0x58,
8904 0xdc, 0xf5, 0x31, 0x7f};
8905 static const BYTE resp_id3[] = {
8906 0x30, 0x32, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31,
8907 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0d, 0x4c, 0x65, 0x74, 0x27, 0x73, 0x20,
8908 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x03,
8909 0x13, 0x02, 0x52, 0x33};
8910 static const BYTE name_hash[] = {
8911 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0,
8912 0x09, 0x8a, 0xab, 0xd8};
8913 static const BYTE name_hash2[] = {
8914 0x74, 0xb4, 0xe7, 0x23, 0x19, 0xc7, 0x65, 0x92, 0x15, 0x40, 0x44, 0x7b, 0xc7, 0xce, 0x3e, 0x90,
8915 0xc2, 0x18, 0x76, 0xeb};
8916 static const BYTE name_hash3[] = {
8917 0x48, 0xda, 0xc9, 0xa0, 0xfb, 0x2b, 0xd3, 0x2d, 0x4f, 0xf0, 0xde, 0x68, 0xd2, 0xf5, 0x67, 0xb7,
8918 0x35, 0xf9, 0xb3, 0xc4};
8919 static const BYTE key_hash[] = {
8920 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5,
8921 0x95, 0x76, 0xb9, 0xf4};
8922 static const BYTE key_hash2[] = {
8923 0xa4, 0x8d, 0xe5, 0xbe, 0x7c, 0x79, 0xe4, 0x70, 0x23, 0x6d, 0x2e, 0x29, 0x34, 0xad, 0x23, 0x58,
8924 0xdc, 0xf5, 0x31, 0x7f};
8925 static const BYTE key_hash3[] = {
8926 0x14, 0x2e, 0xb3, 0x17, 0xb7, 0x58, 0x56, 0xcb, 0xae, 0x50, 0x09, 0x40, 0xe6, 0x1f, 0xaf, 0x9d,
8927 0x8b, 0x14, 0xc2, 0xc6};
8928 static const BYTE serial[] = {
8929 0xb1, 0xc1, 0x87, 0x54, 0x54, 0xac, 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08};
8930 static const BYTE serial2[] = {
8931 0x2f, 0x57, 0xa4, 0x85, 0xa2, 0xe3, 0x52, 0x54, 0x9a, 0x3b, 0x85, 0x98, 0xa2, 0x67, 0x2e, 0x0d};
8932 static const BYTE serial3[] = {
8933 0x5b, 0x83, 0x59, 0xcd, 0xb9, 0x89, 0x9d, 0x83, 0xae, 0xef, 0x13, 0x8c, 0xf3, 0x80, 0x82, 0x1c,
8934 0x26, 0x03};
8937 OCSP_BASIC_REVOKED_INFO *revoked;
8938 DWORD size;
8939 BOOL ret;
8940
8941 /* good cert */
8942 size = 0;
8945 ok(ret, "got %08lx\n", GetLastError());
8946
8947 ok(!info->dwVersion, "got %lu\n", info->dwVersion);
8948 ok(info->dwResponderIdChoice == 2, "got %lu\n", info->dwResponderIdChoice);
8949 ok(info->ByKeyResponderId.cbData == sizeof(resp_id), "got %lu\n", info->ByKeyResponderId.cbData);
8950 ok(!memcmp(info->ByKeyResponderId.pbData, resp_id, sizeof(resp_id)), "wrong data\n");
8951 ok(info->ProducedAt.dwLowDateTime == 3438583808, "got %lu\n", info->ProducedAt.dwLowDateTime);
8952 ok(info->ProducedAt.dwHighDateTime == 30946477, "got %lu\n", info->ProducedAt.dwHighDateTime);
8953 ok(info->cResponseEntry == 1, "got %lu\n", info->cResponseEntry);
8954 ok(info->rgResponseEntry != NULL, "got %p\n", info->rgResponseEntry);
8955
8956 entry = info->rgResponseEntry;
8957 ok(!strcmp(entry->CertId.HashAlgorithm.pszObjId, szOID_OIWSEC_sha1), "got '%s'\n", entry->CertId.HashAlgorithm.pszObjId);
8958 ok(entry->CertId.HashAlgorithm.Parameters.cbData == 2, "got %lu\n", entry->CertId.HashAlgorithm.Parameters.cbData);
8959 ok(entry->CertId.HashAlgorithm.Parameters.pbData[0] == 5, "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[0]);
8960 ok(!entry->CertId.HashAlgorithm.Parameters.pbData[1], "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[1]);
8961 ok(entry->CertId.IssuerNameHash.cbData == sizeof(name_hash), "got %lu\n", entry->CertId.IssuerNameHash.cbData);
8962 ok(!memcmp(entry->CertId.IssuerNameHash.pbData, name_hash, sizeof(name_hash)), "wrong data\n");
8963 ok(entry->CertId.IssuerKeyHash.cbData == sizeof(key_hash), "got %lu\n", entry->CertId.IssuerKeyHash.cbData);
8964 ok(!memcmp(entry->CertId.IssuerKeyHash.pbData, key_hash, sizeof(key_hash)), "wrong data\n");
8965 ok(entry->CertId.SerialNumber.cbData == sizeof(serial), "got %lu\n", entry->CertId.SerialNumber.cbData);
8966 ok(!memcmp(entry->CertId.SerialNumber.pbData, serial, sizeof(serial)), "wrong data\n");
8967 ok(entry->dwCertStatus == 0, "got %lu\n", entry->dwCertStatus);
8968 ok(entry->pRevokedInfo == NULL, "got %p\n", entry->pRevokedInfo);
8969 ok(entry->ThisUpdate.dwLowDateTime == 2558518400, "got %lu\n", entry->ThisUpdate.dwLowDateTime);
8970 ok(entry->ThisUpdate.dwHighDateTime == 30946475, "got %lu\n", entry->ThisUpdate.dwHighDateTime);
8971 ok(entry->NextUpdate.dwLowDateTime == 2014369408, "got %lu\n", entry->NextUpdate.dwLowDateTime);
8972 ok(entry->NextUpdate.dwHighDateTime == 30947877, "got %lu\n", entry->NextUpdate.dwHighDateTime);
8973 ok(!entry->cExtension, "got %lu\n", entry->cExtension);
8974 ok(entry->rgExtension == NULL, "got %p\n", entry->rgExtension);
8975
8976 ok(!info->cExtension, "got %lu\n", info->cExtension);
8977 ok(info->rgExtension == NULL, "got %p\n", info->rgExtension);
8978 LocalFree(info);
8979
8980 /* revoked cert */
8981 size = 0;
8984 ok(ret, "got %08lx\n", GetLastError());
8985
8986 ok(!info->dwVersion, "got %lu\n", info->dwVersion);
8987 ok(info->dwResponderIdChoice == 2, "got %lu\n", info->dwResponderIdChoice);
8988 ok(info->ByKeyResponderId.cbData == sizeof(resp_id), "got %lu\n", info->ByKeyResponderId.cbData);
8989 ok(!memcmp(info->ByKeyResponderId.pbData, resp_id2, sizeof(resp_id2)), "wrong data\n");
8990 ok(info->ProducedAt.dwLowDateTime == 647048832, "got %lu\n", info->ProducedAt.dwLowDateTime);
8991 ok(info->ProducedAt.dwHighDateTime == 30950558, "got %lu\n", info->ProducedAt.dwHighDateTime);
8992 ok(info->cResponseEntry == 1, "got %lu\n", info->cResponseEntry);
8993 ok(info->rgResponseEntry != NULL, "got %p\n", info->rgResponseEntry);
8994
8995 entry = info->rgResponseEntry;
8996 ok(!strcmp(entry->CertId.HashAlgorithm.pszObjId, szOID_OIWSEC_sha1), "got '%s'\n", entry->CertId.HashAlgorithm.pszObjId);
8997 ok(entry->CertId.HashAlgorithm.Parameters.cbData == 2, "got %lu\n", entry->CertId.HashAlgorithm.Parameters.cbData);
8998 ok(entry->CertId.HashAlgorithm.Parameters.pbData[0] == 5, "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[0]);
8999 ok(!entry->CertId.HashAlgorithm.Parameters.pbData[1], "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[1]);
9000 ok(entry->CertId.IssuerNameHash.cbData == sizeof(name_hash2), "got %lu\n", entry->CertId.IssuerNameHash.cbData);
9001 ok(!memcmp(entry->CertId.IssuerNameHash.pbData, name_hash2, sizeof(name_hash2)), "wrong data\n");
9002 ok(entry->CertId.IssuerKeyHash.cbData == sizeof(key_hash2), "got %lu\n", entry->CertId.IssuerKeyHash.cbData);
9003 ok(!memcmp(entry->CertId.IssuerKeyHash.pbData, key_hash2, sizeof(key_hash2)), "wrong data\n");
9004 ok(entry->CertId.SerialNumber.cbData == sizeof(serial2), "got %lu\n", entry->CertId.SerialNumber.cbData);
9005 ok(!memcmp(entry->CertId.SerialNumber.pbData, serial2, sizeof(serial2)), "wrong data\n");
9006 ok(entry->dwCertStatus == 1, "got %lu\n", entry->dwCertStatus);
9007 ok(entry->pRevokedInfo != NULL, "got NULL\n");
9008
9009 revoked = entry->pRevokedInfo;
9010 ok(revoked->RevocationDate.dwLowDateTime == 107865088, "got %lu\n", revoked->RevocationDate.dwLowDateTime);
9011 ok(revoked->RevocationDate.dwHighDateTime == 30919547, "got %lu\n", revoked->RevocationDate.dwHighDateTime);
9012 ok(!revoked->dwCrlReasonCode, "got %lu\n", revoked->dwCrlReasonCode);
9013
9014 ok(entry->ThisUpdate.dwLowDateTime == 3891950720, "got %lu\n", entry->ThisUpdate.dwLowDateTime);
9015 ok(entry->ThisUpdate.dwHighDateTime == 30950555, "got %lu\n", entry->ThisUpdate.dwHighDateTime);
9016 ok(entry->NextUpdate.dwLowDateTime == 3347801728, "got %lu\n", entry->NextUpdate.dwLowDateTime);
9017 ok(entry->NextUpdate.dwHighDateTime == 30951957, "got %lu\n", entry->NextUpdate.dwHighDateTime);
9018 ok(!entry->cExtension, "got %lu\n", entry->cExtension);
9019 ok(entry->rgExtension == NULL, "got %p\n", entry->rgExtension);
9020
9021 ok(!info->cExtension, "got %lu\n", info->cExtension);
9022 ok(info->rgExtension == NULL, "got %p\n", info->rgExtension);
9023 LocalFree(info);
9024
9025 size = 0;
9028 ok(ret, "got %08lx\n", GetLastError());
9029
9030 ok(!info->dwVersion, "got %lu\n", info->dwVersion);
9031 ok(info->dwResponderIdChoice == 1, "got %lu\n", info->dwResponderIdChoice);
9032 ok(info->ByNameResponderId.cbData == sizeof(resp_id3), "got %lu\n", info->ByNameResponderId.cbData);
9033 ok(!memcmp(info->ByNameResponderId.pbData, resp_id3, sizeof(resp_id3)), "wrong data\n");
9034
9035 ok(info->ProducedAt.dwLowDateTime == 1408824832, "got %lu\n", info->ProducedAt.dwLowDateTime);
9036 ok(info->ProducedAt.dwHighDateTime == 30991433, "got %lu\n", info->ProducedAt.dwHighDateTime);
9037 ok(info->cResponseEntry == 1, "got %lu\n", info->cResponseEntry);
9038 ok(info->rgResponseEntry != NULL, "got %p\n", info->rgResponseEntry);
9039
9040 entry = info->rgResponseEntry;
9041 ok(!strcmp(entry->CertId.HashAlgorithm.pszObjId, szOID_OIWSEC_sha1), "got '%s'\n", entry->CertId.HashAlgorithm.pszObjId);
9042 ok(entry->CertId.HashAlgorithm.Parameters.cbData == 2, "got %lu\n", entry->CertId.HashAlgorithm.Parameters.cbData);
9043 ok(entry->CertId.HashAlgorithm.Parameters.pbData[0] == 5, "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[0]);
9044 ok(!entry->CertId.HashAlgorithm.Parameters.pbData[1], "got 0x%02x\n", entry->CertId.HashAlgorithm.Parameters.pbData[1]);
9045 ok(entry->CertId.IssuerNameHash.cbData == sizeof(name_hash3), "got %lu\n", entry->CertId.IssuerNameHash.cbData);
9046 ok(!memcmp(entry->CertId.IssuerNameHash.pbData, name_hash3, sizeof(name_hash3)), "wrong data\n");
9047
9048 ok(entry->CertId.IssuerKeyHash.cbData == sizeof(key_hash3), "got %lu\n", entry->CertId.IssuerKeyHash.cbData);
9049 ok(!memcmp(entry->CertId.IssuerKeyHash.pbData, key_hash3, sizeof(key_hash3)), "wrong data\n");
9050 ok(entry->CertId.SerialNumber.cbData == sizeof(serial3), "got %lu\n", entry->CertId.SerialNumber.cbData);
9051 ok(!memcmp(entry->CertId.SerialNumber.pbData, serial3, sizeof(serial3)), "wrong data\n");
9052 ok(entry->dwCertStatus == 0, "got %lu\n", entry->dwCertStatus);
9053 ok(entry->pRevokedInfo == NULL, "got %p\n", entry->pRevokedInfo);
9054 ok(entry->ThisUpdate.dwLowDateTime == 808824832, "got %lu\n", entry->ThisUpdate.dwLowDateTime);
9055 ok(entry->ThisUpdate.dwHighDateTime == 30991433, "got %lu\n", entry->ThisUpdate.dwHighDateTime);
9056 ok(entry->NextUpdate.dwLowDateTime == 1474872064, "got %lu\n", entry->NextUpdate.dwLowDateTime);
9057 ok(entry->NextUpdate.dwHighDateTime == 30992841, "got %lu\n", entry->NextUpdate.dwHighDateTime);
9058 ok(!entry->cExtension, "got %lu\n", entry->cExtension);
9059 ok(entry->rgExtension == NULL, "got %p\n", entry->rgExtension);
9060
9061 ok(!info->cExtension, "got %lu\n", info->cExtension);
9062 ok(info->rgExtension == NULL, "got %p\n", info->rgExtension);
9063 LocalFree(info);
9064}
uint32_t serial
Definition: fsck.fat.h:29
static const BYTE ocsp_basic_response[]
Definition: encode.c:8661
static const BYTE ocsp_basic_response2[]
Definition: encode.c:8678
static const BYTE ocsp_basic_response_revoked[]
Definition: encode.c:8698
Definition: wincrypt.h:700
#define OCSP_BASIC_RESPONSE
Definition: wincrypt.h:3591
#define szOID_OIWSEC_sha1
Definition: wincrypt.h:3253

Referenced by START_TEST().

◆ test_decodeOCSPBasicSignedResponseInfo()

static void test_decodeOCSPBasicSignedResponseInfo ( DWORD  dwEncoding)
static

Definition at line 8857 of file encode.c.

8858{
8860 DWORD size;
8861 BOOL ret;
8862
8863 size = 0;
8866 ok(ret, "got %08lx\n", GetLastError());
8867 if (sizeof(void *) == 4) todo_wine ok(size == 496, "got %lu\n", size);
8868 else ok(size == 536, "got %lu\n", size);
8869 ok(info->ToBeSigned.cbData == sizeof(ocsp_basic_response), "got %lu\n", info->ToBeSigned.cbData);
8870 ok(!memcmp(info->ToBeSigned.pbData, ocsp_basic_response, sizeof(ocsp_basic_response)), "wrong data\n");
8871
8872 ok(!strcmp(info->SignatureInfo.SignatureAlgorithm.pszObjId, szOID_RSA_SHA256RSA),
8873 "got %s\n", info->SignatureInfo.SignatureAlgorithm.pszObjId);
8874 ok(info->SignatureInfo.SignatureAlgorithm.Parameters.cbData == 2,
8875 "got %lu\n", info->SignatureInfo.SignatureAlgorithm.Parameters.cbData);
8876 ok(info->SignatureInfo.SignatureAlgorithm.Parameters.pbData[0] == 5, "got 0x%02x\n",
8877 info->SignatureInfo.SignatureAlgorithm.Parameters.pbData[0]);
8878 ok(!info->SignatureInfo.SignatureAlgorithm.Parameters.pbData[1], "got 0x%02x\n",
8879 info->SignatureInfo.SignatureAlgorithm.Parameters.pbData[1]);
8880
8881 ok(info->SignatureInfo.Signature.cbData == sizeof(ocsp_signature), "got %lu\n",
8882 info->SignatureInfo.Signature.cbData);
8883 ok(!memcmp(info->SignatureInfo.Signature.pbData, ocsp_signature, sizeof(ocsp_signature)),
8884 "wrong signature data\n");
8885
8886 ok(!info->SignatureInfo.cCertEncoded, "got %lu\n", info->SignatureInfo.cCertEncoded);
8887 ok(!info->SignatureInfo.rgCertEncoded, "got %p\n", info->SignatureInfo.rgCertEncoded);
8888 LocalFree(info);
8889
8890 size = 0;
8893 ok(ret, "got %08lx\n", GetLastError());
8894 LocalFree(info);
8895}
#define todo_wine
Definition: minitest.h:80
static const BYTE ocsp_signature[]
Definition: encode.c:8716
static const BYTE ocsp_basic_signed_response_with_cert[]
Definition: encode.c:8741
static const BYTE ocsp_basic_signed_response[]
Definition: encode.c:8621
#define szOID_RSA_SHA256RSA
Definition: wincrypt.h:3177
#define OCSP_BASIC_SIGNED_RESPONSE
Definition: wincrypt.h:3590

Referenced by START_TEST().

◆ test_decodeOCSPResponseInfo()

static void test_decodeOCSPResponseInfo ( DWORD  dwEncoding)
static

Definition at line 8596 of file encode.c.

8597{
8599 DWORD size;
8600 BOOL ret;
8601
8604 ok(ret, "got %08lx\n", GetLastError());
8605 ok(info->dwStatus == OCSP_UNAUTHORIZED_RESPONSE, "got %lu\n", info->dwStatus);
8606 ok(info->pszObjId == NULL, "got %s\n", wine_dbgstr_a(info->pszObjId));
8607 ok(!info->Value.cbData, "got %lu\n", info->Value.cbData);
8608 ok(info->Value.pbData == NULL, "got %p\n", info->Value.pbData);
8609 LocalFree(info);
8610
8613 ok(ret, "got %08lx\n", GetLastError());
8614 ok(info->dwStatus == OCSP_SUCCESSFUL_RESPONSE, "got %lu\n", info->dwStatus);
8615 ok(!strcmp(info->pszObjId, szOID_PKIX_OCSP_BASIC_SIGNED_RESPONSE), "got %s\n", wine_dbgstr_a(info->pszObjId));
8616 ok(info->Value.cbData == 441, "got %lu\n", info->Value.cbData);
8617 ok(info->Value.pbData != NULL, "got %p\n", info->Value.pbData);
8618 LocalFree(info);
8619}
static const BYTE ocsp_response[]
Definition: encode.c:8549
static const BYTE ocsp_response2[]
Definition: encode.c:8553
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
#define szOID_PKIX_OCSP_BASIC_SIGNED_RESPONSE
Definition: wincrypt.h:678
#define OCSP_SUCCESSFUL_RESPONSE
Definition: wincrypt.h:671
#define OCSP_UNAUTHORIZED_RESPONSE
Definition: wincrypt.h:676
#define OCSP_RESPONSE
Definition: wincrypt.h:3589

Referenced by START_TEST().

◆ test_decodeOctets()

static void test_decodeOctets ( DWORD  dwEncoding)
static

Definition at line 1952 of file encode.c.

1953{
1954 DWORD i;
1955
1956 static const struct {
1957 const BYTE *encoded;
1958 UINT encoded_size;
1959 const BYTE *decoded;
1961 DWORD error;
1962 } tests[] = {
1963 {
1966 },{
1969 },{
1972 },{
1975 },{
1978 },{
1981 },{
1984 },{
1987 },{
1990 }
1991 };
1992
1993 for (i = 0; i < ARRAY_SIZE(tests); i++)
1994 {
1995 BYTE *buf = NULL;
1996 BOOL ret;
1997 DWORD bufSize = 0;
1998
2000 tests[i].encoded, tests[i].encoded_size,
2002 if (tests[i].error)
2003 {
2004 ok(!ret && GetLastError() == tests[i].error,
2005 "[%lu] CryptDecodeObjectEx returned %x(%lx)\n", i, ret, GetLastError());
2006 continue;
2007 }
2008 ok(ret, "[%lu] CryptDecodeObjectEx failed: %08lx\n", i, GetLastError());
2010 "[%lu] Expected size >= %d, got %ld\n", i,
2011 (int)sizeof(CRYPT_DATA_BLOB) + tests[i].decoded_size, bufSize);
2012 ok(buf != NULL, "Expected allocated buffer\n");
2013 if (ret)
2014 {
2016
2017 ok (blob->cbData == tests[i].decoded_size, "[%lu] cbData = %lu\n", i, blob->cbData);
2018 if (blob->cbData)
2019 ok(!memcmp(blob->pbData, tests[i].decoded, blob->cbData),
2020 "Unexpected value\n");
2021 LocalFree(buf);
2022 }
2023 }
2024}
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t _In_ uint64_t decoded_size
Definition: btrfs_drv.h:1365
#define error(str)
Definition: mkdosfs.c:1605
static struct test_info tests[]
static const unsigned char encoded_empty_octet[]
Definition: encode.c:1894
static const unsigned char encoded_constructed_hi_octet[]
Definition: encode.c:1943
static const unsigned char encoded_constructed_hi_octet_invalid_end[]
Definition: encode.c:1949
static const unsigned char encoded_something_long_octet[]
Definition: encode.c:1892
static const unsigned char decoded_something_long_octet[]
Definition: encode.c:1890
static const unsigned char encoded_constructed_hi_octet2[]
Definition: encode.c:1945
static const unsigned char decoded_hi_octet[]
Definition: encode.c:1888
static const unsigned char encoded_constructed_hi_octet3[]
Definition: encode.c:1947
static const unsigned char encoded_hi_octet[]
Definition: encode.c:1889
unsigned int UINT
Definition: ndis.h:50
#define X509_OCTET_STRING
Definition: wincrypt.h:3543

Referenced by START_TEST().

◆ test_decodePKCSAttribute()

static void test_decodePKCSAttribute ( DWORD  dwEncoding)
static

Definition at line 6191 of file encode.c.

6192{
6193 BOOL ret;
6194 LPBYTE buf = NULL;
6195 DWORD size = 0;
6197
6201 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6202 if (ret)
6203 {
6205
6206 ok(!strcmp(attr->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
6207 attr->pszObjId);
6208 ok(attr->cValue == 0, "Expected no value, got %ld\n", attr->cValue);
6209 LocalFree(buf);
6210 }
6211 SetLastError(0xdeadbeef);
6215 /* Native fails with CRYPT_E_ASN1_EOD, accept also CRYPT_E_ASN1_CORRUPT as
6216 * I doubt an app depends on that.
6217 */
6219 "Expected CRYPT_E_ASN1_EOD, CRYPT_E_ASN1_CORRUPT, got %lx\n",
6220 GetLastError());
6222 intPKCSAttr, sizeof(intPKCSAttr),
6224 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6225 if (ret)
6226 {
6228
6229 ok(!strcmp(attr->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
6230 attr->pszObjId);
6231 ok(attr->cValue == 1, "Expected 1 value, got %ld\n", attr->cValue);
6232 ok(attr->rgValue[0].cbData == ints[0].encoded[1] + 2,
6233 "Unexpected size %ld\n", attr->rgValue[0].cbData);
6234 ok(!memcmp(attr->rgValue[0].pbData, ints[0].encoded,
6235 attr->rgValue[0].cbData), "Unexpected value\n");
6236 LocalFree(buf);
6237 }
6238}
static const BYTE intPKCSAttr[]
Definition: encode.c:6133
static const BYTE emptyPKCSAttr[]
Definition: encode.c:6129
static const BYTE bogusPKCSAttr[]
Definition: encode.c:6131
Definition: cookie.c:202
#define PKCS_ATTRIBUTE
Definition: wincrypt.h:3539

Referenced by START_TEST().

◆ test_decodePKCSAttributes()

static void test_decodePKCSAttributes ( DWORD  dwEncoding)
static

Definition at line 6298 of file encode.c.

6299{
6300 BOOL ret;
6301 LPBYTE buf = NULL;
6302 DWORD size = 0;
6303 CRYPT_ATTRIBUTES *attributes;
6304
6308 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6309 if (ret)
6310 {
6311 attributes = (CRYPT_ATTRIBUTES *)buf;
6312 ok(attributes->cAttr == 0, "Expected no attributes, got %ld\n",
6313 attributes->cAttr);
6314 LocalFree(buf);
6315 }
6319 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6320 if (ret)
6321 {
6322 attributes = (CRYPT_ATTRIBUTES *)buf;
6323 ok(attributes->cAttr == 1, "Expected 1 attribute, got %ld\n",
6324 attributes->cAttr);
6325 ok(!strcmp(attributes->rgAttr[0].pszObjId, "1.2.3"),
6326 "Expected 1.2.3, got %s\n", attributes->rgAttr[0].pszObjId);
6327 ok(attributes->rgAttr[0].cValue == 0,
6328 "Expected no attributes, got %ld\n", attributes->rgAttr[0].cValue);
6329 LocalFree(buf);
6330 }
6334 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6335 if (ret)
6336 {
6337 attributes = (CRYPT_ATTRIBUTES *)buf;
6338 ok(attributes->cAttr == 2, "Expected 2 attributes, got %ld\n",
6339 attributes->cAttr);
6340 ok(!strcmp(attributes->rgAttr[0].pszObjId, "1.2.3"),
6341 "Expected 1.2.3, got %s\n", attributes->rgAttr[0].pszObjId);
6342 ok(attributes->rgAttr[0].cValue == 0,
6343 "Expected no attributes, got %ld\n", attributes->rgAttr[0].cValue);
6344 ok(!strcmp(attributes->rgAttr[1].pszObjId, "1.5.6"),
6345 "Expected 1.5.6, got %s\n", attributes->rgAttr[1].pszObjId);
6346 ok(attributes->rgAttr[1].cValue == 1,
6347 "Expected 1 attribute, got %ld\n", attributes->rgAttr[1].cValue);
6348 ok(attributes->rgAttr[1].rgValue[0].cbData == ints[0].encoded[1] + 2,
6349 "Unexpected size %ld\n", attributes->rgAttr[1].rgValue[0].cbData);
6350 ok(!memcmp(attributes->rgAttr[1].rgValue[0].pbData, ints[0].encoded,
6351 attributes->rgAttr[1].rgValue[0].cbData), "Unexpected value\n");
6352 LocalFree(buf);
6353 }
6356 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6357 buf = calloc(1, size);
6358 if (buf)
6359 {
6362 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6363 free(buf);
6364 }
6365}
static const BYTE doublePKCSAttributes[]
Definition: encode.c:6243
static const BYTE emptyPKCSAttributes[]
Definition: encode.c:6240
static const BYTE singlePKCSAttributes[]
Definition: encode.c:6241
PCRYPT_ATTRIBUTE rgAttr
Definition: wincrypt.h:612
#define PKCS_ATTRIBUTES
Definition: wincrypt.h:3570

Referenced by START_TEST().

◆ test_decodePKCSContentInfo()

static void test_decodePKCSContentInfo ( DWORD  dwEncoding)
static

Definition at line 6069 of file encode.c.

6070{
6071 BOOL ret;
6072 LPBYTE buf = NULL;
6073 DWORD size = 0, i;
6075
6076 const struct {
6077 const BYTE *encoded;
6078 UINT encoded_size;
6079 const char *obj_id;
6080 const BYTE *content;
6081 UINT content_size;
6082 } tests[] = {
6084 "1.2.3", NULL, 0 },
6086 "1.2.3", NULL, 0 },
6088 "1.2.3", ints[0].encoded, ints[0].encoded[1] + 2 },
6090 "1.2.840.113549.1.7.2", NULL, 392 },
6091 { content_abcd, sizeof(content_abcd),
6092 "1.2.3", encoded_abcd, 6 },
6094 "1.2.3", content_constructed_abcd + 8, 10 }
6095 };
6096
6097 for (i = 0; i < ARRAY_SIZE(tests); i++)
6098 {
6099 ret = CryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, tests[i].encoded,
6100 tests[i].encoded_size, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
6101 ok(ret, "[%lu] CryptDecodeObjectEx failed: %lx\n", i, GetLastError());
6102 if (!ret) continue;
6103
6105
6106 ok(!strcmp(info->pszObjId, tests[i].obj_id), "[%lu] Expected %s, got %s\n",
6107 i, tests[i].obj_id, info->pszObjId);
6108 ok(info->Content.cbData == tests[i].content_size,
6109 "[%lu] Unexpected size %ld expected %d\n", i, info->Content.cbData,
6110 tests[i].content_size);
6111 if (tests[i].content)
6112 ok(!memcmp(info->Content.pbData, tests[i].content, tests[i].content_size),
6113 "[%lu] Unexpected value\n", i);
6114 LocalFree(buf);
6115 }
6116
6120 /* Native fails with CRYPT_E_ASN1_EOD, accept also CRYPT_E_ASN1_CORRUPT as
6121 * I doubt an app depends on that.
6122 */
6123 ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
6125 "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %lx\n",
6126 GetLastError());
6127}
content
Definition: atl_ax.c:994
static const BYTE indefiniteSignedPKCSContent[]
Definition: encode.c:6014
static const BYTE emptyPKCSContentInfo[]
Definition: encode.c:5953
static const BYTE emptyPKCSContentInfoExtraBytes[]
Definition: encode.c:5954
static const BYTE content_constructed_abcd[]
Definition: encode.c:6057
static const BYTE intPKCSContentInfo[]
Definition: encode.c:5958
static const BYTE bogusPKCSContentInfo[]
Definition: encode.c:5956
static const BYTE encoded_abcd[]
Definition: encode.c:6053
static const BYTE content_abcd[]
Definition: encode.c:6044
#define PKCS_CONTENT_INFO
Definition: wincrypt.h:3552

Referenced by START_TEST().

◆ test_decodePKCSSignerInfo()

static void test_decodePKCSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6730 of file encode.c.

6731{
6732 BOOL ret;
6733 LPBYTE buf = NULL;
6734 DWORD size = 0;
6736
6737 /* A PKCS signer can't be decoded without a serial number. */
6738 SetLastError(0xdeadbeef);
6743 "Expected CRYPT_E_ASN1_CORRUPT, got %lx\n",
6744 GetLastError());
6748 ok(ret, "CryptDecodeObjectEx failed: %lx\n", GetLastError());
6749 if (ret)
6750 {
6752 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
6753 info->dwVersion);
6754 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6755 "Unexpected size %ld\n", info->Issuer.cbData);
6756 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6757 info->Issuer.cbData), "Unexpected value\n");
6758 ok(info->SerialNumber.cbData == sizeof(serialNum),
6759 "Unexpected size %ld\n", info->SerialNumber.cbData);
6760 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6761 "Unexpected value\n");
6762 LocalFree(buf);
6763 }
6767 if (ret)
6768 {
6770 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
6771 info->dwVersion);
6772 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6773 "Unexpected size %ld\n", info->Issuer.cbData);
6774 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6775 info->Issuer.cbData), "Unexpected value\n");
6776 ok(info->SerialNumber.cbData == sizeof(serialNum),
6777 "Unexpected size %ld\n", info->SerialNumber.cbData);
6778 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6779 "Unexpected value\n");
6780 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6781 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6782 LocalFree(buf);
6783 }
6787 NULL, &buf, &size);
6788 if (ret)
6789 {
6791 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
6792 info->dwVersion);
6793 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6794 "Unexpected size %ld\n", info->Issuer.cbData);
6795 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6796 info->Issuer.cbData), "Unexpected value\n");
6797 ok(info->SerialNumber.cbData == sizeof(serialNum),
6798 "Unexpected size %ld\n", info->SerialNumber.cbData);
6799 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6800 "Unexpected value\n");
6801 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6802 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6803 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, "1.5.6"),
6804 "Expected 1.5.6, got %s\n", info->HashEncryptionAlgorithm.pszObjId);
6805 LocalFree(buf);
6806 }
6810 if (ret)
6811 {
6813 ok(info->dwVersion == 0, "Expected version 0, got %ld\n",
6814 info->dwVersion);
6815 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6816 "Unexpected size %ld\n", info->Issuer.cbData);
6817 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6818 info->Issuer.cbData), "Unexpected value\n");
6819 ok(info->SerialNumber.cbData == sizeof(serialNum),
6820 "Unexpected size %ld\n", info->SerialNumber.cbData);
6821 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6822 "Unexpected value\n");
6823 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6824 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6825 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, "1.5.6"),
6826 "Expected 1.5.6, got %s\n", info->HashEncryptionAlgorithm.pszObjId);
6827 ok(info->EncryptedHash.cbData == sizeof(hash), "Unexpected size %ld\n",
6828 info->EncryptedHash.cbData);
6829 ok(!memcmp(info->EncryptedHash.pbData, hash, sizeof(hash)),
6830 "Unexpected value\n");
6831 LocalFree(buf);
6832 }
6836 if (ret)
6837 {
6839 ok(info->AuthAttrs.cAttr == 1, "Expected 1 attribute, got %ld\n",
6840 info->AuthAttrs.cAttr);
6841 ok(!strcmp(info->AuthAttrs.rgAttr[0].pszObjId, szOID_COMMON_NAME),
6842 "Expected %s, got %s\n", szOID_COMMON_NAME,
6843 info->AuthAttrs.rgAttr[0].pszObjId);
6844 ok(info->AuthAttrs.rgAttr[0].cValue == 1, "Expected 1 value, got %ld\n",
6845 info->AuthAttrs.rgAttr[0].cValue);
6846 ok(info->AuthAttrs.rgAttr[0].rgValue[0].cbData ==
6847 sizeof(encodedCommonName), "Unexpected size %ld\n",
6848 info->AuthAttrs.rgAttr[0].rgValue[0].cbData);
6849 ok(!memcmp(info->AuthAttrs.rgAttr[0].rgValue[0].pbData,
6850 encodedCommonName, sizeof(encodedCommonName)), "Unexpected value\n");
6851 LocalFree(buf);
6852 }
6853}
static const BYTE PKCSSignerWithAuthAttr[]
Definition: encode.c:6564
#define PKCS7_SIGNER_INFO
Definition: wincrypt.h:3594

Referenced by START_TEST().

◆ test_decodePKCSSMimeCapabilities()

static void test_decodePKCSSMimeCapabilities ( DWORD  dwEncoding)
static

Definition at line 6457 of file encode.c.

6458{
6459 static char oid1[] = "1.5.6", oid2[] = "1.2.3";
6460 BOOL ret;
6461 DWORD size = 0;
6462 CRYPT_SMIME_CAPABILITY capability[2];
6463 CRYPT_SMIME_CAPABILITIES capabilities, *ptr;
6464
6465 SetLastError(0xdeadbeef);
6469 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6470 if (ret)
6471 {
6472 capabilities.cCapability = 0;
6473 compareSMimeCapabilities("empty capabilities", &capabilities, ptr);
6474 LocalFree(ptr);
6475 }
6476 SetLastError(0xdeadbeef);
6479 &ptr, &size);
6480 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6481 if (ret)
6482 {
6483 capability[0].pszObjId = oid1;
6484 capability[0].Parameters.cbData = 0;
6485 capabilities.cCapability = 1;
6486 capabilities.rgCapability = capability;
6487 compareSMimeCapabilities("single capability", &capabilities, ptr);
6488 LocalFree(ptr);
6489 }
6490 SetLastError(0xdeadbeef);
6494 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6495 if (ret)
6496 {
6497 BYTE NULLparam[] = {0x05, 0x00};
6498 capability[0].pszObjId = oid1;
6499 capability[0].Parameters.cbData = 2;
6500 capability[0].Parameters.pbData = NULLparam;
6501 capabilities.cCapability = 1;
6502 capabilities.rgCapability = capability;
6503 compareSMimeCapabilities("single capability with NULL", &capabilities,
6504 ptr);
6505 LocalFree(ptr);
6506 }
6507 SetLastError(0xdeadbeef);
6510 &ptr, &size);
6511 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6512 if (ret)
6513 {
6514 capability[0].Parameters.cbData = 0;
6515 capability[1].pszObjId = oid2;
6516 capability[1].Parameters.cbData = 0;
6517 capabilities.cCapability = 2;
6518 compareSMimeCapabilities("two capabilities", &capabilities, ptr);
6519 LocalFree(ptr);
6520 }
6521 SetLastError(0xdeadbeef);
6523 twoCapabilities, sizeof(twoCapabilities), 0, NULL, NULL, &size);
6524 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6525 ptr = calloc(1, size);
6526 if (ptr)
6527 {
6528 SetLastError(0xdeadbeef);
6530 twoCapabilities, sizeof(twoCapabilities), 0, NULL, ptr, &size);
6531 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
6532 free(ptr);
6533 }
6534}
static PVOID ptr
Definition: dispmode.c:27
static void compareSMimeCapabilities(LPCSTR header, const CRYPT_SMIME_CAPABILITIES *expected, const CRYPT_SMIME_CAPABILITIES *got)
Definition: encode.c:6430
static const BYTE singleCapabilitywithNULL[]
Definition: encode.c:6371
static const BYTE twoCapabilities[]
Definition: encode.c:6369
static const BYTE singleCapability[]
Definition: encode.c:6367
#define PKCS_SMIME_CAPABILITIES
Definition: wincrypt.h:3562

Referenced by START_TEST().

◆ test_decodePolicyQualifierUserNotice()

static void test_decodePolicyQualifierUserNotice ( DWORD  dwEncoding)
static

Definition at line 7450 of file encode.c.

7451{
7452 BOOL ret;
7454 DWORD size;
7455
7456 ret = CryptDecodeObjectEx(dwEncoding,
7459 &notice, &size);
7460 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7461 if (ret)
7462 {
7463 ok(notice->pszDisplayText == NULL, "unexpected display text\n");
7464 ok(notice->pNoticeReference == NULL, "unexpected notice reference\n");
7466 }
7467 ret = CryptDecodeObjectEx(dwEncoding,
7471 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7472 if (ret)
7473 {
7474 ok(!lstrcmpW(notice->pszDisplayText, L"This is a notice"),
7475 "unexpected display text\n");
7476 ok(notice->pNoticeReference == NULL, "unexpected notice reference\n");
7478 }
7479 ret = CryptDecodeObjectEx(dwEncoding,
7483 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
7484 if (ret)
7485 {
7486 ok(!lstrcmpW(notice->pszDisplayText, L"This is a notice"),
7487 "unexpected display text\n");
7488 ok(notice->pNoticeReference != NULL, "expected a notice reference\n");
7489 if (notice->pNoticeReference)
7490 {
7491 ok(!strcmp(notice->pNoticeReference->pszOrganization, org),
7492 "unexpected organization %s\n",
7493 notice->pNoticeReference->pszOrganization);
7494 ok(notice->pNoticeReference->cNoticeNumbers == 2,
7495 "expected 2 notice numbers, got %ld\n",
7496 notice->pNoticeReference->cNoticeNumbers);
7497 ok(notice->pNoticeReference->rgNoticeNumbers[0] == noticeNumbers[0],
7498 "unexpected notice number %d\n",
7499 notice->pNoticeReference->rgNoticeNumbers[0]);
7500 ok(notice->pNoticeReference->rgNoticeNumbers[1] == noticeNumbers[1],
7501 "unexpected notice number %d\n",
7502 notice->pNoticeReference->rgNoticeNumbers[1]);
7503 }
7505 }
7506}
#define L(x)
Definition: resources.c:13
static char org[]
Definition: encode.c:7395
static const BYTE noticeWithDisplayText[]
Definition: encode.c:7390
static int noticeNumbers[]
Definition: encode.c:7396
notice
Definition: t1tokens.h:26
#define X509_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3566

Referenced by START_TEST().

◆ test_decodePublicKeyInfo()

static void test_decodePublicKeyInfo ( DWORD  dwEncoding)
static

Definition at line 2931 of file encode.c.

2932{
2933 static const BYTE bogusPubKeyInfo[] = { 0x30, 0x22, 0x30, 0x0d, 0x06, 0x06,
2934 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
2935 0x11, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
2936 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
2937 DWORD i;
2938 BOOL ret;
2939 BYTE *buf = NULL;
2940 DWORD bufSize = 0;
2941
2942 for (i = 0; i < ARRAY_SIZE(pubKeys); i++)
2943 {
2944 /* The NULL form decodes to the decoded member */
2946 pubKeys[i].encoded, pubKeys[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2947 NULL, &buf, &bufSize);
2948 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2949 if (ret)
2950 {
2951 comparePublicKeyInfo(&pubKeys[i].decoded,
2953 LocalFree(buf);
2954 }
2955 /* The non-NULL form decodes to the original */
2957 pubKeys[i].encodedNoNull, pubKeys[i].encodedNoNull[1] + 2,
2959 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2960 if (ret)
2961 {
2963 LocalFree(buf);
2964 }
2965 }
2966 /* Test with bogus (not valid DER) parameters */
2968 bogusPubKeyInfo, bogusPubKeyInfo[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2969 NULL, &buf, &bufSize);
2971 "Expected CRYPT_E_ASN1_CORRUPT, got %08lx\n", GetLastError());
2972}
static const struct encodedPublicKey pubKeys[]
Definition: encode.c:2863
static void comparePublicKeyInfo(const CERT_PUBLIC_KEY_INFO *expected, const CERT_PUBLIC_KEY_INFO *got)
Definition: encode.c:2909
#define X509_PUBLIC_KEY_INFO
Definition: wincrypt.h:3525

Referenced by START_TEST().

◆ test_decodeRsaPrivateKey()

static void test_decodeRsaPrivateKey ( DWORD  dwEncoding)
static

Definition at line 8152 of file encode.c.

8153{
8154 LPBYTE buf = NULL;
8155 DWORD bufSize = 0;
8156 BOOL ret;
8157
8159 rsaPrivKeyDer, sizeof(rsaPrivKeyDer)-10,
8162 "Expected CRYPT_E_ASN1_EOD, got %08lx\n",
8163 GetLastError());
8164
8165 buf = NULL;
8166 bufSize = 0;
8170 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
8171
8172 if (ret)
8173 {
8175 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(buf + sizeof(BLOBHEADER));
8176 static const int bitlen = 2048;
8177 BYTE *modulus = (BYTE*)(rsaPubKey + 1);
8178 BYTE *prime1 = modulus + bitlen/8;
8179 BYTE *prime2 = prime1 + bitlen/16;
8180 BYTE *exponent1 = prime2 + bitlen/16;
8181 BYTE *exponent2 = exponent1 + bitlen/16;
8182 BYTE *coefficient = exponent2 + bitlen/16;
8183 BYTE *privateExponent = coefficient + bitlen/16;
8184
8185 ok(bufSize >= sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) +
8186 (bitlen * 9 / 16),
8187 "Wrong size %ld\n", bufSize);
8188
8189 ok(hdr->bType == PRIVATEKEYBLOB,
8190 "Expected type PRIVATEKEYBLOB (%d), got %d\n", PRIVATEKEYBLOB,
8191 hdr->bType);
8192 ok(hdr->bVersion == CUR_BLOB_VERSION,
8193 "Expected version CUR_BLOB_VERSION (%d), got %d\n",
8194 CUR_BLOB_VERSION, hdr->bVersion);
8195 ok(hdr->reserved == 0, "Expected reserved 0, got %d\n",
8196 hdr->reserved);
8197 ok(hdr->aiKeyAlg == CALG_RSA_KEYX,
8198 "Expected CALG_RSA_KEYX, got %08x\n", hdr->aiKeyAlg);
8199
8200 ok(rsaPubKey->magic == 0x32415352,
8201 "Expected magic 0x32415352, got 0x%lx\n", rsaPubKey->magic);
8202 ok(rsaPubKey->bitlen == bitlen,
8203 "Expected bitlen %d, got %ld\n", bitlen, rsaPubKey->bitlen);
8204 ok(rsaPubKey->pubexp == 65537,
8205 "Expected pubexp 65537, got %ld\n", rsaPubKey->pubexp);
8206
8207 ok(!memcmp(modulus, rsaPrivKeyModulus, bitlen/8),
8208 "unexpected modulus\n");
8209 ok(!memcmp(prime1, rsaPrivKeyPrime1, bitlen/16),
8210 "unexpected prime1\n");
8211 ok(!memcmp(prime2, rsaPrivKeyPrime2, bitlen/16),
8212 "unexpected prime2\n");
8213 ok(!memcmp(exponent1, rsaPrivKeyExponent1, bitlen/16),
8214 "unexpected exponent1\n");
8215 ok(!memcmp(exponent2, rsaPrivKeyExponent2, bitlen/16),
8216 "unexpected exponent2\n");
8217 ok(!memcmp(coefficient, rsaPrivKeyCoefficient, bitlen/16),
8218 "unexpected coefficient\n");
8219 ok(!memcmp(privateExponent, rsaPrivKeyPrivateExponent, bitlen/8),
8220 "unexpected privateExponent\n");
8221
8222 LocalFree(buf);
8223 }
8224}
char hdr[14]
Definition: iptest.cpp:33
static const BYTE rsaPrivKeyDer[]
Definition: encode.c:7944
static const BYTE rsaPrivKeyPrime1[]
Definition: encode.c:8068
static const BYTE rsaPrivKeyModulus[]
Definition: encode.c:8045
static const BYTE rsaPrivKeyExponent1[]
Definition: encode.c:8092
static const BYTE rsaPrivKeyExponent2[]
Definition: encode.c:8104
static const BYTE rsaPrivKeyCoefficient[]
Definition: encode.c:8116
static const BYTE rsaPrivKeyPrivateExponent[]
Definition: encode.c:8128
static const BYTE rsaPrivKeyPrime2[]
Definition: encode.c:8080
DWORD pubexp
Definition: wincrypt.h:154
DWORD bitlen
Definition: wincrypt.h:153
DWORD magic
Definition: wincrypt.h:152
#define PRIVATEKEYBLOB
Definition: wincrypt.h:2445
#define CALG_RSA_KEYX
Definition: wincrypt.h:2080
#define PKCS_RSA_PRIVATE_KEY
Definition: wincrypt.h:3563
#define CUR_BLOB_VERSION
Definition: wincrypt.h:2451

Referenced by START_TEST().

◆ test_decodeRsaPublicKey()

static void test_decodeRsaPublicKey ( DWORD  dwEncoding)
static

Definition at line 2435 of file encode.c.

2436{
2437 DWORD i;
2438 LPBYTE buf = NULL;
2439 DWORD bufSize = 0;
2440 BOOL ret;
2441
2442 /* Try with a bad length */
2444 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1],
2447 "Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
2448 /* Try with a couple of RSA-related OIDs */
2450 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2,
2453 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
2455 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2,
2458 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
2459 /* Now try success cases */
2460 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2461 {
2462 bufSize = 0;
2464 rsaPubKeys[i].encoded, rsaPubKeys[i].encoded[1] + 2,
2466 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2467 if (ret)
2468 {
2470 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(buf + sizeof(BLOBHEADER));
2471
2472 ok(bufSize >= sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) +
2473 rsaPubKeys[i].decodedModulusLen,
2474 "Wrong size %ld\n", bufSize);
2475 ok(hdr->bType == PUBLICKEYBLOB,
2476 "Expected type PUBLICKEYBLOB (%d), got %d\n", PUBLICKEYBLOB,
2477 hdr->bType);
2478 ok(hdr->bVersion == CUR_BLOB_VERSION,
2479 "Expected version CUR_BLOB_VERSION (%d), got %d\n",
2480 CUR_BLOB_VERSION, hdr->bVersion);
2481 ok(hdr->reserved == 0, "Expected reserved 0, got %d\n",
2482 hdr->reserved);
2483 ok(hdr->aiKeyAlg == CALG_RSA_KEYX,
2484 "Expected CALG_RSA_KEYX, got %08x\n", hdr->aiKeyAlg);
2485 ok(rsaPubKey->magic == 0x31415352,
2486 "Expected magic RSA1, got %08lx\n", rsaPubKey->magic);
2487 ok(rsaPubKey->bitlen == rsaPubKeys[i].decodedModulusLen * 8,
2488 "Wrong bit len %ld\n", rsaPubKey->bitlen);
2489 ok(rsaPubKey->pubexp == 131073, "Expected pubexp 131073, got %ld\n",
2490 rsaPubKey->pubexp);
2491 ok(!memcmp(buf + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY),
2492 rsaPubKeys[i].modulus, rsaPubKeys[i].decodedModulusLen),
2493 "Unexpected modulus\n");
2494 LocalFree(buf);
2495 }
2496 }
2497}
static const struct EncodedRSAPubKey rsaPubKeys[]
Definition: encode.c:2337
#define PUBLICKEYBLOB
Definition: wincrypt.h:2444
#define RSA_CSP_PUBLICKEYBLOB
Definition: wincrypt.h:3536
#define szOID_RSA_SHA1RSA
Definition: wincrypt.h:3175

Referenced by START_TEST().

◆ test_decodeRsaPublicKey_Bcrypt()

static void test_decodeRsaPublicKey_Bcrypt ( DWORD  dwEncoding)
static

Definition at line 2552 of file encode.c.

2553{
2554 DWORD i;
2555 LPBYTE buf = NULL;
2556 LPBYTE leModulus = NULL;
2557 DWORD bufSize = 0;
2558 BOOL ret;
2559
2560 /* Try with a bad length */
2562 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1],
2565 "Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
2566 /* Now try success cases */
2567 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2568 {
2569 bufSize = 0;
2571 rsaPubKeys[i].encoded, rsaPubKeys[i].encoded[1] + 2,
2573 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2574 if (ret)
2575 {
2577 BYTE pubexp[] = {0xff,0xff,0xff,0xcc}, pubexp_expected[] = {0x01,0x00,0x02};
2578 /* CNG_RSA_PUBLIC_KEY_BLOB stores the exponent
2579 * in big-endian format, so we need to convert it to little-endian
2580 */
2581 CRYPT_CopyReversed((BYTE *)&pubexp, buf + sizeof(BCRYPT_RSAKEY_BLOB), hdr->cbPublicExp);
2582 ok(bufSize >= sizeof(BCRYPT_RSAKEY_BLOB) +
2583 rsaPubKeys[i].decodedModulusLen,
2584 "Wrong size %ld\n", bufSize);
2585 ok(hdr->Magic == BCRYPT_RSAPUBLIC_MAGIC,
2586 "Expected magic BCRYPT_RSAPUBLIC_MAGIC (%d), got %ld\n", BCRYPT_RSAPUBLIC_MAGIC,
2587 hdr->Magic);
2588 ok(hdr->BitLength == rsaPubKeys[i].decodedModulusLen * 8,
2589 "Wrong bit len %ld\n", hdr->BitLength);
2590 /* Windows decodes the exponent to 3 bytes, since it will fit.
2591 * Our implementation currently unconditionally decodes to a DWORD (4 bytes)
2592 */
2593 ok(hdr->cbPublicExp == 3, "Expected cbPublicExp 3, got %ld\n", hdr->cbPublicExp);
2594 ok(hdr->cbModulus == rsaPubKeys[i].decodedModulusLen,
2595 "Wrong modulus len %ld\n", hdr->cbModulus);
2596 ok(hdr->cbPrime1 == 0,"Wrong cbPrime1 %ld\n", hdr->cbPrime1);
2597 ok(hdr->cbPrime2 == 0,"Wrong cbPrime2 %ld\n", hdr->cbPrime2);
2598 ok(!memcmp(pubexp, pubexp_expected, sizeof(pubexp_expected)), "Wrong exponent\n");
2599 ok(pubexp[3] == 0xcc, "Got %02x\n", pubexp[3]);
2600
2601 leModulus = malloc(hdr->cbModulus);
2602 /*
2603 * CNG_RSA_PUBLIC_KEY_BLOB stores the modulus in big-endian format,
2604 * so we need to convert it to little-endian
2605 */
2606 CRYPT_CopyReversed(leModulus, buf + sizeof(BCRYPT_RSAKEY_BLOB) + hdr->cbPublicExp,
2607 hdr->cbModulus);
2608 ok(!memcmp(leModulus,
2609 rsaPubKeys[i].modulus, rsaPubKeys[i].decodedModulusLen),
2610 "Unexpected modulus\n");
2611 LocalFree(buf);
2612 free(leModulus);
2613 }
2614 }
2615}
#define BCRYPT_RSAPUBLIC_MAGIC
Definition: bcrypt.h:133
#define malloc
Definition: debug_ros.c:4
void CRYPT_CopyReversed(BYTE *dst, const BYTE *src, size_t len)
Definition: encode.c:30
#define CNG_RSA_PUBLIC_KEY_BLOB
Definition: wincrypt.h:3592

Referenced by START_TEST().

◆ test_decodeSequenceOfAny()

static void test_decodeSequenceOfAny ( DWORD  dwEncoding)
static

Definition at line 2670 of file encode.c.

2671{
2672 BOOL ret;
2673 BYTE *buf = NULL;
2674 DWORD bufSize = 0;
2675
2678 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2679 if (ret)
2680 {
2682 DWORD i;
2683
2684 ok(seq->cValue == ARRAY_SIZE(ints), "Wrong elements %ld\n", seq->cValue);
2685 for (i = 0; i < min(seq->cValue, ARRAY_SIZE(ints)); i++)
2686 {
2687 ok(seq->rgValue[i].cbData == ints[i].encoded[1] + 2,
2688 "Expected %d bytes, got %ld\n", ints[i].encoded[1] + 2,
2689 seq->rgValue[i].cbData);
2690 ok(!memcmp(seq->rgValue[i].pbData, ints[i].encoded,
2691 ints[i].encoded[1] + 2), "Unexpected value\n");
2692 }
2693 LocalFree(buf);
2694 }
2697 &bufSize);
2698 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
2699 if (ret)
2700 {
2702
2703 ok(seq->cValue == ARRAY_SIZE(ints), "Wrong elements %ld\n", seq->cValue);
2704 /* Just check the first element since it's all that changed */
2705 ok(seq->rgValue[0].cbData == times[0].encodedTime[1] + 2,
2706 "Expected %d bytes, got %ld\n", times[0].encodedTime[1] + 2,
2707 seq->rgValue[0].cbData);
2708 ok(!memcmp(seq->rgValue[0].pbData, times[0].encodedTime,
2709 times[0].encodedTime[1] + 2), "Unexpected value\n");
2710 LocalFree(buf);
2711 }
2712}
static const BYTE intSequence[]
Definition: encode.c:2617
static const BYTE mixedSequence[]
Definition: encode.c:2621
PCRYPT_DER_BLOB rgValue
Definition: wincrypt.h:468
#define X509_SEQUENCE_OF_ANY
Definition: wincrypt.h:3553

Referenced by START_TEST().

◆ test_decodeUnicodeName()

static void test_decodeUnicodeName ( DWORD  dwEncoding)
static

Definition at line 1121 of file encode.c.

1122{
1123 BYTE *buf = NULL;
1124 DWORD bufSize = 0;
1125 BOOL ret;
1126 CERT_RDN rdn;
1127 CERT_NAME_INFO info = { 1, &rdn };
1128
1129 /* test empty name */
1130 bufSize = 0;
1132 emptySequence[1] + 2,
1134 &buf, &bufSize);
1135 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1136 if (ret)
1137 {
1138 ok(bufSize == sizeof(CERT_NAME_INFO),
1139 "Got wrong bufSize %ld\n", bufSize);
1140 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1141 "Expected 0 RDNs in empty info, got %ld\n",
1142 ((CERT_NAME_INFO *)buf)->cRDN);
1143 LocalFree(buf);
1144 }
1145 /* test empty RDN */
1146 bufSize = 0;
1148 emptyRDNs[1] + 2,
1150 &buf, &bufSize);
1151 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1152 if (ret)
1153 {
1155
1156 ok(bufSize == sizeof(CERT_NAME_INFO) + sizeof(CERT_RDN) &&
1157 info->cRDN == 1 && info->rgRDN && info->rgRDN[0].cRDNAttr == 0,
1158 "Got unexpected value for empty RDN\n");
1159 LocalFree(buf);
1160 }
1161 /* test two RDN attrs */
1162 bufSize = 0;
1164 sizeof(twoRDNsNoNull),
1166 &buf, &bufSize);
1167 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1168 if (ret)
1169 {
1170 static CHAR oid_sur_name[] = szOID_SUR_NAME,
1171 oid_common_name[] = szOID_COMMON_NAME;
1172
1173 CERT_RDN_ATTR attrs[] = {
1174 { oid_sur_name, CERT_RDN_PRINTABLE_STRING,
1175 { lstrlenW(L"Lang") * sizeof(WCHAR), (BYTE *)L"Lang" } },
1176 { oid_common_name, CERT_RDN_PRINTABLE_STRING,
1177 { lstrlenW(L"Juan Lang") * sizeof(WCHAR), (BYTE *)L"Juan Lang" } },
1178 };
1179
1180 rdn.cRDNAttr = ARRAY_SIZE(attrs);
1181 rdn.rgRDNAttr = attrs;
1183 LocalFree(buf);
1184 }
1185}
static const BYTE twoRDNsNoNull[]
Definition: encode.c:848
#define X509_UNICODE_NAME
Definition: wincrypt.h:3537

Referenced by START_TEST().

◆ test_decodeUnicodeNameValue()

static void test_decodeUnicodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1858 of file encode.c.

1859{
1860 DWORD i;
1861
1862 for (i = 0; i < ARRAY_SIZE(unicodeResults); i++)
1863 {
1864 BYTE *buf = NULL;
1865 BOOL ret;
1866 DWORD size = 0;
1867
1869 unicodeResults[i].encoded.pbData, unicodeResults[i].encoded.cbData,
1871 ok(ret, "CryptDecodeObjectEx failed: %08lx\n", GetLastError());
1872 if (ret && buf)
1873 {
1875
1876 ok(value->dwValueType == unicodeResults[i].valueType,
1877 "Expected value type %ld, got %ld\n", unicodeResults[i].valueType,
1878 value->dwValueType);
1879 ok(!wcsncmp((LPWSTR)value->Value.pbData, unicodeResults[i].str,
1880 value->Value.cbData / sizeof(WCHAR)),
1881 "Unexpected decoded value for index %ld (value type %ld)\n", i,
1882 unicodeResults[i].valueType);
1883 LocalFree(buf);
1884 }
1885 }
1886}
static struct UnicodeExpectedResult unicodeResults[]
Definition: encode.c:1736
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
struct _CERT_NAME_VALUE * PCERT_NAME_VALUE
#define X509_UNICODE_NAME_VALUE
Definition: wincrypt.h:3541

Referenced by START_TEST().

◆ test_encodeAltName()

static void test_encodeAltName ( DWORD  dwEncoding)
static

Definition at line 1401 of file encode.c.

1402{
1403 CERT_ALT_NAME_INFO info = { 0 };
1404 CERT_ALT_NAME_ENTRY entry = { 0 };
1405 BYTE *buf = NULL;
1406 DWORD size = 0;
1407 BOOL ret;
1408 char oid[] = "1.2.3";
1409
1410 /* Test with empty info */
1413 if (ret)
1414 {
1415 ok(size == sizeof(emptySequence), "Wrong size %ld\n", size);
1416 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
1417 LocalFree(buf);
1418 }
1419 /* Test with an empty entry */
1420 info.cAltEntry = 1;
1421 info.rgAltEntry = &entry;
1425 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
1426 /* Test with an empty pointer */
1427 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
1430 if (ret)
1431 {
1432 ok(size == sizeof(emptyURL), "Wrong size %ld\n", size);
1433 ok(!memcmp(buf, emptyURL, size), "Unexpected value\n");
1434 LocalFree(buf);
1435 }
1436 /* Test with a real URL */
1437 entry.pwszURL = (LPWSTR)url;
1440 if (ret)
1441 {
1442 ok(size == sizeof(encodedURL), "Wrong size %ld\n", size);
1443 ok(!memcmp(buf, encodedURL, size), "Unexpected value\n");
1444 LocalFree(buf);
1445 }
1446 /* Now with the URL containing an invalid IA5 char */
1447 entry.pwszURL = (WCHAR *)L"http://\x226f\x575b";
1451 "Expected CRYPT_E_INVALID_IA5_STRING, got %08lx\n", GetLastError());
1452 /* The first invalid character is at index 7 */
1454 "Expected invalid char at index 7, got %ld\n",
1456 /* Now with the URL missing a scheme */
1457 entry.pwszURL = (LPWSTR)dnsName;
1460 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
1461 if (ret)
1462 {
1463 /* This succeeds, but it shouldn't, so don't worry about conforming */
1464 LocalFree(buf);
1465 }
1466 /* Now with a DNS name */
1467 entry.dwAltNameChoice = CERT_ALT_NAME_DNS_NAME;
1470 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
1471 if (ret)
1472 {
1473 ok(size == sizeof(encodedDnsName), "Wrong size %ld\n", size);
1474 ok(!memcmp(buf, encodedDnsName, size), "Unexpected value\n");
1475 LocalFree(buf);
1476 }
1477 /* Test with an IP address */
1478 entry.dwAltNameChoice = CERT_ALT_NAME_IP_ADDRESS;
1479 entry.IPAddress.cbData = sizeof(localhost);
1480 entry.IPAddress.pbData = (LPBYTE)localhost;
1483 if (ret)
1484 {
1485 ok(size == sizeof(encodedIPAddr), "Wrong size %ld\n", size);
1486 ok(!memcmp(buf, encodedIPAddr, size), "Unexpected value\n");
1487 LocalFree(buf);
1488 }
1489 /* Test with OID */
1490 entry.dwAltNameChoice = CERT_ALT_NAME_REGISTERED_ID;
1491 entry.pszRegisteredID = oid;
1494 if (ret)
1495 {
1496 ok(size == sizeof(encodedOidName), "Wrong size %ld\n", size);
1497 ok(!memcmp(buf, encodedOidName, size), "Unexpected value\n");
1498 LocalFree(buf);
1499 }
1500 /* Test with directory name */
1501 entry.dwAltNameChoice = CERT_ALT_NAME_DIRECTORY_NAME;
1502 entry.DirectoryName.cbData = sizeof(encodedCommonName);
1503 entry.DirectoryName.pbData = (LPBYTE)encodedCommonName;
1506 if (ret)
1507 {
1508 ok(size == sizeof(encodedDirectoryName), "Wrong size %ld\n", size);
1509 ok(!memcmp(buf, encodedDirectoryName, size), "Unexpected value\n");
1510 LocalFree(buf);
1511 }
1512}
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded)
Definition: encode.c:4696
#define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x)
Definition: wincrypt.h:376
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3599
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:4440

Referenced by START_TEST().

◆ test_encodeAuthorityInfoAccess()

static void test_encodeAuthorityInfoAccess ( DWORD  dwEncoding)
static

Definition at line 5235 of file encode.c.

5236{
5237 static char oid1[] = "1.2.3";
5238 static char oid2[] = "1.5.6";
5239 BOOL ret;
5240 BYTE *buf = NULL;
5241 DWORD size = 0;
5242 CERT_ACCESS_DESCRIPTION accessDescription[2];
5244
5245 memset(accessDescription, 0, sizeof(accessDescription));
5246 aia.cAccDescr = 0;
5247 aia.rgAccDescr = NULL;
5248 /* Having no access descriptions is allowed */
5251 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5252 if (ret)
5253 {
5254 ok(size == sizeof(emptySequence), "unexpected size %ld\n", size);
5255 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
5256 LocalFree(buf);
5257 buf = NULL;
5258 }
5259 /* It can't have an empty access method */
5260 aia.cAccDescr = 1;
5261 aia.rgAccDescr = accessDescription;
5265 "expected E_INVALIDARG, got %08lx\n", GetLastError());
5266 /* It can't have an empty location */
5267 accessDescription[0].pszAccessMethod = oid1;
5268 SetLastError(0xdeadbeef);
5272 "expected E_INVALIDARG, got %08lx\n", GetLastError());
5273 accessDescription[0].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5274 accessDescription[0].AccessLocation.pwszURL = (LPWSTR)url;
5277 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5278 if (ret)
5279 {
5280 ok(size == sizeof(authorityInfoAccessWithUrl), "unexpected size %ld\n",
5281 size);
5283 "unexpected value\n");
5284 LocalFree(buf);
5285 buf = NULL;
5286 }
5287 accessDescription[1].pszAccessMethod = oid2;
5289 accessDescription[1].AccessLocation.IPAddress.cbData = sizeof(encodedIPAddr);
5290 accessDescription[1].AccessLocation.IPAddress.pbData = (LPBYTE)encodedIPAddr;
5291 aia.cAccDescr = 2;
5294 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5295 if (ret)
5296 {
5298 "unexpected size %ld\n", size);
5300 "unexpected value\n");
5301 LocalFree(buf);
5302 buf = NULL;
5303 }
5304}

Referenced by START_TEST().

◆ test_encodeAuthorityKeyId()

static void test_encodeAuthorityKeyId ( DWORD  dwEncoding)
static

Definition at line 4933 of file encode.c.

4934{
4935 CERT_AUTHORITY_KEY_ID_INFO info = { { 0 } };
4936 BOOL ret;
4937 BYTE *buf = NULL;
4938 DWORD size = 0;
4939
4940 /* Test with empty id */
4943 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4944 if (ret)
4945 {
4946 ok(size == sizeof(emptySequence), "Unexpected size %ld\n", size);
4947 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
4948 LocalFree(buf);
4949 }
4950 /* With just a key id */
4951 info.KeyId.cbData = sizeof(keyId);
4952 info.KeyId.pbData = keyId;
4955 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4956 if (ret)
4957 {
4958 ok(size == sizeof(authorityKeyIdWithId), "Unexpected size %ld\n", size);
4959 ok(!memcmp(buf, authorityKeyIdWithId, size), "Unexpected value\n");
4960 LocalFree(buf);
4961 }
4962 /* With just an issuer */
4963 info.KeyId.cbData = 0;
4964 info.CertIssuer.cbData = sizeof(encodedCommonName);
4965 info.CertIssuer.pbData = (BYTE *)encodedCommonName;
4968 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4969 if (ret)
4970 {
4971 ok(size == sizeof(authorityKeyIdWithIssuer), "Unexpected size %ld\n",
4972 size);
4973 ok(!memcmp(buf, authorityKeyIdWithIssuer, size), "Unexpected value\n");
4974 LocalFree(buf);
4975 }
4976 /* With just a serial number */
4977 info.CertIssuer.cbData = 0;
4978 info.CertSerialNumber.cbData = sizeof(serialNum);
4979 info.CertSerialNumber.pbData = (BYTE *)serialNum;
4982 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4983 if (ret)
4984 {
4985 ok(size == sizeof(authorityKeyIdWithSerial), "Unexpected size %ld\n",
4986 size);
4987 ok(!memcmp(buf, authorityKeyIdWithSerial, size), "Unexpected value\n");
4988 LocalFree(buf);
4989 }
4990}

Referenced by START_TEST().

◆ test_encodeAuthorityKeyId2()

static void test_encodeAuthorityKeyId2 ( DWORD  dwEncoding)
static

Definition at line 5072 of file encode.c.

5073{
5075 CERT_ALT_NAME_ENTRY entry = { 0 };
5076 BOOL ret;
5077 BYTE *buf = NULL;
5078 DWORD size = 0;
5079
5080 /* Test with empty id */
5083 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5084 if (ret)
5085 {
5086 ok(size == sizeof(emptySequence), "Unexpected size %ld\n", size);
5087 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
5088 LocalFree(buf);
5089 }
5090 /* With just a key id */
5091 info.KeyId.cbData = sizeof(keyId);
5092 info.KeyId.pbData = keyId;
5095 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5096 if (ret)
5097 {
5098 ok(size == sizeof(authorityKeyIdWithId), "Unexpected size %ld\n",
5099 size);
5100 ok(!memcmp(buf, authorityKeyIdWithId, size), "Unexpected value\n");
5101 LocalFree(buf);
5102 }
5103 /* With a bogus issuer name */
5104 info.KeyId.cbData = 0;
5105 info.AuthorityCertIssuer.cAltEntry = 1;
5106 info.AuthorityCertIssuer.rgAltEntry = &entry;
5110 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
5111 /* With an issuer name */
5112 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
5113 entry.pwszURL = (LPWSTR)url;
5116 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5117 if (ret)
5118 {
5119 ok(size == sizeof(authorityKeyIdWithIssuerUrl), "Unexpected size %ld\n",
5120 size);
5122 "Unexpected value\n");
5123 LocalFree(buf);
5124 }
5125 /* With just a serial number */
5126 info.AuthorityCertIssuer.cAltEntry = 0;
5127 info.AuthorityCertSerialNumber.cbData = sizeof(serialNum);
5128 info.AuthorityCertSerialNumber.pbData = (BYTE *)serialNum;
5131 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5132 if (ret)
5133 {
5134 ok(size == sizeof(authorityKeyIdWithSerial), "Unexpected size %ld\n",
5135 size);
5136 ok(!memcmp(buf, authorityKeyIdWithSerial, size), "Unexpected value\n");
5137 LocalFree(buf);
5138 }
5139}

Referenced by START_TEST().

◆ test_encodeBasicConstraints()

static void test_encodeBasicConstraints ( DWORD  dwEncoding)
static

Definition at line 2167 of file encode.c.

2168{
2169 DWORD i, bufSize = 0;
2171 CERT_NAME_BLOB nameBlob = { sizeof(encodedDomainName),
2173 BOOL ret;
2174 BYTE *buf = NULL;
2175
2176 /* First test with the simpler info2 */
2177 for (i = 0; i < ARRAY_SIZE(constraints2); i++)
2178 {
2181 &bufSize);
2182 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2183 if (ret)
2184 {
2185 ok(bufSize == constraints2[i].encoded[1] + 2,
2186 "Expected %d bytes, got %ld\n", constraints2[i].encoded[1] + 2,
2187 bufSize);
2188 ok(!memcmp(buf, constraints2[i].encoded,
2189 constraints2[i].encoded[1] + 2), "Unexpected value\n");
2190 LocalFree(buf);
2191 }
2192 }
2193 /* Now test with more complex basic constraints */
2194 info.SubjectType.cbData = 0;
2195 info.fPathLenConstraint = FALSE;
2196 info.cSubtreesConstraint = 0;
2199 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2200 if (ret)
2201 {
2202 ok(bufSize == sizeof(emptyConstraint), "Wrong size %ld\n", bufSize);
2204 "Unexpected value\n");
2205 LocalFree(buf);
2206 }
2207 /* None of the certs I examined had any subtree constraint, but I test one
2208 * anyway just in case.
2209 */
2210 info.cSubtreesConstraint = 1;
2211 info.rgSubtreesConstraint = &nameBlob;
2214 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2215 if (ret)
2216 {
2217 ok(bufSize == sizeof(constraintWithDomainName), "Wrong size %ld\n", bufSize);
2219 sizeof(constraintWithDomainName)), "Unexpected value\n");
2220 LocalFree(buf);
2221 }
2222 /* FIXME: test encoding with subject type. */
2223}

Referenced by START_TEST().

◆ test_encodeBits()

static void test_encodeBits ( DWORD  dwEncoding)
static

Definition at line 2051 of file encode.c.

2052{
2053 DWORD i;
2054
2055 for (i = 0; i < ARRAY_SIZE(bits); i++)
2056 {
2058 BOOL ret;
2059 BYTE *buf = NULL;
2060 DWORD bufSize = 0;
2061
2062 blob.cbData = sizeof(bytesToEncode);
2063 blob.pbData = (BYTE *)bytesToEncode;
2064 blob.cUnusedBits = bits[i].cUnusedBits;
2065 ret = CryptEncodeObjectEx(dwEncoding, X509_BITS, &blob,
2067 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2068 if (ret)
2069 {
2070 ok(bufSize == bits[i].encoded[1] + 2,
2071 "%ld: Got unexpected size %ld, expected %d\n", i, bufSize,
2072 bits[i].encoded[1] + 2);
2073 ok(!memcmp(buf, bits[i].encoded, bits[i].encoded[1] + 2),
2074 "%ld: Unexpected value\n", i);
2075 LocalFree(buf);
2076 }
2077 }
2078}
static const BYTE bytesToEncode[]
Definition: encode.c:2026

Referenced by START_TEST().

◆ test_encodeCert()

static void test_encodeCert ( DWORD  dwEncoding)
static

Definition at line 3462 of file encode.c.

3463{
3464 /* Note the SignatureAlgorithm must match that in the encoded cert. Note
3465 * also that bigCert is a NULL-terminated string, so don't count its
3466 * last byte (otherwise the signed cert won't decode.)
3467 */
3468 CERT_SIGNED_CONTENT_INFO info = { { sizeof(bigCert), (BYTE *)bigCert },
3469 { NULL, { 0, NULL } }, { sizeof(hash), (BYTE *)hash, 0 } };
3470 BOOL ret;
3471 BYTE *buf = NULL;
3472 DWORD bufSize = 0;
3473
3474 ret = CryptEncodeObjectEx(dwEncoding, X509_CERT, &info,
3476 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3477 if (ret)
3478 {
3479 ok(bufSize == sizeof(signedBigCert), "Wrong size %ld\n", bufSize);
3480 ok(!memcmp(buf, signedBigCert, bufSize), "Unexpected cert\n");
3481 LocalFree(buf);
3482 }
3483}
static const BYTE hash[]
Definition: encode.c:3387

Referenced by START_TEST().

◆ test_encodeCertPolicies()

static void test_encodeCertPolicies ( DWORD  dwEncoding)
static

Definition at line 7523 of file encode.c.

7524{
7525 BOOL ret;
7529 LPBYTE buf;
7530 DWORD size;
7531
7532 memset(&info, 0, sizeof(info));
7535 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7536 if (ret)
7537 {
7538 ok(sizeof(emptySequence) == size, "unexpected size %ld\n", size);
7539 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
7540 LocalFree(buf);
7541 }
7542 memset(policy, 0, sizeof(policy));
7543 info.cPolicyInfo = 1;
7544 info.rgPolicyInfo = policy;
7548 "expected E_INVALIDARG, got %08lx\n", GetLastError());
7549 policy[0].pszPolicyIdentifier = oid_any_policy;
7552 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7553 if (ret)
7554 {
7555 ok(sizeof(policiesWithAnyPolicy) == size, "unexpected size %ld\n", size);
7556 ok(!memcmp(buf, policiesWithAnyPolicy, size), "unexpected value\n");
7557 LocalFree(buf);
7558 }
7559 policy[1].pszPolicyIdentifier = oid1;
7560 memset(&qualifier, 0, sizeof(qualifier));
7561 qualifier.pszPolicyQualifierId = oid_user_notice;
7562 qualifier.Qualifier.cbData = sizeof(noticeWithReference);
7563 qualifier.Qualifier.pbData = noticeWithReference;
7564 policy[1].cPolicyQualifier = 1;
7565 policy[1].rgPolicyQualifier = &qualifier;
7566 info.cPolicyInfo = 2;
7569 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7570 if (ret)
7571 {
7572 ok(sizeof(twoPolicies) == size, "unexpected size %ld\n", size);
7573 ok(!memcmp(buf, twoPolicies, size), "unexpected value\n");
7574 LocalFree(buf);
7575 }
7576}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:73
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:79

Referenced by START_TEST().

◆ test_encodeCertPolicyConstraints()

static void test_encodeCertPolicyConstraints ( DWORD  dwEncoding)
static

Definition at line 7808 of file encode.c.

7809{
7811 LPBYTE buf;
7812 DWORD size;
7813 BOOL ret;
7814
7815 /* Even though RFC 5280 explicitly states CAs must not issue empty
7816 * policy constraints (section 4.2.1.11), the API doesn't prevent it.
7817 */
7820 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7821 if (ret)
7822 {
7823 ok(size == sizeof(emptySequence), "unexpected size %ld\n", size);
7825 "unexpected value\n");
7826 LocalFree(buf);
7827 }
7828 /* If fRequireExplicitPolicy is set but dwRequireExplicitPolicySkipCerts
7829 * is not, then a skip of 0 is encoded.
7830 */
7831 info.fRequireExplicitPolicy = TRUE;
7834 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7835 if (ret)
7836 {
7838 "unexpected size %ld\n", size);
7840 sizeof(policyConstraintsWithRequireExplicit)), "unexpected value\n");
7841 LocalFree(buf);
7842 }
7843 /* With inhibit policy mapping */
7844 info.fRequireExplicitPolicy = FALSE;
7845 info.dwRequireExplicitPolicySkipCerts = 0;
7846 info.fInhibitPolicyMapping = TRUE;
7847 info.dwInhibitPolicyMappingSkipCerts = 1;
7850 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7851 if (ret)
7852 {
7854 "unexpected size %ld\n", size);
7856 sizeof(policyConstraintsWithInhibitMapping)), "unexpected value\n");
7857 LocalFree(buf);
7858 }
7859 /* And with both */
7860 info.fRequireExplicitPolicy = TRUE;
7861 info.dwRequireExplicitPolicySkipCerts = 1;
7864 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7865 if (ret)
7866 {
7867 ok(size == sizeof(policyConstraintsWithBoth), "unexpected size %ld\n",
7868 size);
7870 sizeof(policyConstraintsWithBoth)), "unexpected value\n");
7871 LocalFree(buf);
7872 }
7873}

Referenced by START_TEST().

◆ test_encodeCertPolicyMappings()

static void test_encodeCertPolicyMappings ( DWORD  dwEncoding)
static

Definition at line 7664 of file encode.c.

7665{
7666 static char oid2[] = "2.3.4";
7667 static char oid3[] = "1.3.4";
7668 static char oid4[] = "2.5.6";
7669 BOOL ret;
7672 LPBYTE buf;
7673 DWORD size, i;
7674
7675 /* Each of the mapping OIDs is equivalent, so check with all of them */
7676 for (i = 0; i < ARRAY_SIZE(mappingOids); i++)
7677 {
7678 memset(&info, 0, sizeof(info));
7679 ret = CryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7681 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7682 if (ret)
7683 {
7684 ok(size == sizeof(emptySequence), "unexpected size %ld\n", size);
7686 "unexpected value\n");
7687 LocalFree(buf);
7688 }
7689 mapping[0].pszIssuerDomainPolicy = NULL;
7690 mapping[0].pszSubjectDomainPolicy = NULL;
7691 info.cPolicyMapping = 1;
7692 info.rgPolicyMapping = mapping;
7693 SetLastError(0xdeadbeef);
7694 ret = CryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7697 "expected E_INVALIDARG, got %08lx\n", GetLastError());
7698 mapping[0].pszIssuerDomainPolicy = oid1;
7699 mapping[0].pszSubjectDomainPolicy = oid2;
7700 ret = CryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7702 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7703 if (ret)
7704 {
7706 "unexpected size %ld\n", size);
7708 "unexpected value\n");
7709 LocalFree(buf);
7710 }
7711 mapping[1].pszIssuerDomainPolicy = oid3;
7712 mapping[1].pszSubjectDomainPolicy = oid4;
7713 info.cPolicyMapping = 2;
7714 ret = CryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7716 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7717 if (ret)
7718 {
7720 "unexpected size %ld\n", size);
7722 "unexpected value\n");
7723 LocalFree(buf);
7724 }
7725 }
7726}
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031

Referenced by START_TEST().

◆ test_encodeCertToBeSigned()

static void test_encodeCertToBeSigned ( DWORD  dwEncoding)
static

Definition at line 3083 of file encode.c.

3084{
3085 BOOL ret;
3086 BYTE *buf = NULL;
3087 DWORD size = 0;
3088 CERT_INFO info = { 0 };
3089 static char oid_rsa_rsa[] = szOID_RSA_RSA;
3090 static char oid_subject_key_identifier[] = szOID_SUBJECT_KEY_IDENTIFIER;
3092
3093 /* Test with NULL pvStructInfo */
3097 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
3098
3099 /* Test with a V1 cert */
3102 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3103 if (ret)
3104 {
3105 ok(size == v1Cert[1] + 2, "Expected size %d, got %ld\n",
3106 v1Cert[1] + 2, size);
3107 ok(!memcmp(buf, v1Cert, size), "Got unexpected value\n");
3108 LocalFree(buf);
3109 }
3110 /* Test v2 cert */
3111 info.dwVersion = CERT_V2;
3114 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3115 if (ret)
3116 {
3117 ok(size == sizeof(v2Cert), "Wrong size %ld\n", size);
3118 ok(!memcmp(buf, v2Cert, size), "Got unexpected value\n");
3119 LocalFree(buf);
3120 }
3121 /* Test v3 cert */
3122 info.dwVersion = CERT_V3;
3125 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3126 if (ret)
3127 {
3128 ok(size == sizeof(v3Cert), "Wrong size %ld\n", size);
3129 ok(!memcmp(buf, v3Cert, size), "Got unexpected value\n");
3130 LocalFree(buf);
3131 }
3132 /* A v4 cert? */
3133 info.dwVersion = 3; /* Not a typo, CERT_V3 is 2 */
3136 if (ret)
3137 {
3138 ok(size == sizeof(v4Cert), "Wrong size %ld\n", size);
3139 ok(!memcmp(buf, v4Cert, size), "Unexpected value\n");
3140 LocalFree(buf);
3141 }
3142 /* see if a V1 cert can have basic constraints set (RFC3280 says no, but
3143 * API doesn't prevent it)
3144 */
3145 info.dwVersion = CERT_V1;
3146 info.cExtension = 1;
3147 info.rgExtension = &criticalExt;
3150 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3151 if (ret)
3152 {
3153 ok(size == sizeof(v1CertWithConstraints), "Wrong size %ld\n", size);
3154 ok(!memcmp(buf, v1CertWithConstraints, size), "Got unexpected value\n");
3155 LocalFree(buf);
3156 }
3157 /* test v1 cert with a serial number */
3158 info.SerialNumber.cbData = sizeof(serialNum);
3159 info.SerialNumber.pbData = (BYTE *)serialNum;
3162 if (ret)
3163 {
3164 ok(size == sizeof(v1CertWithSerial), "Wrong size %ld\n", size);
3165 ok(!memcmp(buf, v1CertWithSerial, size), "Got unexpected value\n");
3166 LocalFree(buf);
3167 }
3168 /* Test v1 cert with an issuer name, serial number, and issuer unique id */
3169 info.dwVersion = CERT_V1;
3170 info.cExtension = 0;
3171 info.IssuerUniqueId.cbData = sizeof(serialNum);
3172 info.IssuerUniqueId.pbData = (BYTE *)serialNum;
3175 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3176 if (ret)
3177 {
3178 ok(size == sizeof(v1CertWithIssuerUniqueId), "Wrong size %ld\n", size);
3180 "Got unexpected value\n");
3181 LocalFree(buf);
3182 }
3183 /* Test v1 cert with an issuer name, a subject name, and a serial number */
3184 info.IssuerUniqueId.cbData = 0;
3185 info.IssuerUniqueId.pbData = NULL;
3186 info.cExtension = 1;
3187 info.rgExtension = &criticalExt;
3188 info.Issuer.cbData = sizeof(encodedCommonName);
3189 info.Issuer.pbData = (BYTE *)encodedCommonName;
3190 info.Subject.cbData = sizeof(encodedCommonName);
3191 info.Subject.pbData = (BYTE *)encodedCommonName;
3194 if (ret)
3195 {
3196 ok(size == sizeof(bigCert), "Wrong size %ld\n", size);
3197 ok(!memcmp(buf, bigCert, size), "Got unexpected value\n");
3198 LocalFree(buf);
3199 }
3200 /* Add a public key */
3201 info.SubjectPublicKeyInfo.Algorithm.pszObjId = oid_rsa_rsa;
3202 info.SubjectPublicKeyInfo.PublicKey.cbData = sizeof(aKey);
3203 info.SubjectPublicKeyInfo.PublicKey.pbData = (LPBYTE)aKey;
3206 if (ret)
3207 {
3208 ok(size == sizeof(v1CertWithPubKey) ||
3209 size == sizeof(v1CertWithPubKeyNoNull), "Wrong size %ld\n", size);
3210 if (size == sizeof(v1CertWithPubKey))
3211 ok(!memcmp(buf, v1CertWithPubKey, size), "Got unexpected value\n");
3212 else if (size == sizeof(v1CertWithPubKeyNoNull))
3214 "Got unexpected value\n");
3215 LocalFree(buf);
3216 }
3217 /* Again add an issuer unique id */
3218 info.IssuerUniqueId.cbData = sizeof(serialNum);
3219 info.IssuerUniqueId.pbData = (BYTE *)serialNum;
3222 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3223 if (ret)
3224 {
3227 "Wrong size %ld\n", size);
3230 size), "unexpected value\n");
3231 else if (size ==
3233 ok(!memcmp(buf,
3235 "unexpected value\n");
3236 LocalFree(buf);
3237 }
3238 /* Remove the public key, and add a subject key identifier extension */
3239 info.IssuerUniqueId.cbData = 0;
3240 info.IssuerUniqueId.pbData = NULL;
3241 info.SubjectPublicKeyInfo.Algorithm.pszObjId = NULL;
3242 info.SubjectPublicKeyInfo.PublicKey.cbData = 0;
3243 info.SubjectPublicKeyInfo.PublicKey.pbData = NULL;
3244 ext.pszObjId = oid_subject_key_identifier;
3245 ext.fCritical = FALSE;
3246 ext.Value.cbData = sizeof(octetCommonNameValue);
3247 ext.Value.pbData = octetCommonNameValue;
3248 info.cExtension = 1;
3249 info.rgExtension = &ext;
3252 if (ret)
3253 {
3254 ok(size == sizeof(v1CertWithSubjectKeyId), "Wrong size %ld\n", size);
3255 ok(!memcmp(buf, v1CertWithSubjectKeyId, size), "Unexpected value\n");
3256 LocalFree(buf);
3257 }
3258}
static const BYTE v1CertWithPubKeyNoNull[]
Definition: encode.c:3030
static CERT_EXTENSION criticalExt
Definition: encode.c:2723
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull[]
Definition: encode.c:3068
static BYTE octetCommonNameValue[]
Definition: encode.c:1200
#define CERT_V3
Definition: wincrypt.h:2805
#define szOID_SUBJECT_KEY_IDENTIFIER
Definition: wincrypt.h:3340
#define CERT_V2
Definition: wincrypt.h:2804

Referenced by START_TEST().

◆ test_encodeCMSSignerInfo()

static void test_encodeCMSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6859 of file encode.c.

6860{
6861 BOOL ret;
6862 LPBYTE buf = NULL;
6863 DWORD size = 0;
6864 CMSG_CMS_SIGNER_INFO info = { 0 };
6865 static char oid1[] = "1.2.3", oid2[] = "1.5.6";
6866
6867 SetLastError(0xdeadbeef);
6870 ok(!ret, "Expected failure, got %d\n", ret);
6872 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6873 info.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
6874 SetLastError(0xdeadbeef);
6877 ok(!ret, "Expected failure, got %d\n", ret);
6879 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6880 /* To be encoded, a signer must have a valid cert ID, where a valid ID may
6881 * be a key id or an issuer serial number with at least the issuer set, and
6882 * the encoding must include PKCS_7_ASN_ENCODING.
6883 * (That isn't enough to be decoded, see decoding tests.)
6884 */
6885 info.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonNameNoNull);
6886 info.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonNameNoNull;
6887 SetLastError(0xdeadbeef);
6890 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6892 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6893 else
6894 {
6895 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6896 if (ret)
6897 {
6898 ok(size == sizeof(minimalPKCSSigner), "Unexpected size %ld\n", size);
6899 ok(!memcmp(buf, minimalPKCSSigner, size), "Unexpected value\n");
6900 LocalFree(buf);
6901 }
6902 }
6903 info.SignerId.IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
6904 info.SignerId.IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
6905 SetLastError(0xdeadbeef);
6908 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6910 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6911 else
6912 {
6913 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6914 if (ret)
6915 {
6916 ok(size == sizeof(PKCSSignerWithSerial), "Unexpected size %ld\n",
6917 size);
6918 ok(!memcmp(buf, PKCSSignerWithSerial, size), "Unexpected value\n");
6919 LocalFree(buf);
6920 }
6921 }
6922 info.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
6923 info.SignerId.KeyId.cbData = sizeof(serialNum);
6924 info.SignerId.KeyId.pbData = (BYTE *)serialNum;
6925 SetLastError(0xdeadbeef);
6928 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6930 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6931 else
6932 {
6933 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6934 if (ret)
6935 {
6936 ok(size == sizeof(CMSSignerWithKeyId), "Unexpected size %ld\n",
6937 size);
6938 ok(!memcmp(buf, CMSSignerWithKeyId, size), "Unexpected value\n");
6939 LocalFree(buf);
6940 }
6941 }
6942 /* While a CERT_ID can have a hash type, that's not allowed in CMS, where
6943 * only the IssuerAndSerialNumber and SubjectKeyIdentifier types are allowed
6944 * (see RFC 3852, section 5.3.)
6945 */
6946 info.SignerId.dwIdChoice = CERT_ID_SHA1_HASH;
6947 info.SignerId.HashId.cbData = sizeof(hash);
6948 info.SignerId.HashId.pbData = (BYTE *)hash;
6949 SetLastError(0xdeadbeef);
6953 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6954 /* Now with a hash algo */
6955 info.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
6956 info.SignerId.IssuerSerialNumber.Issuer.cbData = sizeof(encodedCommonNameNoNull);
6957 info.SignerId.IssuerSerialNumber.Issuer.pbData = encodedCommonNameNoNull;
6958 info.HashAlgorithm.pszObjId = oid1;
6959 SetLastError(0xdeadbeef);
6962 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6964 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6965 else
6966 {
6967 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6968 if (ret)
6969 {
6970 ok(size == sizeof(PKCSSignerWithHashAlgo), "Unexpected size %ld\n",
6971 size);
6973 "Unexpected value\n");
6974 LocalFree(buf);
6975 }
6976 }
6977 info.HashEncryptionAlgorithm.pszObjId = oid2;
6978 SetLastError(0xdeadbeef);
6981 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6983 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6984 else
6985 {
6986 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6987 if (ret)
6988 {
6990 "Unexpected size %ld\n", size);
6992 "Unexpected value\n");
6993 LocalFree(buf);
6994 }
6995 }
6996 info.EncryptedHash.cbData = sizeof(hash);
6997 info.EncryptedHash.pbData = (BYTE *)hash;
6998 SetLastError(0xdeadbeef);
7001 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
7003 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
7004 else
7005 {
7006 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
7007 if (ret)
7008 {
7009 ok(size == sizeof(PKCSSignerWithHash), "Unexpected size %ld\n",
7010 size);
7011 ok(!memcmp(buf, PKCSSignerWithHash, size), "Unexpected value\n");
7012 LocalFree(buf);
7013 }
7014 }
7015}
#define CERT_ID_SHA1_HASH
Definition: wincrypt.h:3840

Referenced by START_TEST().

◆ test_encodeCRLDistPoints()

static void test_encodeCRLDistPoints ( DWORD  dwEncoding)
static

Definition at line 3574 of file encode.c.

3575{
3576 CRL_DIST_POINTS_INFO info = { 0 };
3577 CRL_DIST_POINT point = { { 0 } };
3578 CERT_ALT_NAME_ENTRY entry = { 0 };
3579 BOOL ret;
3580 BYTE *buf = NULL;
3581 DWORD size = 0;
3582
3583 /* Test with an empty info */
3587 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3588 /* Test with one empty dist point */
3589 info.cDistPoint = 1;
3590 info.rgDistPoint = &point;
3593 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3594 if (ret)
3595 {
3596 ok(size == sizeof(emptyDistPoint), "Wrong size %ld\n", size);
3597 ok(!memcmp(buf, emptyDistPoint, size), "Unexpected value\n");
3598 LocalFree(buf);
3599 }
3600 /* A dist point with an invalid name */
3601 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3602 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3603 entry.pwszURL = (WCHAR *)L"http://\x226f\x575b";
3604 point.DistPointName.FullName.cAltEntry = 1;
3605 point.DistPointName.FullName.rgAltEntry = &entry;
3609 "Expected CRYPT_E_INVALID_IA5_STRING, got %08lx\n", GetLastError());
3610 /* The first invalid character is at index 7 */
3612 "Expected invalid char at index 7, got %ld\n",
3614 /* A dist point with (just) a valid name */
3615 entry.pwszURL = (LPWSTR)url;
3618 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3619 if (ret)
3620 {
3621 ok(size == sizeof(distPointWithUrl), "Wrong size %ld\n", size);
3622 ok(!memcmp(buf, distPointWithUrl, size), "Unexpected value\n");
3623 LocalFree(buf);
3624 }
3625 /* A dist point with (just) reason flags */
3626 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_NO_NAME;
3627 point.ReasonFlags.cbData = sizeof(crlReason);
3628 point.ReasonFlags.pbData = (LPBYTE)&crlReason;
3631 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3632 if (ret)
3633 {
3634 ok(size == sizeof(distPointWithReason), "Wrong size %ld\n", size);
3635 ok(!memcmp(buf, distPointWithReason, size), "Unexpected value\n");
3636 LocalFree(buf);
3637 }
3638 /* A dist point with just an issuer */
3639 point.ReasonFlags.cbData = 0;
3640 point.CRLIssuer.cAltEntry = 1;
3641 point.CRLIssuer.rgAltEntry = &entry;
3644 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3645 if (ret)
3646 {
3647 ok(size == sizeof(distPointWithIssuer), "Wrong size %ld\n", size);
3648 ok(!memcmp(buf, distPointWithIssuer, size), "Unexpected value\n");
3649 LocalFree(buf);
3650 }
3651 /* A dist point with both a name and an issuer */
3652 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3655 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3656 if (ret)
3657 {
3659 "Wrong size %ld\n", size);
3660 ok(!memcmp(buf, distPointWithUrlAndIssuer, size), "Unexpected value\n");
3661 LocalFree(buf);
3662 }
3663}
static const BYTE distPointWithIssuer[]
Definition: encode.c:3563

Referenced by START_TEST().

◆ test_encodeCRLIssuingDistPoint()

static void test_encodeCRLIssuingDistPoint ( DWORD  dwEncoding)
static

Definition at line 3796 of file encode.c.

3797{
3798 BOOL ret;
3799 BYTE *buf = NULL;
3800 DWORD size = 0;
3801 CRL_ISSUING_DIST_POINT point = { { 0 } };
3803
3807 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
3810 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3811 if (ret)
3812 {
3813 ok(size == sizeof(emptySequence), "Unexpected size %ld\n", size);
3814 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
3815 LocalFree(buf);
3816 }
3817 /* nonsensical flags */
3818 point.fOnlyContainsUserCerts = TRUE;
3819 point.fOnlyContainsCACerts = TRUE;
3822 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3823 if (ret)
3824 {
3825 ok(size == sizeof(badFlagsIDP), "Unexpected size %ld\n", size);
3826 ok(!memcmp(buf, badFlagsIDP, size), "Unexpected value\n");
3827 LocalFree(buf);
3828 }
3829 /* unimplemented name type */
3830 point.fOnlyContainsCACerts = point.fOnlyContainsUserCerts = FALSE;
3831 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_ISSUER_RDN_NAME;
3835 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
3836 /* empty name */
3837 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3838 point.DistPointName.FullName.cAltEntry = 0;
3841 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3842 if (ret)
3843 {
3844 ok(size == sizeof(emptyNameIDP), "Unexpected size %ld\n", size);
3845 ok(!memcmp(buf, emptyNameIDP, size), "Unexpected value\n");
3846 LocalFree(buf);
3847 }
3848 /* name with URL entry */
3849 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3850 entry.pwszURL = (LPWSTR)url;
3851 point.DistPointName.FullName.cAltEntry = 1;
3852 point.DistPointName.FullName.rgAltEntry = &entry;
3855 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
3856 if (ret)
3857 {
3858 ok(size == sizeof(urlIDP), "Unexpected size %ld\n", size);
3859 ok(!memcmp(buf, urlIDP, size), "Unexpected value\n");
3860 LocalFree(buf);
3861 }
3862}
#define CRL_DIST_POINT_ISSUER_RDN_NAME
Definition: wincrypt.h:524

Referenced by START_TEST().

◆ test_encodeCRLToBeSigned()

static void test_encodeCRLToBeSigned ( DWORD  dwEncoding)
static

Definition at line 4030 of file encode.c.

4031{
4032 BOOL ret;
4033 BYTE *buf = NULL;
4034 DWORD size = 0;
4035 CRL_INFO info = { 0 };
4036 CRL_ENTRY entry = { { 0 }, { 0 }, 0, 0 };
4037
4038 /* Test with a V1 CRL */
4041 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4042 if (ret)
4043 {
4044 ok(size == sizeof(v1CRL), "Wrong size %ld\n", size);
4045 ok(!memcmp(buf, v1CRL, size), "Got unexpected value\n");
4046 LocalFree(buf);
4047 }
4048 /* Test v2 CRL */
4049 info.dwVersion = CRL_V2;
4052 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4053 if (ret)
4054 {
4055 ok(size == v2CRL[1] + 2, "Expected size %d, got %ld\n",
4056 v2CRL[1] + 2, size);
4057 ok(!memcmp(buf, v2CRL, size), "Got unexpected value\n");
4058 LocalFree(buf);
4059 }
4060 /* v1 CRL with a name */
4061 info.dwVersion = CRL_V1;
4062 info.Issuer.cbData = sizeof(encodedCommonName);
4063 info.Issuer.pbData = (BYTE *)encodedCommonName;
4066 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4067 if (ret)
4068 {
4069 ok(size == sizeof(v1CRLWithIssuer), "Wrong size %ld\n", size);
4070 ok(!memcmp(buf, v1CRLWithIssuer, size), "Got unexpected value\n");
4071 LocalFree(buf);
4072 }
4073
4074 /* v1 CRL with a name and a NULL entry pointer */
4075 info.cCRLEntry = 1;
4079 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
4080
4081 /* now set an empty entry */
4082 info.cCRLEntry = 1;
4083 info.rgCRLEntry = &entry;
4086 if (ret)
4087 {
4089 "Wrong size %ld\n", size);
4091 "Got unexpected value\n");
4092 LocalFree(buf);
4093 }
4094 /* an entry with a serial number */
4095 entry.SerialNumber.cbData = sizeof(serialNum);
4096 entry.SerialNumber.pbData = (BYTE *)serialNum;
4099 if (ret)
4100 {
4101 ok(size == sizeof(v1CRLWithIssuerAndEntry),
4102 "Wrong size %ld\n", size);
4104 "Got unexpected value\n");
4105 LocalFree(buf);
4106 }
4107 /* an entry with an extension */
4108 entry.cExtension = 1;
4109 entry.rgExtension = &criticalExt;
4112 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4113 if (ret)
4114 {
4115 ok(size == sizeof(v1CRLWithEntryExt), "Wrong size %ld\n", size);
4116 ok(!memcmp(buf, v1CRLWithEntryExt, size), "Got unexpected value\n");
4117 LocalFree(buf);
4118 }
4119 /* a CRL with an extension */
4120 entry.cExtension = 0;
4121 info.cExtension = 1;
4122 info.rgExtension = &criticalExt;
4125 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4126 if (ret)
4127 {
4128 ok(size == sizeof(v1CRLWithExt), "Wrong size %ld\n", size);
4129 ok(!memcmp(buf, v1CRLWithExt, size), "Got unexpected value\n");
4130 LocalFree(buf);
4131 }
4132 /* a v2 CRL with an extension, this time non-critical */
4133 info.dwVersion = CRL_V2;
4134 info.rgExtension = &nonCriticalExt;
4137 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4138 if (ret)
4139 {
4140 ok(size == sizeof(v2CRLWithExt), "Wrong size %ld\n", size);
4141 ok(!memcmp(buf, v2CRLWithExt, size), "Got unexpected value\n");
4142 LocalFree(buf);
4143 }
4144}
static CERT_EXTENSION nonCriticalExt
Definition: encode.c:2725
static const BYTE v1CRLWithEntryExt[]
Definition: encode.c:4008
#define CRL_V2
Definition: wincrypt.h:2826
#define CRL_V1
Definition: wincrypt.h:2825

Referenced by START_TEST().

◆ test_encodeCTL()

static void test_encodeCTL ( DWORD  dwEncoding)
static

Definition at line 5445 of file encode.c.

5446{
5447 static char oid1[] = "1.2.3";
5448 static char oid2[] = "1.5.6";
5449 char *pOid1 = oid1;
5450 BOOL ret;
5451 BYTE *buf = NULL;
5452 DWORD size = 0;
5453 CTL_INFO info;
5454 SYSTEMTIME thisUpdate = { 2005, 6, 1, 6, 16, 10, 0, 0 };
5455 CTL_ENTRY ctlEntry[2];
5456 CRYPT_ATTRIBUTE attr1, attr2;
5457 CRYPT_ATTR_BLOB value1, value2;
5458
5459 memset(&info, 0, sizeof(info));
5460 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5462 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5463 if (ret)
5464 {
5465 ok(size == sizeof(emptyCTL), "unexpected size %ld\n", size);
5466 ok(!memcmp(buf, emptyCTL, size), "unexpected value\n");
5467 LocalFree(buf);
5468 buf = NULL;
5469 }
5470 info.dwVersion = 1;
5471 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5473 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5474 if (ret)
5475 {
5476 ok(size == sizeof(emptyCTLWithVersion1), "unexpected size %ld\n", size);
5477 ok(!memcmp(buf, emptyCTLWithVersion1, size), "unexpected value\n");
5478 LocalFree(buf);
5479 buf = NULL;
5480 }
5481 info.dwVersion = 0;
5482 info.SubjectUsage.cUsageIdentifier = 1;
5483 info.SubjectUsage.rgpszUsageIdentifier = &pOid1;
5484 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5486 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5487 if (ret)
5488 {
5489 ok(size == sizeof(ctlWithUsageIdentifier), "unexpected size %ld\n",
5490 size);
5491 ok(!memcmp(buf, ctlWithUsageIdentifier, size), "unexpected value\n");
5492 LocalFree(buf);
5493 buf = NULL;
5494 }
5495 info.SubjectUsage.cUsageIdentifier = 0;
5496 info.ListIdentifier.cbData = sizeof(serialNum);
5497 info.ListIdentifier.pbData = (LPBYTE)serialNum;
5498 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5500 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5501 if (ret)
5502 {
5503 ok(size == sizeof(ctlWithListIdentifier), "unexpected size %ld\n", size);
5504 ok(!memcmp(buf, ctlWithListIdentifier, size), "unexpected value\n");
5505 LocalFree(buf);
5506 buf = NULL;
5507 }
5508 info.ListIdentifier.cbData = 0;
5509 info.SequenceNumber.cbData = sizeof(serialNum);
5510 info.SequenceNumber.pbData = (LPBYTE)serialNum;
5511 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5513 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5514 if (ret)
5515 {
5516 ok(size == sizeof(ctlWithSequenceNumber), "unexpected size %ld\n",
5517 size);
5518 ok(!memcmp(buf, ctlWithSequenceNumber, size), "unexpected value\n");
5519 LocalFree(buf);
5520 buf = NULL;
5521 }
5522 info.SequenceNumber.cbData = 0;
5523 SystemTimeToFileTime(&thisUpdate, &info.ThisUpdate);
5524 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5526 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5527 if (ret)
5528 {
5529 ok(size == sizeof(ctlWithThisUpdate), "unexpected size %ld\n", size);
5530 ok(!memcmp(buf, ctlWithThisUpdate, size), "unexpected value\n");
5531 LocalFree(buf);
5532 buf = NULL;
5533 }
5534 SystemTimeToFileTime(&thisUpdate, &info.NextUpdate);
5535 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5537 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5538 if (ret)
5539 {
5540 ok(size == sizeof(ctlWithThisAndNextUpdate), "unexpected size %ld\n",
5541 size);
5542 ok(!memcmp(buf, ctlWithThisAndNextUpdate, size), "unexpected value\n");
5543 LocalFree(buf);
5544 buf = NULL;
5545 }
5546 info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0;
5547 info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0;
5548 info.SubjectAlgorithm.pszObjId = oid2;
5549 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5551 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5552 if (ret)
5553 {
5554 ok(size == sizeof(ctlWithAlgId), "unexpected size %ld\n", size);
5555 ok(!memcmp(buf, ctlWithAlgId, size), "unexpected value\n");
5556 LocalFree(buf);
5557 buf = NULL;
5558 }
5559 /* The value is supposed to be asn.1 encoded, so this'll fail to decode
5560 * (see tests below) but it'll encode fine.
5561 */
5562 info.SubjectAlgorithm.pszObjId = NULL;
5563 value1.cbData = sizeof(serialNum);
5564 value1.pbData = (LPBYTE)serialNum;
5565 attr1.pszObjId = oid1;
5566 attr1.cValue = 1;
5567 attr1.rgValue = &value1;
5568 ctlEntry[0].SubjectIdentifier.cbData = sizeof(serialNum);
5570 ctlEntry[0].cAttribute = 1;
5571 ctlEntry[0].rgAttribute = &attr1;
5572 info.cCTLEntry = 1;
5573 info.rgCTLEntry = ctlEntry;
5574 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5576 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5577 if (ret)
5578 {
5579 ok(size == sizeof(ctlWithBogusEntry), "unexpected size %ld\n", size);
5580 ok(!memcmp(buf, ctlWithBogusEntry, size), "unexpected value\n");
5581 LocalFree(buf);
5582 buf = NULL;
5583 }
5584 value1.cbData = sizeof(emptySequence);
5585 value1.pbData = (LPBYTE)emptySequence;
5586 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5588 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5589 if (ret)
5590 {
5591 ok(size == sizeof(ctlWithOneEntry), "unexpected size %ld\n", size);
5592 ok(!memcmp(buf, ctlWithOneEntry, size), "unexpected value\n");
5593 LocalFree(buf);
5594 buf = NULL;
5595 }
5596 value2.cbData = sizeof(encodedIPAddr);
5597 value2.pbData = (LPBYTE)encodedIPAddr;
5598 attr2.pszObjId = oid2;
5599 attr2.cValue = 1;
5600 attr2.rgValue = &value2;
5601 ctlEntry[1].SubjectIdentifier.cbData = sizeof(serialNum);
5603 ctlEntry[1].cAttribute = 1;
5604 ctlEntry[1].rgAttribute = &attr2;
5605 info.cCTLEntry = 2;
5606 ret = CryptEncodeObjectEx(dwEncoding, PKCS_CTL, &info,
5608 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
5609 if (ret)
5610 {
5611 ok(size == sizeof(ctlWithTwoEntries), "unexpected size %ld\n", size);
5612 ok(!memcmp(buf, ctlWithTwoEntries, size), "unexpected value\n");
5613 LocalFree(buf);
5614 buf = NULL;
5615 }
5616}

Referenced by START_TEST().

◆ test_encodeEnhancedKeyUsage()

static void test_encodeEnhancedKeyUsage ( DWORD  dwEncoding)
static

Definition at line 4841 of file encode.c.

4842{
4843 BOOL ret;
4844 BYTE *buf = NULL;
4845 DWORD size = 0;
4847
4848 /* Test with empty usage */
4849 usage.cUsageIdentifier = 0;
4852 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4853 if (ret)
4854 {
4855 ok(size == sizeof(emptySequence), "Wrong size %ld\n", size);
4856 ok(!memcmp(buf, emptySequence, size), "Got unexpected value\n");
4857 LocalFree(buf);
4858 }
4859 /* Test with a few usages */
4860 usage.cUsageIdentifier = ARRAY_SIZE(keyUsages);
4861 usage.rgpszUsageIdentifier = (LPSTR *)keyUsages;
4864 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
4865 if (ret)
4866 {
4867 ok(size == sizeof(encodedUsage), "Wrong size %ld\n", size);
4868 ok(!memcmp(buf, encodedUsage, size), "Got unexpected value\n");
4869 LocalFree(buf);
4870 }
4871}
char * LPSTR
Definition: xmlstorage.h:182

Referenced by START_TEST().

◆ test_encodeEnumerated()

static void test_encodeEnumerated ( DWORD  dwEncoding)
static

Definition at line 372 of file encode.c.

373{
374 DWORD i, j;
375
376 for (i = 0; i < ARRAY_SIZE(enumeratedTypes); i++)
377 {
378 for (j = 0; j < ARRAY_SIZE(enums); j++)
379 {
380 BOOL ret;
381 BYTE *buf = NULL;
382 DWORD bufSize = 0;
383
386 &bufSize);
387 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
388 if (ret)
389 {
390 ok(buf[0] == 0xa,
391 "Got unexpected type %d for enumerated (expected 0xa)\n",
392 buf[0]);
393 ok(buf[1] == enums[j].encoded[1],
394 "Got length %d, expected %d\n", buf[1], enums[j].encoded[1]);
395 ok(!memcmp(buf + 1, enums[j].encoded + 1,
396 enums[j].encoded[1] + 1),
397 "Encoded value of 0x%08x didn't match expected\n",
398 enums[j].val);
399 LocalFree(buf);
400 }
401 }
402 }
403}

Referenced by START_TEST().

◆ test_encodeExtensions()

static void test_encodeExtensions ( DWORD  dwEncoding)
static

Definition at line 2745 of file encode.c.

2746{
2747 DWORD i;
2748
2749 for (i = 0; i < ARRAY_SIZE(exts); i++)
2750 {
2751 BOOL ret;
2752 BYTE *buf = NULL;
2753 DWORD bufSize = 0;
2754
2757 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2758 if (ret)
2759 {
2760 ok(bufSize == exts[i].encoded[1] + 2,
2761 "Expected %d bytes, got %ld\n", exts[i].encoded[1] + 2, bufSize);
2762 ok(!memcmp(buf, exts[i].encoded, exts[i].encoded[1] + 2),
2763 "Unexpected value\n");
2764 LocalFree(buf);
2765 }
2766 }
2767}

Referenced by START_TEST().

◆ test_encodeFiletime()

static void test_encodeFiletime ( DWORD  dwEncoding)
static

Definition at line 547 of file encode.c.

548{
549 DWORD i;
550
551 for (i = 0; i < ARRAY_SIZE(times); i++)
552 {
554 testTimeEncoding(dwEncoding, PKCS_UTC_TIME, &times[i]);
556 }
557}
static void testTimeEncoding(DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
Definition: encode.c:435

Referenced by START_TEST().

◆ test_encodeInt()

static void test_encodeInt ( DWORD  dwEncoding)
static

Definition at line 93 of file encode.c.

94{
95 DWORD bufSize = 0;
96 int i;
97 BOOL ret;
99 BYTE *buf = NULL;
100
101 /* CryptEncodeObjectEx with NULL bufSize crashes..
102 ret = CryptEncodeObjectEx(3, X509_INTEGER, &ints[0].val, 0, NULL, NULL,
103 NULL);
104 */
105 /* check bogus encoding */
107 &bufSize);
109 "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
110
111 ret = CryptEncodeObjectEx(dwEncoding, X509_INTEGER, NULL, 0, NULL, NULL,
112 &bufSize);
114 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
115
116 for (i = 0; i < ARRAY_SIZE(ints); i++)
117 {
118 /* encode as normal integer */
119 ret = CryptEncodeObjectEx(dwEncoding, X509_INTEGER, &ints[i].val, 0,
120 NULL, NULL, &bufSize);
121 ok(ret, "Expected success, got %ld\n", GetLastError());
122 ret = CryptEncodeObjectEx(dwEncoding, X509_INTEGER, &ints[i].val,
124 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
125 if (ret)
126 {
127 ok(buf[0] == 2, "Got unexpected type %d for integer (expected 2)\n",
128 buf[0]);
129 ok(buf[1] == ints[i].encoded[1], "Got length %d, expected %d\n",
130 buf[1], ints[i].encoded[1]);
131 ok(!memcmp(buf + 1, ints[i].encoded + 1, ints[i].encoded[1] + 1),
132 "Encoded value of 0x%08x didn't match expected\n", ints[i].val);
133 LocalFree(buf);
134 }
135 /* encode as multibyte integer */
136 blob.cbData = sizeof(ints[i].val);
137 blob.pbData = (BYTE *)&ints[i].val;
139 0, NULL, NULL, &bufSize);
140 ok(ret, "Expected success, got %ld\n", GetLastError());
143 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
144 if (ret)
145 {
146 ok(buf[0] == 2, "Got unexpected type %d for integer (expected 2)\n",
147 buf[0]);
148 ok(buf[1] == ints[i].encoded[1], "Got length %d, expected %d\n",
149 buf[1], ints[i].encoded[1]);
150 ok(!memcmp(buf + 1, ints[i].encoded + 1, ints[i].encoded[1] + 1),
151 "Encoded value of 0x%08x didn't match expected\n", ints[i].val);
152 LocalFree(buf);
153 }
154 }
155 /* encode a couple bigger ints, just to show it's little-endian and leading
156 * sign bytes are dropped
157 */
158 for (i = 0; i < ARRAY_SIZE(bigInts); i++)
159 {
160 blob.cbData = strlen((const char*)bigInts[i].val);
161 blob.pbData = (BYTE *)bigInts[i].val;
163 0, NULL, NULL, &bufSize);
164 ok(ret, "Expected success, got %ld\n", GetLastError());
167 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
168 if (ret)
169 {
170 ok(buf[0] == 2, "Got unexpected type %d for integer (expected 2)\n",
171 buf[0]);
172 ok(buf[1] == bigInts[i].encoded[1], "Got length %d, expected %d\n",
173 buf[1], bigInts[i].encoded[1]);
174 ok(!memcmp(buf + 1, bigInts[i].encoded + 1,
175 bigInts[i].encoded[1] + 1),
176 "Encoded value didn't match expected\n");
177 LocalFree(buf);
178 }
179 }
180 /* and, encode some uints */
181 for (i = 0; i < ARRAY_SIZE(bigUInts); i++)
182 {
183 blob.cbData = strlen((const char*)bigUInts[i].val);
184 blob.pbData = (BYTE*)bigUInts[i].val;
186 0, NULL, NULL, &bufSize);
187 ok(ret, "Expected success, got %ld\n", GetLastError());
190 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
191 if (ret)
192 {
193 ok(buf[0] == 2, "Got unexpected type %d for integer (expected 2)\n",
194 buf[0]);
195 ok(buf[1] == bigUInts[i].encoded[1], "Got length %d, expected %d\n",
196 buf[1], bigUInts[i].encoded[1]);
197 ok(!memcmp(buf + 1, bigUInts[i].encoded + 1,
198 bigUInts[i].encoded[1] + 1),
199 "Encoded value didn't match expected\n");
200 LocalFree(buf);
201 }
202 }
203}

Referenced by START_TEST().

◆ test_encodeName()

static void test_encodeName ( DWORD  dwEncoding)
static

Definition at line 726 of file encode.c.

727{
728 CERT_RDN_ATTR attrs[2];
729 CERT_RDN rdn;
731 static CHAR oid_common_name[] = szOID_COMMON_NAME,
732 oid_sur_name[] = szOID_SUR_NAME;
733 BYTE *buf = NULL;
734 DWORD size = 0;
735 BOOL ret;
736
737 /* Test with NULL pvStructInfo */
738 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, NULL,
741 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
742
743 /* Test with empty CERT_NAME_INFO */
744 info.cRDN = 0;
745 info.rgRDN = NULL;
746 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
748 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
749 if (ret)
750 {
752 "Got unexpected encoding for empty name\n");
753 LocalFree(buf);
754 }
755
756 /* Test with bogus CERT_RDN */
757 info.cRDN = 1;
758 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
761 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
762
763 /* Test with empty CERT_RDN */
764 rdn.cRDNAttr = 0;
765 rdn.rgRDNAttr = NULL;
766 info.cRDN = 1;
767 info.rgRDN = &rdn;
768 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
770 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
771 if (ret)
772 {
773 ok(!memcmp(buf, emptyRDNs, sizeof(emptyRDNs)),
774 "Got unexpected encoding for empty RDN array\n");
775 LocalFree(buf);
776 }
777
778 /* Test with bogus attr array */
779 rdn.cRDNAttr = 1;
780 rdn.rgRDNAttr = NULL;
781 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
784 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
785
786 /* Check with two CERT_RDN_ATTRs. Note DER encoding forces the order of
787 * the encoded attributes to be swapped.
788 */
789 attrs[0].pszObjId = oid_common_name;
791 attrs[0].Value.cbData = sizeof(commonName);
792 attrs[0].Value.pbData = (BYTE *)commonName;
793 attrs[1].pszObjId = oid_sur_name;
795 attrs[1].Value.cbData = sizeof(surName);
796 attrs[1].Value.pbData = (BYTE *)surName;
797 rdn.cRDNAttr = 2;
798 rdn.rgRDNAttr = attrs;
799 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
801 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
802 if (ret)
803 {
804 ok(!memcmp(buf, twoRDNs, sizeof(twoRDNs)),
805 "Got unexpected encoding for two RDN array\n");
806 LocalFree(buf);
807 }
808 /* A name can be "encoded" with previously encoded RDN attrs. */
810 attrs[0].Value.pbData = (LPBYTE)twoRDNs;
811 attrs[0].Value.cbData = sizeof(twoRDNs);
812 rdn.cRDNAttr = 1;
813 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
815 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
816 if (ret)
817 {
818 ok(size == sizeof(encodedTwoRDNs), "Unexpected size %ld\n", size);
820 "Unexpected value for re-encoded two RDN array\n");
821 LocalFree(buf);
822 }
823 /* CERT_RDN_ANY_TYPE is too vague for X509_NAMEs, check the return */
824 rdn.cRDNAttr = 1;
826 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
829 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
830 /* Test a more complex name */
832 rdn.rgRDNAttr = rdnAttrs;
833 info.cRDN = 1;
834 info.rgRDN = &rdn;
835 buf = NULL;
836 size = 0;
839 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
840 if (ret)
841 {
842 ok(size == sizeof(encodedRDNAttrs), "Wrong size %ld\n", size);
843 ok(!memcmp(buf, encodedRDNAttrs, size), "Unexpected value\n");
844 LocalFree(buf);
845 }
846}
static const BYTE encodedTwoRDNs[]
Definition: encode.c:664
static CERT_RDN_ATTR rdnAttrs[]
Definition: encode.c:695
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:267
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2923

Referenced by START_TEST().

◆ test_encodeNameConstraints()

static void test_encodeNameConstraints ( DWORD  dwEncoding)
static

Definition at line 7192 of file encode.c.

7193{
7194 BOOL ret;
7195 CERT_NAME_CONSTRAINTS_INFO constraints = { 0 };
7196 CERT_GENERAL_SUBTREE permitted = { { 0 } };
7197 CERT_GENERAL_SUBTREE excluded = { { 0 } };
7198 LPBYTE buf;
7199 DWORD size;
7200
7201 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7203 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7204 if (ret)
7205 {
7206 ok(size == sizeof(emptySequence), "Unexpected size\n");
7207 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
7208 LocalFree(buf);
7209 }
7210 constraints.cPermittedSubtree = 1;
7211 constraints.rgPermittedSubtree = &permitted;
7212 SetLastError(0xdeadbeef);
7213 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7216 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
7218 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7220 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7221 if (ret)
7222 {
7223 ok(size == sizeof(emptyDNSPermittedConstraints), "Unexpected size\n");
7225 "Unexpected value\n");
7226 LocalFree(buf);
7227 }
7228 constraints.cPermittedSubtree = 0;
7229 constraints.cExcludedSubtree = 1;
7230 constraints.rgExcludedSubtree = &excluded;
7232 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7234 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7235 if (ret)
7236 {
7237 ok(size == sizeof(emptyDNSExcludedConstraints), "Unexpected size\n");
7239 "Unexpected value\n");
7240 LocalFree(buf);
7241 }
7242 excluded.Base.pwszURL = (LPWSTR)url;
7243 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7245 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7246 if (ret)
7247 {
7248 ok(size == sizeof(DNSExcludedConstraints), "Unexpected size\n");
7250 "Unexpected value\n");
7251 LocalFree(buf);
7252 }
7254 permitted.Base.IPAddress.cbData = sizeof(encodedIPAddr);
7256 constraints.cPermittedSubtree = 1;
7257 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7259 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7260 if (ret)
7261 {
7263 "Unexpected size\n");
7265 "Unexpected value\n");
7266 LocalFree(buf);
7267 }
7268 permitted.dwMinimum = 5;
7269 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7271 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7272 if (ret)
7273 {
7275 "Unexpected size\n");
7277 "Unexpected value\n");
7278 LocalFree(buf);
7279 }
7280 permitted.fMaximum = TRUE;
7281 permitted.dwMaximum = 3;
7282 SetLastError(0xdeadbeef);
7283 ret = CryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7285 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7286 if (ret)
7287 {
7289 "Unexpected size\n");
7291 "Unexpected value\n");
7292 LocalFree(buf);
7293 }
7294}
static BYTE emptyDNSPermittedConstraints[]
Definition: encode.c:7172
static BYTE emptyDNSExcludedConstraints[]
Definition: encode.c:7174
static BYTE DNSExcludedConstraints[]
Definition: encode.c:7176
static BYTE permittedAndExcludedWithMinMaxConstraints[]
Definition: encode.c:7187
static BYTE permittedAndExcludedConstraints[]
Definition: encode.c:7179
static BYTE permittedAndExcludedWithMinConstraints[]
Definition: encode.c:7183

Referenced by START_TEST().

◆ test_encodeNameValue()

static void test_encodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1268 of file encode.c.

1269{
1270 BYTE *buf = NULL;
1271 DWORD size = 0, i;
1272 BOOL ret;
1273 CERT_NAME_VALUE value = { 0, { 0, NULL } };
1274
1275 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1276 value.Value.pbData = printableCommonNameValue;
1277 value.Value.cbData = sizeof(printableCommonNameValue);
1280 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
1281 if (ret)
1282 {
1283 ok(size == sizeof(printableCommonNameValue), "Unexpected size %ld\n",
1284 size);
1286 "Unexpected encoding\n");
1287 LocalFree(buf);
1288 }
1289 for (i = 0; i < ARRAY_SIZE(nameValues); i++)
1290 {
1293 ok(ret, "Type %ld: CryptEncodeObjectEx failed: %08lx\n",
1294 nameValues[i].value.dwValueType, GetLastError());
1295 if (ret)
1296 {
1297 ok(size == nameValues[i].encodedSize,
1298 "Expected size %ld, got %ld\n", nameValues[i].encodedSize, size);
1299 ok(!memcmp(buf, nameValues[i].encoded, size),
1300 "Got unexpected encoding\n");
1301 LocalFree(buf);
1302 }
1303 }
1306 ok(ret, "Type %ld: CryptEncodeObjectEx failed: %08lx\n",
1307 embeddedNullNameValue.value.dwValueType, GetLastError());
1308 if (ret)
1309 {
1310 ok(size == embeddedNullNameValue.encodedSize,
1311 "Expected size %ld, got %ld\n", embeddedNullNameValue.encodedSize, size);
1313 "Got unexpected encoding\n");
1314 LocalFree(buf);
1315 }
1316}
static BYTE printableCommonNameValue[]
Definition: encode.c:1204

Referenced by START_TEST().

◆ test_encodeOCSPRequestInfo()

static void test_encodeOCSPRequestInfo ( DWORD  dwEncoding)
static

Definition at line 8422 of file encode.c.

8423{
8424 static const BYTE expected[] =
8425 {0x30, 0x68, 0xa1, 0x17, 0x82, 0x15, 0x2a, 0x2e, 0x63, 0x6d, 0x2e, 0x73, 0x74, 0x65, 0x61, 0x6d,
8426 0x70, 0x6f, 0x77, 0x65, 0x72, 0x65, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x4d, 0x30, 0x4b, 0x30,
8427 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xe4, 0xe3,
8428 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98 ,0x0c, 0x0b, 0x4e, 0xc0, 0x09, 0x8a,
8429 0xab, 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda,
8430 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10, 0xb1, 0xc1, 0x87, 0x54, 0x54, 0xac,
8431 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08};
8432 static const BYTE expected2[] =
8433 {0x30, 0x81, 0xb6, 0xa1, 0x17, 0x82, 0x15, 0x2a, 0x2e, 0x63, 0x6d, 0x2e, 0x73, 0x74, 0x65, 0x61,
8434 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x65, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x81, 0x9a, 0x30,
8435 0x4b, 0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14,
8436 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0,
8437 0x09, 0x8a, 0xab, 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea,
8438 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10, 0xb1, 0xc1, 0x87, 0x54,
8439 0x54, 0xac, 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08, 0x30, 0x4b, 0x30, 0x49,
8440 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xe4, 0xe3, 0x95,
8441 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0, 0x09, 0x8a, 0xab,
8442 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f,
8443 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10, 0xb1, 0xc1, 0x87, 0x54, 0x54, 0xac, 0x1e,
8444 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08};
8445 static const BYTE expected3[] =
8446 {0x30, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30, 0x4b, 0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e,
8447 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3,
8448 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0, 0x09, 0x8a, 0xab, 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2,
8449 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9,
8450 0xf4, 0x02, 0x10, 0xb1, 0xc1, 0x87, 0x54, 0x54, 0xac, 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d,
8451 0x8f, 0x49, 0x08, 0x30, 0x4b, 0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a,
8452 0x05, 0x00, 0x04, 0x14, 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98,
8453 0x0c, 0x0b, 0x4e, 0xc0, 0x09, 0x8a, 0xab, 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa,
8454 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10,
8455 0xb1, 0xc1, 0x87, 0x54, 0x54, 0xac, 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08};
8456 static const BYTE expected4[] =
8457 {0x30, 0x6a, 0x30, 0x68, 0xa1, 0x17, 0x82, 0x15, 0x2a, 0x2e, 0x63, 0x6d, 0x2e, 0x73, 0x74, 0x65,
8458 0x61, 0x6d, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x65, 0x64, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x4d, 0x30,
8459 0x4b, 0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14,
8460 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0,
8461 0x09, 0x8a, 0xab, 0xd8, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea,
8462 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10, 0xb1, 0xc1, 0x87, 0x54,
8463 0x54, 0xac, 0x1e, 0x55, 0x40, 0xfb, 0xef, 0xd9, 0x6d, 0x8f, 0x49, 0x08};
8464 static const BYTE issuer_name[] =
8465 {0xe4, 0xe3 ,0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3, 0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0,
8466 0x09, 0x8a, 0xab, 0xd8};
8467 static const BYTE issuer_key[] =
8468 {0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5,
8469 0x95, 0x76, 0xb9, 0xf4};
8470 static const BYTE serial[] =
8471 {0x08, 0x49, 0x8f, 0x6d, 0xd9, 0xef, 0xfb, 0x40, 0x55, 0x1e, 0xac, 0x54, 0x54, 0x87, 0xc1, 0xb1};
8475 OCSP_SIGNED_REQUEST_INFO info_signed;
8476 DWORD size;
8477 BYTE *buf, *buf2;
8478 BOOL ret;
8479
8480 memset(&entry, 0, sizeof(entry));
8481 entry[0].CertId.HashAlgorithm.pszObjId = (char *)szOID_OIWSEC_sha1;
8482 entry[0].CertId.IssuerNameHash.cbData = sizeof(issuer_name);
8483 entry[0].CertId.IssuerNameHash.pbData = (BYTE *)issuer_name;
8484 entry[0].CertId.IssuerKeyHash.cbData = sizeof(issuer_key);
8485 entry[0].CertId.IssuerKeyHash.pbData = (BYTE *)issuer_key;
8486 entry[0].CertId.SerialNumber.cbData = sizeof(serial);
8487 entry[0].CertId.SerialNumber.pbData = (BYTE *)serial;
8488
8489 name.dwAltNameChoice = CERT_ALT_NAME_DNS_NAME;
8490 name.pwszDNSName = (WCHAR *)L"*.cm.steampowered.com";
8491
8492 info.dwVersion = OCSP_REQUEST_V1;
8493 info.pRequestorName = &name;
8494 info.cRequestEntry = 1;
8495 info.rgRequestEntry = entry;
8496 info.cExtension = 0;
8497 info.rgExtension = NULL;
8498
8499 size = 0;
8500 SetLastError(0xdeadbeef);
8502 ok(ret, "got %08lx\n", GetLastError());
8503 ok(size == sizeof(expected), "got %lu\n", size);
8504 ok(!memcmp(buf, expected, sizeof(expected)), "unexpected value\n");
8505
8506 /* wrapped in OCSP_SIGNED_REQUEST_INFO */
8507 info_signed.ToBeSigned.cbData = size;
8508 info_signed.ToBeSigned.pbData = buf;
8509 info_signed.pOptionalSignatureInfo = NULL;
8510 size = 0;
8511 SetLastError(0xdeadbeef);
8513 &buf2, &size);
8514 ok(ret, "got %08lx\n", GetLastError());
8515 ok(size == sizeof(expected4), "got %lu\n", size);
8516 ok(!memcmp(buf2, expected4, sizeof(expected4)), "unexpected value\n");
8517 LocalFree(buf);
8518 LocalFree(buf2);
8519
8520 /* two entries */
8521 entry[1].CertId.HashAlgorithm.pszObjId = (char *)szOID_OIWSEC_sha1;
8522 entry[1].CertId.IssuerNameHash.cbData = sizeof(issuer_name);
8523 entry[1].CertId.IssuerNameHash.pbData = (BYTE *)issuer_name;
8524 entry[1].CertId.IssuerKeyHash.cbData = sizeof(issuer_key);
8525 entry[1].CertId.IssuerKeyHash.pbData = (BYTE *)issuer_key;
8526 entry[1].CertId.SerialNumber.cbData = sizeof(serial);
8527 entry[1].CertId.SerialNumber.pbData = (BYTE *)serial;
8528 info.cRequestEntry = 2;
8529
8530 size = 0;
8531 SetLastError(0xdeadbeef);
8533 ok(ret, "got %08lx\n", GetLastError());
8534 ok(size == sizeof(expected2), "got %lu\n", size);
8535 ok(!memcmp(buf, expected2, sizeof(expected2)), "unexpected value\n");
8536 LocalFree(buf);
8537
8538 /* requestor name not set */
8539 info.pRequestorName = NULL;
8540 size = 0;
8541 SetLastError(0xdeadbeef);
8543 ok(ret, "got %08lx\n", GetLastError());
8544 ok(size == sizeof(expected3), "got %lu\n", size);
8545 ok(!memcmp(buf, expected3, sizeof(expected3)), "unexpected value\n");
8546 LocalFree(buf);
8547}
Definition: wincrypt.h:654
POCSP_SIGNATURE_INFO pOptionalSignatureInfo
Definition: wincrypt.h:644
CRYPT_DER_BLOB ToBeSigned
Definition: wincrypt.h:643
Definition: name.c:39
#define OCSP_REQUEST_V1
Definition: wincrypt.h:660
#define OCSP_REQUEST
Definition: wincrypt.h:3588
#define OCSP_SIGNED_REQUEST
Definition: wincrypt.h:3587

Referenced by START_TEST().

◆ test_encodeOctets()

static void test_encodeOctets ( DWORD  dwEncoding)
static

Definition at line 1896 of file encode.c.

1897{
1899 DWORD i;
1900
1901 static const struct {
1902 const BYTE *decoded;
1904 const BYTE *encoded;
1905 UINT encoded_size;
1906 } tests[] = {
1907 {
1910 },{
1913 },{
1916 }
1917 };
1918
1919 for (i = 0; i < ARRAY_SIZE(tests); i++)
1920 {
1921 BYTE *buf = NULL;
1922 BOOL ret;
1923 DWORD bufSize = 0;
1924
1925 blob.cbData = tests[i].decoded_size;
1926 blob.pbData = (BYTE*)tests[i].decoded;
1929 ok(ret, "CryptEncodeObjectEx failed: %ld\n", GetLastError());
1930 if (ret)
1931 {
1932 ok(bufSize == tests[i].encoded_size, "[%lu] buf size %lu expected %u\n",
1933 i, bufSize, tests[i].encoded_size);
1934 ok(buf[0] == 4, "Got unexpected type %d for octet string (expected 4)\n", buf[0]);
1935 ok(buf[1] == tests[i].decoded_size, "[%lu] Got length %d, expected %d\n",
1936 i, buf[1], tests[i].decoded_size);
1937 ok(!memcmp(buf, tests[i].encoded, tests[i].encoded_size), "[%lu] Got unexpected value\n", i);
1938 LocalFree(buf);
1939 }
1940 }
1941}

Referenced by START_TEST().

◆ test_encodePKCSAttribute()

static void test_encodePKCSAttribute ( DWORD  dwEncoding)
static

Definition at line 6136 of file encode.c.

6137{
6138 CRYPT_ATTRIBUTE attr = { 0 };
6139 BOOL ret;
6140 LPBYTE buf = NULL;
6141 DWORD size = 0;
6143 char oid[] = "1.2.3";
6144
6145 SetLastError(0xdeadbeef);
6149 "Expected STATUS_ACCESS_VIOLATION, got %lx\n", GetLastError());
6150
6151 SetLastError(0xdeadbeef);
6155 "Expected E_INVALIDARG, got %lx\n", GetLastError());
6156 attr.pszObjId = oid;
6159 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6160 if (ret)
6161 {
6162 ok(size == sizeof(emptyPKCSAttr), "Unexpected size %ld\n", size);
6163 ok(!memcmp(buf, emptyPKCSAttr, size), "Unexpected value\n");
6164 LocalFree(buf);
6165 }
6166 blob.cbData = sizeof(bogusDER);
6167 blob.pbData = bogusDER;
6168 attr.cValue = 1;
6169 attr.rgValue = &blob;
6172 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6173 if (ret)
6174 {
6175 ok(size == sizeof(bogusPKCSAttr), "Unexpected size %ld\n", size);
6176 ok(!memcmp(buf, bogusPKCSAttr, size), "Unexpected value\n");
6177 LocalFree(buf);
6178 }
6179 blob.pbData = (BYTE *)ints[0].encoded;
6180 blob.cbData = ints[0].encoded[1] + 2;
6183 if (ret)
6184 {
6185 ok(size == sizeof(intPKCSAttr), "Unexpected size %ld\n", size);
6186 ok(!memcmp(buf, intPKCSAttr, size), "Unexpected value\n");
6187 LocalFree(buf);
6188 }
6189}
static BYTE bogusDER[]
Definition: encode.c:5960

Referenced by START_TEST().

◆ test_encodePKCSAttributes()

static void test_encodePKCSAttributes ( DWORD  dwEncoding)
static

Definition at line 6246 of file encode.c.

6247{
6248 CRYPT_ATTRIBUTES attributes = { 0 };
6249 CRYPT_ATTRIBUTE attr[2] = { { 0 } };
6251 BOOL ret;
6252 LPBYTE buf = NULL;
6253 DWORD size = 0;
6254 char oid1[] = "1.2.3", oid2[] = "1.5.6";
6255
6256 ret = CryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6258 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6259 if (ret)
6260 {
6261 ok(size == sizeof(emptyPKCSAttributes), "Unexpected size %ld\n", size);
6262 ok(!memcmp(buf, emptyPKCSAttributes, size), "Unexpected value\n");
6263 LocalFree(buf);
6264 }
6265 attributes.cAttr = 1;
6266 attributes.rgAttr = attr;
6267 SetLastError(0xdeadbeef);
6268 ret = CryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6271 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6272 attr[0].pszObjId = oid1;
6273 ret = CryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6275 if (ret)
6276 {
6277 ok(size == sizeof(singlePKCSAttributes), "Unexpected size %ld\n", size);
6278 ok(!memcmp(buf, singlePKCSAttributes, size), "Unexpected value\n");
6279 LocalFree(buf);
6280 }
6281 attr[1].pszObjId = oid2;
6282 attr[1].cValue = 1;
6283 attr[1].rgValue = &blob;
6284 blob.pbData = (BYTE *)ints[0].encoded;
6285 blob.cbData = ints[0].encoded[1] + 2;
6286 attributes.cAttr = 2;
6287 ret = CryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6289 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6290 if (ret)
6291 {
6292 ok(size == sizeof(doublePKCSAttributes), "Unexpected size %ld\n", size);
6293 ok(!memcmp(buf, doublePKCSAttributes, size), "Unexpected value\n");
6294 LocalFree(buf);
6295 }
6296}

Referenced by START_TEST().

◆ test_encodePKCSContentInfo()

static void test_encodePKCSContentInfo ( DWORD  dwEncoding)
static

Definition at line 5962 of file encode.c.

5963{
5964 BOOL ret;
5965 BYTE *buf = NULL;
5966 DWORD size = 0;
5967 CRYPT_CONTENT_INFO info = { 0 };
5968 char oid1[] = "1.2.3";
5969
5970 SetLastError(0xdeadbeef);
5974 "Expected STATUS_ACCESS_VIOLATION, got %lx\n", GetLastError());
5975
5976 SetLastError(0xdeadbeef);
5980 "Expected E_INVALIDARG, got %lx\n", GetLastError());
5981 info.pszObjId = oid1;
5984 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
5985 if (ret)
5986 {
5987 ok(size == sizeof(emptyPKCSContentInfo), "Unexpected size %ld\n", size);
5988 ok(!memcmp(buf, emptyPKCSContentInfo, size), "Unexpected value\n");
5989 LocalFree(buf);
5990 }
5991 info.Content.pbData = bogusDER;
5992 info.Content.cbData = sizeof(bogusDER);
5995 ok(ret, "CryptEncodeObjectEx failed; %lx\n", GetLastError());
5996 if (ret)
5997 {
5998 ok(size == sizeof(bogusPKCSContentInfo), "Unexpected size %ld\n", size);
5999 ok(!memcmp(buf, bogusPKCSContentInfo, size), "Unexpected value\n");
6000 LocalFree(buf);
6001 }
6002 info.Content.pbData = (BYTE *)ints[0].encoded;
6003 info.Content.cbData = ints[0].encoded[1] + 2;
6006 if (ret)
6007 {
6008 ok(size == sizeof(intPKCSContentInfo), "Unexpected size %ld\n", size);
6009 ok(!memcmp(buf, intPKCSContentInfo, size), "Unexpected value\n");
6010 LocalFree(buf);
6011 }
6012}

Referenced by START_TEST().

◆ test_encodePKCSSignerInfo()

static void test_encodePKCSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6573 of file encode.c.

6574{
6575 static char oid1[] = "1.2.3", oid2[] = "1.5.6";
6576 BOOL ret;
6577 LPBYTE buf = NULL;
6578 DWORD size = 0;
6579 CMSG_SIGNER_INFO info = { 0 };
6580 char oid_common_name[] = szOID_COMMON_NAME;
6583 CRYPT_ATTRIBUTE attr = { oid_common_name, 1, &commonName };
6584
6585 SetLastError(0xdeadbeef);
6589 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6590 /* To be encoded, a signer must have an issuer at least, and the encoding
6591 * must include PKCS_7_ASN_ENCODING. (That isn't enough to be decoded,
6592 * see decoding tests.)
6593 */
6594 info.Issuer.cbData = sizeof(encodedCommonNameNoNull);
6595 info.Issuer.pbData = encodedCommonNameNoNull;
6596 SetLastError(0xdeadbeef);
6599 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6601 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6602 else
6603 {
6604 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6605 if (ret)
6606 {
6607 ok(size == sizeof(minimalPKCSSigner), "Unexpected size %ld\n", size);
6608 if (size == sizeof(minimalPKCSSigner))
6609 ok(!memcmp(buf, minimalPKCSSigner, size), "Unexpected value\n");
6610 else
6611 ok(0, "Unexpected value\n");
6612 LocalFree(buf);
6613 }
6614 }
6615 info.SerialNumber.cbData = sizeof(serialNum);
6616 info.SerialNumber.pbData = (BYTE *)serialNum;
6617 SetLastError(0xdeadbeef);
6620 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6622 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6623 else
6624 {
6625 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6626 if (ret)
6627 {
6628 ok(size == sizeof(PKCSSignerWithSerial), "Unexpected size %ld\n",
6629 size);
6630 if (size == sizeof(PKCSSignerWithSerial))
6632 "Unexpected value\n");
6633 else
6634 ok(0, "Unexpected value\n");
6635 LocalFree(buf);
6636 }
6637 }
6638 info.HashAlgorithm.pszObjId = oid1;
6639 SetLastError(0xdeadbeef);
6642 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6644 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6645 else
6646 {
6647 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6648 if (ret)
6649 {
6650 ok(size == sizeof(PKCSSignerWithHashAlgo), "Unexpected size %ld\n",
6651 size);
6652 if (size == sizeof(PKCSSignerWithHashAlgo))
6654 "Unexpected value\n");
6655 else
6656 ok(0, "Unexpected value\n");
6657 LocalFree(buf);
6658 }
6659 }
6660 info.HashEncryptionAlgorithm.pszObjId = oid2;
6661 SetLastError(0xdeadbeef);
6664 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6666 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6667 else
6668 {
6669 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6670 if (ret)
6671 {
6673 "Unexpected size %ld\n", size);
6676 "Unexpected value\n");
6677 else
6678 ok(0, "Unexpected value\n");
6679 LocalFree(buf);
6680 }
6681 }
6682 info.EncryptedHash.cbData = sizeof(hash);
6683 info.EncryptedHash.pbData = (BYTE *)hash;
6684 SetLastError(0xdeadbeef);
6687 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6689 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6690 else
6691 {
6692 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6693 if (ret)
6694 {
6695 ok(size == sizeof(PKCSSignerWithHash), "Unexpected size %ld\n",
6696 size);
6697 if (size == sizeof(PKCSSignerWithHash))
6699 "Unexpected value\n");
6700 else
6701 ok(0, "Unexpected value\n");
6702 LocalFree(buf);
6703 }
6704 }
6705 info.AuthAttrs.cAttr = 1;
6706 info.AuthAttrs.rgAttr = &attr;
6707 SetLastError(0xdeadbeef);
6710 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6712 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6713 else
6714 {
6715 ok(ret, "CryptEncodeObjectEx failed: %lx\n", GetLastError());
6716 if (ret)
6717 {
6718 ok(size == sizeof(PKCSSignerWithAuthAttr), "Unexpected size %ld\n",
6719 size);
6720 if (size == sizeof(PKCSSignerWithAuthAttr))
6722 "Unexpected value\n");
6723 else
6724 ok(0, "Unexpected value\n");
6725 LocalFree(buf);
6726 }
6727 }
6728}

Referenced by START_TEST().

◆ test_encodePKCSSMimeCapabilities()

static void test_encodePKCSSMimeCapabilities ( DWORD  dwEncoding)
static

Definition at line 6374 of file encode.c.

6375{
6376 static char oid1[] = "1.5.6", oid2[] = "1.2.3";
6377 BOOL ret;
6378 LPBYTE buf = NULL;
6379 DWORD size = 0;
6380 CRYPT_SMIME_CAPABILITY capability[2];
6381 CRYPT_SMIME_CAPABILITIES capabilities;
6382
6383 /* An empty capabilities is allowed */
6384 capabilities.cCapability = 0;
6386 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6387 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
6388 if (ret)
6389 {
6390 ok(size == sizeof(emptySequence), "unexpected size %ld\n", size);
6391 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
6392 LocalFree(buf);
6393 }
6394 /* A non-empty capabilities with an empty capability (lacking an OID) is
6395 * not allowed
6396 */
6397 capability[0].pszObjId = NULL;
6398 capability[0].Parameters.cbData = 0;
6399 capabilities.cCapability = 1;
6400 capabilities.rgCapability = capability;
6401 SetLastError(0xdeadbeef);
6403 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6405 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
6406 capability[0].pszObjId = oid1;
6408 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6409 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
6410 if (ret)
6411 {
6412 ok(size == sizeof(singleCapability), "unexpected size %ld\n", size);
6413 ok(!memcmp(buf, singleCapability, size), "unexpected value\n");
6414 LocalFree(buf);
6415 }
6416 capability[1].pszObjId = oid2;
6417 capability[1].Parameters.cbData = 0;
6418 capabilities.cCapability = 2;
6420 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6421 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
6422 if (ret)
6423 {
6424 ok(size == sizeof(twoCapabilities), "unexpected size %ld\n", size);
6425 ok(!memcmp(buf, twoCapabilities, size), "unexpected value\n");
6426 LocalFree(buf);
6427 }
6428}

Referenced by START_TEST().

◆ test_encodePolicyQualifierUserNotice()

static void test_encodePolicyQualifierUserNotice ( DWORD  dwEncoding)
static

Definition at line 7404 of file encode.c.

7405{
7406 BOOL ret;
7407 LPBYTE buf;
7408 DWORD size;
7411
7412 memset(&notice, 0, sizeof(notice));
7413 ret = CryptEncodeObjectEx(dwEncoding,
7415 NULL, &buf, &size);
7416 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7417 if (ret)
7418 {
7419 ok(sizeof(emptySequence) == size, "unexpected size %ld\n", size);
7420 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
7421 LocalFree(buf);
7422 }
7423 notice.pszDisplayText = (WCHAR *)L"This is a notice";
7424 ret = CryptEncodeObjectEx(dwEncoding,
7426 NULL, &buf, &size);
7427 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7428 if (ret)
7429 {
7430 ok(sizeof(noticeWithDisplayText) == size, "unexpected size %ld\n", size);
7431 ok(!memcmp(buf, noticeWithDisplayText, size), "unexpected value\n");
7432 LocalFree(buf);
7433 }
7434 reference.pszOrganization = org;
7435 reference.cNoticeNumbers = 2;
7436 reference.rgNoticeNumbers = noticeNumbers;
7437 notice.pNoticeReference = &reference;
7438 ret = CryptEncodeObjectEx(dwEncoding,
7440 NULL, &buf, &size);
7441 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
7442 if (ret)
7443 {
7444 ok(sizeof(noticeWithReference) == size, "unexpected size %ld\n", size);
7445 ok(!memcmp(buf, noticeWithReference, size), "unexpected value\n");
7446 LocalFree(buf);
7447 }
7448}
GLint reference
Definition: glext.h:11729

Referenced by START_TEST().

◆ test_encodePublicKeyInfo()

static void test_encodePublicKeyInfo ( DWORD  dwEncoding)
static

Definition at line 2883 of file encode.c.

2884{
2885 DWORD i;
2886
2887 for (i = 0; i < ARRAY_SIZE(pubKeys); i++)
2888 {
2889 BOOL ret;
2890 BYTE *buf = NULL;
2891 DWORD bufSize = 0;
2892
2895 &bufSize);
2896 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2897 if (ret)
2898 {
2899 ok(bufSize == pubKeys[i].encoded[1] + 2,
2900 "Expected %d bytes, got %ld\n", pubKeys[i].encoded[1] + 2, bufSize);
2901 if (bufSize == pubKeys[i].encoded[1] + 2)
2902 ok(!memcmp(buf, pubKeys[i].encoded, pubKeys[i].encoded[1] + 2),
2903 "Unexpected value\n");
2904 LocalFree(buf);
2905 }
2906 }
2907}

Referenced by START_TEST().

◆ test_encodeRsaPublicKey()

static void test_encodeRsaPublicKey ( DWORD  dwEncoding)
static

Definition at line 2344 of file encode.c.

2345{
2346 BYTE toEncode[sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + sizeof(modulus1)];
2347 BLOBHEADER *hdr = (BLOBHEADER *)toEncode;
2348 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(toEncode + sizeof(BLOBHEADER));
2349 BOOL ret;
2350 BYTE *buf = NULL;
2351 DWORD bufSize = 0, i;
2352
2353 /* Try with a bogus blob type */
2354 hdr->bType = 2;
2355 hdr->bVersion = CUR_BLOB_VERSION;
2356 hdr->reserved = 0;
2357 hdr->aiKeyAlg = CALG_RSA_KEYX;
2358 rsaPubKey->magic = 0x31415352;
2359 rsaPubKey->bitlen = sizeof(modulus1) * 8;
2360 rsaPubKey->pubexp = 131073;
2361 memcpy(toEncode + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY), modulus1,
2362 sizeof(modulus1));
2363
2365 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2367 "Expected E_INVALIDARG, got %08lx\n", GetLastError());
2368 /* Now with a bogus reserved field */
2369 hdr->bType = PUBLICKEYBLOB;
2370 hdr->reserved = 1;
2372 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2373 if (ret)
2374 {
2375 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2376 "Expected size %d, got %ld\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2377 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2378 LocalFree(buf);
2379 }
2380 /* Now with a bogus blob version */
2381 hdr->reserved = 0;
2382 hdr->bVersion = 0;
2384 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2385 if (ret)
2386 {
2387 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2388 "Expected size %d, got %ld\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2389 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2390 LocalFree(buf);
2391 }
2392 /* And with a bogus alg ID */
2393 hdr->bVersion = CUR_BLOB_VERSION;
2394 hdr->aiKeyAlg = CALG_DES;
2396 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2397 if (ret)
2398 {
2399 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2400 "Expected size %d, got %ld\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2401 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2402 LocalFree(buf);
2403 }
2404 /* Check a couple of RSA-related OIDs */
2405 hdr->aiKeyAlg = CALG_RSA_KEYX;
2407 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2409 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
2411 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2413 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
2414 /* Finally, all valid */
2415 hdr->aiKeyAlg = CALG_RSA_KEYX;
2416 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2417 {
2418 memcpy(toEncode + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY),
2419 rsaPubKeys[i].modulus, rsaPubKeys[i].modulusLen);
2421 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2422 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2423 if (ret)
2424 {
2425 ok(bufSize == rsaPubKeys[i].encoded[1] + 2,
2426 "Expected size %d, got %ld\n", rsaPubKeys[i].encoded[1] + 2,
2427 bufSize);
2428 ok(!memcmp(buf, rsaPubKeys[i].encoded, bufSize),
2429 "Unexpected value\n");
2430 LocalFree(buf);
2431 }
2432 }
2433}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const BYTE modulus1[]
Definition: encode.c:2320
struct _PUBLICKEYSTRUC BLOBHEADER
#define CALG_DES
Definition: wincrypt.h:2082

Referenced by START_TEST().

◆ test_encodeRsaPublicKey_Bcrypt()

static void test_encodeRsaPublicKey_Bcrypt ( DWORD  dwEncoding)
static

Definition at line 2499 of file encode.c.

2500{
2501 BYTE toEncode[sizeof(BCRYPT_RSAKEY_BLOB) + sizeof(DWORD) + sizeof(modulus1)];
2503 BOOL ret;
2504 BYTE *buf = NULL;
2505 DWORD bufSize = 0, i;
2506 BYTE pubexp[] = {0x01,0x00,0x02,0x00}; /* 131073 */
2507
2508 /* Verify that the Magic value doesn't matter */
2509 hdr->Magic = 1;
2510 hdr->BitLength = sizeof(modulus1) * 8;
2511 hdr->cbPublicExp = sizeof(pubexp);
2512 hdr->cbModulus = sizeof(modulus1);
2513 hdr->cbPrime1 = 0;
2514 hdr->cbPrime2 = 0;
2515
2516 /* CNG_RSA_PUBLIC_KEY_BLOB stores the exponent and modulus
2517 * in big-endian format, so we need convert them
2518 * from little-endian format before encoding
2519 */
2520 CRYPT_CopyReversed(toEncode + sizeof(BCRYPT_RSAKEY_BLOB), pubexp, sizeof(pubexp));
2521 CRYPT_CopyReversed(toEncode + sizeof(BCRYPT_RSAKEY_BLOB) + sizeof(pubexp), modulus1, sizeof(modulus1));
2522
2524 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2525 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2526
2527 /* Finally, all valid */
2528 hdr->Magic = BCRYPT_RSAPUBLIC_MAGIC;
2529 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2530 {
2531 hdr->BitLength = rsaPubKeys[i].modulusLen * 8;
2532 hdr->cbModulus = rsaPubKeys[i].modulusLen;
2533
2534 CRYPT_CopyReversed(toEncode + sizeof(BCRYPT_RSAKEY_BLOB) + sizeof(DWORD),
2535 rsaPubKeys[i].modulus, rsaPubKeys[i].modulusLen);
2536
2538 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2539 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2540 if (ret)
2541 {
2542 ok(bufSize == rsaPubKeys[i].encoded[1] + 2,
2543 "Expected size %d, got %ld\n", rsaPubKeys[i].encoded[1] + 2,
2544 bufSize);
2545 ok(!memcmp(buf, rsaPubKeys[i].encoded, bufSize),
2546 "Unexpected value\n");
2547 LocalFree(buf);
2548 }
2549 }
2550}
struct _BCRYPT_RSAKEY_BLOB BCRYPT_RSAKEY_BLOB

Referenced by START_TEST().

◆ test_encodeSequenceOfAny()

static void test_encodeSequenceOfAny ( DWORD  dwEncoding)
static

Definition at line 2626 of file encode.c.

2627{
2630 DWORD i;
2631 BOOL ret;
2632 BYTE *buf = NULL;
2633 DWORD bufSize = 0;
2634
2635 /* Encode a homogeneous sequence */
2636 for (i = 0; i < ARRAY_SIZE(ints); i++)
2637 {
2638 blobs[i].cbData = ints[i].encoded[1] + 2;
2639 blobs[i].pbData = (BYTE *)ints[i].encoded;
2640 }
2641 seq.cValue = ARRAY_SIZE(ints);
2642 seq.rgValue = blobs;
2643
2644 ret = CryptEncodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, &seq,
2646 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2647 if (ret)
2648 {
2649 ok(bufSize == sizeof(intSequence), "Wrong size %ld\n", bufSize);
2650 ok(!memcmp(buf, intSequence, intSequence[1] + 2), "Unexpected value\n");
2651 LocalFree(buf);
2652 }
2653 /* Change the type of the first element in the sequence, and give it
2654 * another go
2655 */
2656 blobs[0].cbData = times[0].encodedTime[1] + 2;
2657 blobs[0].pbData = (BYTE *)times[0].encodedTime;
2658 ret = CryptEncodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, &seq,
2660 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
2661 if (ret)
2662 {
2663 ok(bufSize == sizeof(mixedSequence), "Wrong size %ld\n", bufSize);
2665 "Unexpected value\n");
2666 LocalFree(buf);
2667 }
2668}

Referenced by START_TEST().

◆ test_encodeUnicodeName()

static void test_encodeUnicodeName ( DWORD  dwEncoding)
static

Definition at line 858 of file encode.c.

859{
860 CERT_RDN_ATTR attrs[2];
861 CERT_RDN rdn;
863 static CHAR oid_common_name[] = szOID_COMMON_NAME,
864 oid_sur_name[] = szOID_SUR_NAME;
865 BYTE *buf = NULL;
866 DWORD size = 0;
867 BOOL ret;
868
872 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
873
874 /* Test with empty CERT_NAME_INFO */
875 info.cRDN = 0;
876 info.rgRDN = NULL;
879 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
880 if (ret)
881 {
883 "Got unexpected encoding for empty name\n");
884 LocalFree(buf);
885 }
886 /* Check with one CERT_RDN_ATTR, that has an invalid character for the
887 * encoding (the NULL).
888 */
889 attrs[0].pszObjId = oid_common_name;
891 attrs[0].Value.cbData = sizeof(L"Juan Lang");
892 attrs[0].Value.pbData = (BYTE *)L"Juan Lang";
893 rdn.cRDNAttr = 1;
894 rdn.rgRDNAttr = attrs;
895 info.cRDN = 1;
896 info.rgRDN = &rdn;
900 "Expected CRYPT_E_INVALID_PRINTABLE_STRING, got %08lx\n", GetLastError());
901 ok(size == 9, "Unexpected error index %08lx\n", size);
902 /* Check with two NULL-terminated CERT_RDN_ATTRs. Note DER encoding
903 * forces the order of the encoded attributes to be swapped.
904 */
905 attrs[0].pszObjId = oid_common_name;
907 attrs[0].Value.cbData = 0;
908 attrs[0].Value.pbData = (BYTE *)L"Juan Lang";
909 attrs[1].pszObjId = oid_sur_name;
911 attrs[1].Value.cbData = 0;
912 attrs[1].Value.pbData = (BYTE *)L"Lang";
913 rdn.cRDNAttr = 2;
914 rdn.rgRDNAttr = attrs;
915 info.cRDN = 1;
916 info.rgRDN = &rdn;
919 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
920 if (ret)
921 {
923 "Got unexpected encoding for two RDN array\n");
924 LocalFree(buf);
925 }
926 /* A name can be "encoded" with previously encoded RDN attrs. */
928 attrs[0].Value.pbData = (LPBYTE)twoRDNs;
929 attrs[0].Value.cbData = sizeof(twoRDNs);
930 rdn.cRDNAttr = 1;
933 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
934 if (ret)
935 {
936 ok(size == sizeof(encodedTwoRDNs), "Unexpected size %ld\n", size);
938 "Unexpected value for re-encoded two RDN array\n");
939 LocalFree(buf);
940 }
941 /* Unicode names infer the type for CERT_RDN_ANY_TYPE */
942 rdn.cRDNAttr = 1;
946 todo_wine ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
947 if (ret)
948 {
949 ok(size == sizeof(anyType), "Unexpected size %ld\n", size);
950 ok(!memcmp(buf, anyType, size), "Unexpected value\n");
951 LocalFree(buf);
952 }
953}
static const BYTE anyType[]
Definition: encode.c:852
#define CRYPT_E_INVALID_PRINTABLE_STRING
Definition: winerror.h:4439

Referenced by START_TEST().

◆ test_encodeUnicodeNameValue()

static void test_encodeUnicodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1757 of file encode.c.

1758{
1759 BYTE *buf = NULL;
1760 DWORD size = 0, i;
1761 BOOL ret;
1763
1767 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", GetLastError());
1768
1769 /* Have to have a string of some sort */
1770 value.dwValueType = 0; /* aka CERT_RDN_ANY_TYPE */
1771 value.Value.pbData = NULL;
1772 value.Value.cbData = 0;
1776 "Expected CRYPT_E_NOT_CHAR_STRING, got %08lx\n", GetLastError());
1777 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1781 "Expected CRYPT_E_NOT_CHAR_STRING, got %08lx\n", GetLastError());
1782 value.dwValueType = CERT_RDN_ANY_TYPE;
1783 value.Value.pbData = (LPBYTE)L"1";
1787 "Expected CRYPT_E_NOT_CHAR_STRING, got %08lx\n", GetLastError());
1788 value.Value.cbData = sizeof(L"1");
1792 "Expected CRYPT_E_NOT_CHAR_STRING, got %08lx\n", GetLastError());
1793 /* An encoded string with specified length isn't good enough either */
1794 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1795 value.Value.pbData = oneUniversal;
1796 value.Value.cbData = sizeof(oneUniversal);
1800 "Expected CRYPT_E_NOT_CHAR_STRING, got %08lx\n", GetLastError());
1801 /* More failure checking */
1802 value.Value.cbData = 0;
1803 for (i = 0; i < ARRAY_SIZE(unicodeErrors); i++)
1804 {
1805 value.Value.pbData = (LPBYTE)unicodeErrors[i].str;
1806 value.dwValueType = unicodeErrors[i].valueType;
1810 "Value type %ld: expected %08lx, got %08lx\n", value.dwValueType,
1811 unicodeErrors[i].error, GetLastError());
1812 ok(size == unicodeErrors[i].errorIndex,
1813 "Expected error index %ld, got %ld\n", unicodeErrors[i].errorIndex,
1814 size);
1815 }
1816 /* cbData can be zero if the string is NULL-terminated */
1817 value.Value.cbData = 0;
1818 for (i = 0; i < ARRAY_SIZE(unicodeResults); i++)
1819 {
1820 value.Value.pbData = (LPBYTE)unicodeResults[i].str;
1821 value.dwValueType = unicodeResults[i].valueType;
1824 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
1825 if (ret)
1826 {
1827 ok(size == unicodeResults[i].encoded.cbData,
1828 "Value type %ld: expected size %ld, got %ld\n",
1829 value.dwValueType, unicodeResults[i].encoded.cbData, size);
1830 ok(!memcmp(unicodeResults[i].encoded.pbData, buf, size),
1831 "Value type %ld: unexpected value\n", value.dwValueType);
1832 LocalFree(buf);
1833 }
1834 }
1835 /* These "encode," but they do so by truncating each unicode character
1836 * rather than properly encoding it. Kept separate from the proper results,
1837 * because the encoded forms won't decode to their original strings.
1838 */
1839 for (i = 0; i < ARRAY_SIZE(unicodeWeirdness); i++)
1840 {
1841 value.Value.pbData = (LPBYTE)unicodeWeirdness[i].str;
1842 value.dwValueType = unicodeWeirdness[i].valueType;
1845 ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
1846 if (ret)
1847 {
1848 ok(size == unicodeWeirdness[i].encoded.cbData,
1849 "Value type %ld: expected size %ld, got %ld\n",
1850 value.dwValueType, unicodeWeirdness[i].encoded.cbData, size);
1851 ok(!memcmp(unicodeWeirdness[i].encoded.pbData, buf, size),
1852 "Value type %ld: unexpected value\n", value.dwValueType);
1853 LocalFree(buf);
1854 }
1855 }
1856}
static struct UnicodeExpectedError unicodeErrors[]
Definition: encode.c:1700
static BYTE oneUniversal[]
Definition: encode.c:1723
static struct UnicodeExpectedResult unicodeWeirdness[]
Definition: encode.c:1752
const WCHAR * str
#define CRYPT_E_NOT_CHAR_STRING
Definition: winerror.h:4442

Referenced by START_TEST().

◆ testExportPublicKey()

static void testExportPublicKey ( HCRYPTPROV  csp,
PCERT_PUBLIC_KEY_INFO pInfo 
)
static

Definition at line 8226 of file encode.c.

8227{
8228 BOOL ret;
8229 DWORD size = 0;
8230 HCRYPTKEY key;
8231
8232 /* This crashes
8233 ret = CryptExportPublicKeyInfoEx(0, 0, 0, NULL, 0, NULL, NULL, NULL);
8234 */
8235 ret = CryptExportPublicKeyInfoEx(0, 0, 0, NULL, 0, NULL, NULL, &size);
8237 "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
8239 &size);
8241 "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
8243 NULL, &size);
8245 "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
8247 0, NULL, NULL, &size);
8249 "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
8250 /* Test with no key */
8252 0, NULL, NULL, &size);
8253 ok(!ret && GetLastError() == NTE_NO_KEY, "Expected NTE_NO_KEY, got %08lx\n",
8254 GetLastError());
8255 ret = CryptGenKey(csp, AT_SIGNATURE, 0, &key);
8256 ok(ret, "CryptGenKey failed: %08lx\n", GetLastError());
8257 if (ret)
8258 {
8260 NULL, 0, NULL, NULL, &size);
8261 ok(ret, "CryptExportPublicKeyInfoEx failed: %08lx\n", GetLastError());
8262 *pInfo = malloc(size);
8263 if (*pInfo)
8264 {
8266 X509_ASN_ENCODING, NULL, 0, NULL, *pInfo, &size);
8267 ok(ret, "CryptExportPublicKeyInfoEx failed: %08lx\n",
8268 GetLastError());
8269 if (ret)
8270 {
8271 /* By default (we passed NULL as the OID) the OID is
8272 * szOID_RSA_RSA.
8273 */
8274 ok(!strcmp((*pInfo)->Algorithm.pszObjId, szOID_RSA_RSA),
8275 "Expected %s, got %s\n", szOID_RSA_RSA,
8276 (*pInfo)->Algorithm.pszObjId);
8277 }
8278 }
8279 }
8281}
BOOL WINAPI CryptDestroyKey(HCRYPTKEY hKey)
Definition: crypt.c:930
BOOL WINAPI CryptGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey)
Definition: crypt.c:1451
BOOL WINAPI CryptExportPublicKeyInfoEx(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE hCryptProv, DWORD dwKeySpec, DWORD dwCertEncodingType, LPSTR pszPublicKeyObjId, DWORD dwFlags, void *pvAuxInfo, PCERT_PUBLIC_KEY_INFO pInfo, DWORD *pcbInfo)
Definition: encode.c:4934
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
Definition: copy.c:22
#define AT_SIGNATURE
Definition: wincrypt.h:2240
ULONG_PTR HCRYPTKEY
Definition: wincrypt.h:58
#define NTE_NO_KEY
Definition: winerror.h:4260

Referenced by testPortPublicKeyInfo().

◆ testImportPublicKey()

static void testImportPublicKey ( HCRYPTPROV  csp,
PCERT_PUBLIC_KEY_INFO  info 
)
static

Definition at line 8309 of file encode.c.

8310{
8311 BOOL ret;
8312 HCRYPTKEY key;
8313#ifndef __REACTOS__
8314 BCRYPT_KEY_HANDLE key2;
8315#endif
8317 DWORD dwSize;
8318 ALG_ID ai;
8319
8320 /* These crash
8321 ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, NULL);
8322 ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, &key);
8323 ret = CryptImportPublicKeyInfoEx(0, 0, info, 0, 0, NULL, NULL);
8324 ret = CryptImportPublicKeyInfoEx(csp, X509_ASN_ENCODING, info, 0, 0, NULL,
8325 NULL);
8326 */
8327 ret = CryptImportPublicKeyInfoEx(0, 0, info, 0, 0, NULL, &key);
8329 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
8330 ret = CryptImportPublicKeyInfoEx(csp, 0, info, 0, 0, NULL, &key);
8332 "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
8334 &key);
8336 "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
8337
8338 /* Export key with standard algorithm (CALG_RSA_KEYX) */
8340 &key);
8341 ok(ret, "CryptImportPublicKeyInfoEx failed: %08lx\n", GetLastError());
8342
8343 dwSize = sizeof(ai);
8345 ok(ret, "CryptGetKeyParam failed: %08lx\n", GetLastError());
8346 if(ret)
8347 {
8348 ok(dwSize == sizeof(ai), "CryptGetKeyParam returned size %ld\n",dwSize);
8349 ok(ai == CALG_RSA_KEYX, "Default ALG_ID is %04x (expected CALG_RSA_KEYX)\n", ai);
8350 }
8351
8353
8354 /* Repeat with forced algorithm */
8356 &key);
8357 ok(ret, "CryptImportPublicKeyInfoEx failed: %08lx\n", GetLastError());
8358
8359 dwSize = sizeof(ai);
8361 ok(ret, "CryptGetKeyParam failed: %08lx\n", GetLastError());
8362 if(ret)
8363 {
8364 ok(dwSize == sizeof(ai), "CryptGetKeyParam returned size %ld\n",dwSize);
8365 ok(ai == CALG_RSA_SIGN, "ALG_ID is %04x (expected CALG_RSA_SIGN)\n", ai);
8366 }
8367
8369
8370 /* Test importing a public key from a certificate context */
8372 sizeof(expiredCert));
8373 ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
8374 GetLastError());
8375 if (context)
8376 {
8378 context->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId),
8379 "Expected %s, got %s\n", szOID_RSA_RSA,
8380 context->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId);
8382 &context->pCertInfo->SubjectPublicKeyInfo, 0, 0, NULL, &key);
8383 ok(ret, "CryptImportPublicKeyInfoEx failed: %08lx\n", GetLastError());
8385
8386#ifndef __REACTOS__ // FIXME: ReactOS has no implementation for CryptImportPublicKeyInfoEx2
8388 &context->pCertInfo->SubjectPublicKeyInfo, 0, NULL, &key2);
8389 ok(ret, "CryptImportPublicKeyInfoEx2 failed: %08lx\n", GetLastError());
8390 BCryptDestroyKey(key2);
8391#endif
8392
8394 }
8395}
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE)
BOOL WINAPI CryptGetKeyParam(HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
Definition: crypt.c:1649
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded)
Definition: cert.c:316
BOOL WINAPI CryptImportPublicKeyInfoEx(HCRYPTPROV hCryptProv, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, ALG_ID aiKeyAlg, DWORD dwFlags, void *pvAuxInfo, HCRYPTKEY *phKey)
Definition: encode.c:5044
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static const BYTE expiredCert[]
Definition: encode.c:8283
Definition: http.c:7252
#define CALG_RSA_SIGN
Definition: wincrypt.h:2069
WINCRYPT32API BOOL WINAPI CryptImportPublicKeyInfoEx2(DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, DWORD dwFlags, void *pvAuxInfo, BCRYPT_KEY_HANDLE *phKey)
#define KP_ALGID
Definition: wincrypt.h:2338
unsigned int ALG_ID
Definition: wincrypt.h:54

Referenced by testPortPublicKeyInfo().

◆ testPortPublicKeyInfo()

static void testPortPublicKeyInfo ( void  )
static

Definition at line 8399 of file encode.c.

8400{
8401 HCRYPTPROV csp;
8402 BOOL ret;
8404
8405 /* Just in case a previous run failed, delete this thing */
8410 ok(ret,"CryptAcquireContextA failed\n");
8411
8414
8415 free(info);
8416 CryptReleaseContext(csp, 0);
8419 ok(ret,"CryptAcquireContextA failed\n");
8420}
BOOL WINAPI CryptReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
Definition: crypt.c:648
BOOL WINAPI CryptAcquireContextA(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags)
Definition: crypt.c:569
static const char cspName[]
Definition: encode.c:8397
static void testExportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo)
Definition: encode.c:8226
static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
Definition: encode.c:8309
#define MS_DEF_PROV_A
Definition: wincrypt.h:2115
#define CRYPT_NEWKEYSET
Definition: wincrypt.h:2274
#define PROV_RSA_FULL
Definition: wincrypt.h:2243
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:55
#define CRYPT_DELETEKEYSET
Definition: wincrypt.h:2275

Referenced by START_TEST().

◆ testTimeDecoding()

static void testTimeDecoding ( DWORD  dwEncoding,
LPCSTR  structType,
const struct encodedFiletime time 
)
static

Definition at line 509 of file encode.c.

511{
512 FILETIME ft = { 0 };
513 DWORD size = sizeof(ft);
514 BOOL ret;
515
516 ret = CryptDecodeObjectEx(dwEncoding, structType, time->encodedTime,
517 time->encodedTime[1] + 2, 0, NULL, &ft, &size);
518 /* years other than 1950-2050 are not allowed for encodings other than
519 * X509_CHOICE_OF_TIME.
520 */
521 if (structType == X509_CHOICE_OF_TIME ||
522 (time->sysTime.wYear >= 1950 && time->sysTime.wYear <= 2050))
523 {
524 ok(ret, "CryptDecodeObjectEx failed: %ld (0x%08lx)\n", GetLastError(),
525 GetLastError());
526 if (ret)
527 compareTime(&time->sysTime, &ft);
528 }
529 else
531 "Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
532}
__u16 time
Definition: mkdosfs.c:8
static void compareTime(const SYSTEMTIME *expected, const FILETIME *got)
Definition: encode.c:493

Referenced by test_decodeFiletime().

◆ testTimeEncoding()

static void testTimeEncoding ( DWORD  dwEncoding,
LPCSTR  structType,
const struct encodedFiletime time 
)
static

Definition at line 435 of file encode.c.

437{
438 FILETIME ft = { 0 };
439 BYTE *buf = NULL;
440 DWORD bufSize = 0;
441 BOOL ret;
442
443 ret = SystemTimeToFileTime(&time->sysTime, &ft);
444 ok(ret, "SystemTimeToFileTime failed: %ld\n", GetLastError());
445 ret = CryptEncodeObjectEx(dwEncoding, structType, &ft,
447 /* years other than 1950-2050 are not allowed for encodings other than
448 * X509_CHOICE_OF_TIME.
449 */
450 if (structType == X509_CHOICE_OF_TIME ||
451 (time->sysTime.wYear >= 1950 && time->sysTime.wYear <= 2050))
452 {
453 ok(ret, "CryptEncodeObjectEx failed: %ld (0x%08lx)\n", GetLastError(),
454 GetLastError());
455 ok(buf != NULL, "Expected an allocated buffer\n");
456 if (ret)
457 {
458 ok(buf[0] == time->encodedTime[0],
459 "Expected type 0x%02x, got 0x%02x\n", time->encodedTime[0],
460 buf[0]);
461 ok(buf[1] == time->encodedTime[1], "Expected %d bytes, got %ld\n",
462 time->encodedTime[1], bufSize);
463 ok(!memcmp(time->encodedTime + 2, buf + 2, time->encodedTime[1]),
464 "Got unexpected value for time encoding\n");
465 LocalFree(buf);
466 }
467 }
468 else
470 "Expected CRYPT_E_BAD_ENCODE, got 0x%08lx\n", GetLastError());
471}

Referenced by test_encodeFiletime().

Variable Documentation

◆ aKey

const BYTE aKey[]
static
Initial value:
= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd,
0xe, 0xf }

Definition at line 2832 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ anyType

const BYTE anyType[]
static
Initial value:
= {
0x30,0x2f,0x31,0x2d,0x30,0x2b,0x06,0x03,0x55,0x04,0x03,0x1e,0x24,0x23,0x30,
0x21,0x31,0x0c,0x30,0x03,0x06,0x04,0x55,0x13,0x04,0x4c,0x05,0x6e,0x61,0x00,
0x67,0x11,0x30,0x03,0x06,0x04,0x55,0x13,0x03,0x4a,0x0a,0x61,0x75,0x20,0x6e,
0x61,0x4c,0x67,0x6e }

Definition at line 852 of file encode.c.

Referenced by test_encodeUnicodeName().

◆ aric

const BYTE aric[]
static
Initial value:
= { 0x61, 0x72, 0x69, 0x63, 0x40, 0x63, 0x6f, 0x64,
0x65, 0x77, 0x65, 0x61, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x63, 0x6f, 0x6d }

Definition at line 682 of file encode.c.

Referenced by test_CertGetNameString().

◆ authorityInfoAccessWithUrl

const BYTE authorityInfoAccessWithUrl[]
static
Initial value:
= {
0x30,0x19,0x30,0x17,0x06,0x02,0x2a,0x03,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,
0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67 }

Definition at line 5227 of file encode.c.

Referenced by test_decodeAuthorityInfoAccess(), and test_encodeAuthorityInfoAccess().

◆ authorityInfoAccessWithUrlAndIPAddr

const BYTE authorityInfoAccessWithUrlAndIPAddr[]
static
Initial value:
= {
0x30,0x29,0x30,0x17,0x06,0x02,0x2a,0x03,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,
0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67,0x30,0x0e,0x06,
0x02,0x2d,0x06,0x87,0x08,0x30,0x06,0x87,0x04,0x7f,0x00,0x00,0x01 }

Definition at line 5230 of file encode.c.

Referenced by test_decodeAuthorityInfoAccess(), and test_encodeAuthorityInfoAccess().

◆ authorityKeyIdWithId

const BYTE authorityKeyIdWithId[]
static
Initial value:
= {
0x30,0x06,0x80,0x04,0x01,0x02,0x03,0x04 }

Definition at line 4926 of file encode.c.

Referenced by test_decodeAuthorityKeyId(), test_decodeAuthorityKeyId2(), test_encodeAuthorityKeyId(), and test_encodeAuthorityKeyId2().

◆ authorityKeyIdWithIssuer

const BYTE authorityKeyIdWithIssuer[]
static
Initial value:
= { 0x30,0x19,0xa1,0x17,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 4928 of file encode.c.

Referenced by test_decodeAuthorityKeyId(), and test_encodeAuthorityKeyId().

◆ authorityKeyIdWithIssuerUrl

const BYTE authorityKeyIdWithIssuerUrl[]
static
Initial value:
= { 0x30,0x15,0xa1,0x13,0x86,
0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,
0x6f,0x72,0x67 }

Definition at line 5068 of file encode.c.

Referenced by test_decodeAuthorityKeyId2(), and test_encodeAuthorityKeyId2().

◆ authorityKeyIdWithSerial

const BYTE authorityKeyIdWithSerial[] = { 0x30,0x03,0x82,0x01,0x01 }
static

◆ badFlagsIDP

const BYTE badFlagsIDP[] = { 0x30,0x06,0x81,0x01,0xff,0x82,0x01,0xff }
static

Definition at line 3790 of file encode.c.

Referenced by test_decodeCRLIssuingDistPoint(), and test_encodeCRLIssuingDistPoint().

◆ bigCert

const BYTE bigCert[]
static
Initial value:
= { 0x30, 0x7a, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x22,
0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30,
0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x15, 0x31, 0x13, 0x30,
0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20,
0x4c, 0x61, 0x6e, 0x67, 0x00, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01,
0x00, 0xa3, 0x16, 0x30, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
0x01, 0xff, 0x04, 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 }

Definition at line 3008 of file encode.c.

Referenced by test_decodeCert(), test_decodeCertToBeSigned(), test_encodeCert(), and test_encodeCertToBeSigned().

◆ bigInts

const struct encodedBigInt bigInts[]
static
Initial value:
= {
{ bin8, bin9, bin10 },
{ bin11, bin12, bin13 },
}
static const BYTE bin8[]
Definition: encode.c:69
static const BYTE bin13[]
Definition: encode.c:75
static const BYTE bin11[]
Definition: encode.c:73
static const BYTE bin10[]
Definition: encode.c:71
static const BYTE bin12[]
Definition: encode.c:74
static const BYTE bin9[]
Definition: encode.c:70

Definition at line 77 of file encode.c.

Referenced by test_decodeInt(), and test_encodeInt().

◆ bigUInts

const struct encodedBigInt bigUInts[]
static
Initial value:
= {
{ bin14, bin15, NULL },
{ bin16, bin17, NULL },
}
static const BYTE bin15[]
Definition: encode.c:83
static const BYTE bin14[]
Definition: encode.c:82
static const BYTE bin17[]
Definition: encode.c:85
static const BYTE bin16[]
Definition: encode.c:84

Definition at line 88 of file encode.c.

Referenced by test_decodeInt(), and test_encodeInt().

◆ bin1

const BYTE bin1[] = {0x02,0x01,0x01}
static

Definition at line 44 of file encode.c.

◆ bin10

const BYTE bin10[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
static

Definition at line 71 of file encode.c.

◆ bin11

const BYTE bin11[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
static

Definition at line 73 of file encode.c.

◆ bin12

const BYTE bin12[] = {0x02,0x09,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
static

Definition at line 74 of file encode.c.

◆ bin13

const BYTE bin13[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0}
static

Definition at line 75 of file encode.c.

◆ bin14

const BYTE bin14[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
static

Definition at line 82 of file encode.c.

◆ bin15

const BYTE bin15[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
static

Definition at line 83 of file encode.c.

◆ bin16

const BYTE bin16[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0}
static

Definition at line 84 of file encode.c.

◆ bin17

const BYTE bin17[] = {0x02,0x0c,0x00,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
static

Definition at line 85 of file encode.c.

◆ bin18

const BYTE bin18[] = {0x0a,0x01,0x01}
static

Definition at line 355 of file encode.c.

◆ bin19

const BYTE bin19[] = {0x0a,0x05,0x00,0xff,0xff,0xff,0x80}
static

Definition at line 356 of file encode.c.

◆ bin2

const BYTE bin2[] = {0x02,0x01,0x7f}
static

Definition at line 45 of file encode.c.

◆ bin20

const BYTE bin20[]
static
Initial value:
= {
0x17,0x0d,'0','5','0','6','0','6','1','6','1','0','0','0','Z'}

Definition at line 534 of file encode.c.

◆ bin21

const BYTE bin21[]
static
Initial value:
= {
0x18,0x0f,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','Z'}

Definition at line 536 of file encode.c.

◆ bin22

const BYTE bin22[]
static
Initial value:
= {
0x18,0x0f,'2','1','4','5','0','6','0','6','1','6','1','0','0','0','Z'}

Definition at line 538 of file encode.c.

◆ bin23

const BYTE bin23[]
static
Initial value:
= {
0x18,0x13,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','.','0','0','0','Z'}

Definition at line 559 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin24

const BYTE bin24[]
static
Initial value:
= {
0x18,0x13,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','.','9','9','9','Z'}

Definition at line 561 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin25

const BYTE bin25[]
static
Initial value:
= {
0x18,0x13,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','+','0','1','0','0'}

Definition at line 563 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin26

const BYTE bin26[]
static
Initial value:
= {
0x18,0x13,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','-','0','1','0','0'}

Definition at line 565 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin27

const BYTE bin27[]
static
Initial value:
= {
0x18,0x13,'1','9','4','5','0','6','0','6','1','6','1','0','0','0','-','0','1','1','5'}

Definition at line 567 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin28

const BYTE bin28[]
static
Initial value:
= {
0x18,0x0a,'2','1','4','5','0','6','0','6','1','6'}

Definition at line 569 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin29

const BYTE bin29[]
static
Initial value:
= {
0x17,0x0a,'4','5','0','6','0','6','1','6','1','0'}

Definition at line 571 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin3

const BYTE bin3[] = {0x02,0x02,0x00,0x80}
static

Definition at line 46 of file encode.c.

◆ bin30

const BYTE bin30[]
static
Initial value:
= {
0x17,0x0b,'4','5','0','6','0','6','1','6','1','0','Z'}

Definition at line 573 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin31

const BYTE bin31[]
static
Initial value:
= {
0x17,0x0d,'4','5','0','6','0','6','1','6','1','0','+','0','1'}

Definition at line 575 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin32

const BYTE bin32[]
static
Initial value:
= {
0x17,0x0d,'4','5','0','6','0','6','1','6','1','0','-','0','1'}

Definition at line 577 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin33

const BYTE bin33[]
static
Initial value:
= {
0x17,0x0f,'4','5','0','6','0','6','1','6','1','0','+','0','1','0','0'}

Definition at line 579 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin34

const BYTE bin34[]
static
Initial value:
= {
0x17,0x0f,'4','5','0','6','0','6','1','6','1','0','-','0','1','0','0'}

Definition at line 581 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin35

const BYTE bin35[]
static
Initial value:
= {
0x17,0x08, '4','5','0','6','0','6','1','6'}

Definition at line 583 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin36

const BYTE bin36[]
static
Initial value:
= {
0x18,0x0f, 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','Z'}

Definition at line 585 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin37

const BYTE bin37[]
static
Initial value:
= {
0x18,0x04, '2','1','4','5'}

Definition at line 587 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin38

const BYTE bin38[]
static
Initial value:
= {
0x18,0x08, '2','1','4','5','0','6','0','6'}

Definition at line 589 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin4

const BYTE bin4[] = {0x02,0x02,0x01,0x00}
static

Definition at line 47 of file encode.c.

◆ bin42

const BYTE bin42[] = { 0x16,0x02,0x80,0x00 }
static

Definition at line 1197 of file encode.c.

◆ bin43

const BYTE bin43[] = { 0x13,0x02,0x7e,0x00 }
static

Definition at line 1198 of file encode.c.

◆ bin44

const BYTE bin44[] = { 0x12,0x02,0x41,0x00 }
static

Definition at line 1199 of file encode.c.

◆ bin5

const BYTE bin5[] = {0x02,0x01,0x80}
static

Definition at line 48 of file encode.c.

◆ bin52

const unsigned char bin52[] = { 0x03,0x03,0x00,0xff,0xff }
static

Definition at line 2036 of file encode.c.

◆ bin53

const unsigned char bin53[] = { 0xff,0xff }
static

Definition at line 2037 of file encode.c.

◆ bin54

const unsigned char bin54[] = { 0x03,0x03,0x01,0xff,0xfe }
static

Definition at line 2038 of file encode.c.

◆ bin55

const unsigned char bin55[] = { 0xff,0xfe }
static

Definition at line 2039 of file encode.c.

◆ bin56

const unsigned char bin56[] = { 0x03,0x02,0x01,0xfe }
static

Definition at line 2040 of file encode.c.

◆ bin57

const unsigned char bin57[] = { 0xfe }
static

Definition at line 2041 of file encode.c.

◆ bin59

const unsigned char bin59[] = { 0x30,0x00 }
static

Definition at line 2139 of file encode.c.

◆ bin6

const BYTE bin6[] = {0x02,0x02,0xff,0x7f}
static

Definition at line 49 of file encode.c.

◆ bin60

const unsigned char bin60[] = { 0x30,0x03,0x01,0x01,0xff }
static

Definition at line 2140 of file encode.c.

◆ bin61

const unsigned char bin61[] = { 0x30,0x03,0x02,0x01,0x00 }
static

Definition at line 2141 of file encode.c.

◆ bin62

const unsigned char bin62[] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
static

Definition at line 2142 of file encode.c.

◆ bin63

const unsigned char bin63[] = { 0x30,0x06,0x01,0x01,0x01,0x02,0x01,0x01 }
static

Definition at line 2225 of file encode.c.

Referenced by test_decodeBasicConstraints().

◆ bin64

const unsigned char bin64[]
static
Initial value:
= {
0x30,0x0b,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0x03,0x01,0x00}

Definition at line 2836 of file encode.c.

◆ bin65

const unsigned char bin65[]
static
Initial value:
= {
0x30,0x09,0x30,0x04,0x06,0x02,0x2a,0x03,0x03,0x01,0x00}

Definition at line 2838 of file encode.c.

◆ bin66

const unsigned char bin66[]
static
Initial value:
= {
0x30,0x0f,0x30,0x0a,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x05,0x00,0x03,0x01,0x00}

Definition at line 2840 of file encode.c.

◆ bin67

const unsigned char bin67[]
static
Initial value:
= {
0x30,0x0d,0x30,0x08,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x01,0x00}

Definition at line 2842 of file encode.c.

◆ bin68

const unsigned char bin68[]
static
Initial value:
= {
0x30,0x1f,0x30,0x0a,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x05,0x00,0x03,0x11,0x00,0x00,0x01,
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}

Definition at line 2844 of file encode.c.

◆ bin69

const unsigned char bin69[]
static
Initial value:
= {
0x30,0x1d,0x30,0x08,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x11,0x00,0x00,0x01,
0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}

Definition at line 2847 of file encode.c.

◆ bin7

const BYTE bin7[] = {0x02,0x04,0xba,0xdd,0xf0,0x0d}
static

Definition at line 50 of file encode.c.

◆ bin70

const unsigned char bin70[]
static
Initial value:
= {
0x30,0x20,0x30,0x0b,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x01,0x01,
0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
0x0f}

Definition at line 2850 of file encode.c.

◆ bin71

const unsigned char bin71[]
static
Initial value:
= {
0x30,0x20,0x30,0x0b,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x01,0x01,
0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
0x0f}

Definition at line 2854 of file encode.c.

◆ bin72

unsigned char bin72[] = { 0x05,0x00}
static

Definition at line 2858 of file encode.c.

◆ bin8

const BYTE bin8[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0}
static

Definition at line 69 of file encode.c.

◆ bin9

const BYTE bin9[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0}
static

Definition at line 70 of file encode.c.

◆ bits

Initial value:
= {
{ 0, bin52, 2, bin53 },
{ 1, bin54, 2, bin55 },
{ 9, bin56, 1, bin57 },
}
static const unsigned char bin53[]
Definition: encode.c:2037
static const unsigned char bin57[]
Definition: encode.c:2041
static const unsigned char bin52[]
Definition: encode.c:2036
static const unsigned char bin56[]
Definition: encode.c:2040
static const unsigned char bin54[]
Definition: encode.c:2038
static const unsigned char bin55[]
Definition: encode.c:2039

Definition at line 2043 of file encode.c.

◆ bmpCommonNameValue

BYTE bmpCommonNameValue[]
static
Initial value:
= {
0x1e,0x14,0x00,0x4a,0x00,0x75,0x00,0x61,0x00,0x6e,0x00,0x20,0x00,0x4c,0x00,
0x61,0x00,0x6e,0x00,0x67,0x00,0x00 }

Definition at line 1218 of file encode.c.

◆ bogusDER

BYTE bogusDER[] = { 1 }
static

Definition at line 5960 of file encode.c.

Referenced by test_encodePKCSAttribute(), and test_encodePKCSContentInfo().

◆ bogusIA5

const char bogusIA5[] = "\x80"
static

Definition at line 1194 of file encode.c.

◆ bogusNumeric

const char bogusNumeric[] = "A"
static

Definition at line 1196 of file encode.c.

◆ bogusPKCSAttr

const BYTE bogusPKCSAttr[]
static
Initial value:
= { 0x30,0x07,0x06,0x02,0x2a,0x03,0x31,0x01,
0x01 }

Definition at line 6131 of file encode.c.

Referenced by test_decodePKCSAttribute(), and test_encodePKCSAttribute().

◆ bogusPKCSContentInfo

const BYTE bogusPKCSContentInfo[]
static
Initial value:
= { 0x30,0x07,0x06,0x02,0x2a,0x03,
0xa0,0x01,0x01 }

Definition at line 5956 of file encode.c.

Referenced by test_decodePKCSContentInfo(), and test_encodePKCSContentInfo().

◆ bogusPrintable

const char bogusPrintable[] = "~"
static

Definition at line 1195 of file encode.c.

◆ bytesToEncode

const BYTE bytesToEncode[] = { 0xff, 0xff }
static

Definition at line 2026 of file encode.c.

Referenced by test_encodeBits().

◆ CMSSignerWithKeyId

const BYTE CMSSignerWithKeyId[]
static
Initial value:
= {
0x30,0x14,0x02,0x01,0x00,0x80,0x01,0x01,0x30,0x04,0x06,0x00,0x05,0x00,0x30,
0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 6855 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), and test_encodeCMSSignerInfo().

◆ codeweavers

const BYTE codeweavers[]
static
Initial value:
= { 0x43, 0x6f, 0x64, 0x65, 0x57, 0x65, 0x61,
0x76, 0x65, 0x72, 0x73 }

Definition at line 676 of file encode.c.

◆ commonName

const char commonName[] = "Juan Lang"
static

◆ constraints2

const struct Constraints2 constraints2[]
static
Initial value:
= {
{ { FALSE, FALSE, 0}, bin59 },
{ { TRUE, FALSE, 0}, bin60 },
{ { FALSE, TRUE, 0}, bin61 },
{ { TRUE, TRUE, 1}, bin62 },
}
static const unsigned char bin59[]
Definition: encode.c:2139
static const unsigned char bin61[]
Definition: encode.c:2141
static const unsigned char bin60[]
Definition: encode.c:2140
static const unsigned char bin62[]
Definition: encode.c:2142

Definition at line 2143 of file encode.c.

Referenced by test_decodeBasicConstraints(), and test_encodeBasicConstraints().

◆ constraintWithDomainName

const BYTE constraintWithDomainName[]
static
Initial value:
= { 0x30, 0x32, 0x03, 0x01, 0x00,
0x30, 0x2d, 0x30, 0x2b, 0x31, 0x29, 0x30, 0x11, 0x06, 0x0a, 0x09, 0x92, 0x26,
0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03, 0x6f, 0x72, 0x67, 0x30,
0x14, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19,
0x16, 0x06, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71 }

Definition at line 2161 of file encode.c.

Referenced by test_decodeBasicConstraints(), and test_encodeBasicConstraints().

◆ content_abcd

const BYTE content_abcd[]
static
Initial value:
= {
ASN_SEQUENCE, 0x80,
ASN_OCTETSTRING, 4, 'a','b','c','d',
0,0,
0,0,
}
#define ASN_OCTETSTRING
Definition: snmp.h:105
#define ASN_CONSTRUCTOR
Definition: snmp.h:92
#define ASN_SEQUENCE
Definition: snmp.h:110
#define ASN_OBJECTIDENTIFIER
Definition: snmp.h:107
#define ASN_CONTEXT
Definition: snmp.h:89

Definition at line 6044 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ content_constructed_abcd

const BYTE content_constructed_abcd[]
static
Initial value:
= {
ASN_SEQUENCE, 0x80,
ASN_OCTETSTRING, 4, 'a','b','0','0',
0,0,
0,0,
0,0,
1,2,3,4,5,6,7
}

Definition at line 6057 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ crit_ext_data

BYTE crit_ext_data[] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
static

Definition at line 2720 of file encode.c.

◆ criticalExt

CERT_EXTENSION criticalExt
static
Initial value:
=
static BYTE crit_ext_data[]
Definition: encode.c:2720
static CHAR oid_basic_constraints2[]
Definition: encode.c:2722

Definition at line 2723 of file encode.c.

Referenced by test_encodeCertToBeSigned(), and test_encodeCRLToBeSigned().

◆ crlReason

const BYTE crlReason
static
Initial value:
#define CRL_REASON_AFFILIATION_CHANGED
Definition: wincrypt.h:2960
#define CRL_REASON_KEY_COMPROMISE
Definition: wincrypt.h:2958

Definition at line 3571 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ cspName

const char cspName[] = "WineCryptTemp"
static

Definition at line 8397 of file encode.c.

Referenced by testPortPublicKeyInfo().

◆ ctlWithAlgId

const BYTE ctlWithAlgId[]
static
Initial value:
= {
0x30,0x1b,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x06,0x06,0x02,0x2d,0x06,0x05,0x00 }

Definition at line 5427 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithBogusEntry

const BYTE ctlWithBogusEntry[]
static
Initial value:
= {
0x30,0x29,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00,0x30,0x10,0x30,0x0e,0x04,
0x01,0x01,0x31,0x09,0x30,0x07,0x06,0x02,0x2a,0x03,0x31,0x01,0x01 }

Definition at line 5430 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithListIdentifier

const BYTE ctlWithListIdentifier[]
static
Initial value:
= {
0x30,0x1a,0x30,0x00,0x04,0x01,0x01,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5414 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithOneEntry

const BYTE ctlWithOneEntry[]
static
Initial value:
= {
0x30,0x2a,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00,0x30,0x11,0x30,0x0f,0x04,
0x01,0x01,0x31,0x0a,0x30,0x08,0x06,0x02,0x2a,0x03,0x31,0x02,0x30,0x00 }

Definition at line 5434 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithSequenceNumber

const BYTE ctlWithSequenceNumber[]
static
Initial value:
= {
0x30,0x1a,0x30,0x00,0x02,0x01,0x01,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5417 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithThisAndNextUpdate

const BYTE ctlWithThisAndNextUpdate[]
static
Initial value:
= {
0x30,0x24,0x30,0x00,0x17,0x0d,0x30,0x35,0x30,0x36,0x30,0x36,0x31,0x36,0x31,
0x30,0x30,0x30,0x5a,0x17,0x0d,0x30,0x35,0x30,0x36,0x30,0x36,0x31,0x36,0x31,
0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5423 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithThisUpdate

const BYTE ctlWithThisUpdate[]
static
Initial value:
= {
0x30,0x15,0x30,0x00,0x17,0x0d,0x30,0x35,0x30,0x36,0x30,0x36,0x31,0x36,0x31,
0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5420 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithTwoEntries

const BYTE ctlWithTwoEntries[]
static
Initial value:
= {
0x30,0x41,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00,0x30,0x28,0x30,0x0f,0x04,
0x01,0x01,0x31,0x0a,0x30,0x08,0x06,0x02,0x2a,0x03,0x31,0x02,0x30,0x00,0x30,
0x15,0x04,0x01,0x01,0x31,0x10,0x30,0x0e,0x06,0x02,0x2d,0x06,0x31,0x08,0x30,
0x06,0x87,0x04,0x7f,0x00,0x00,0x01 }

Definition at line 5438 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ ctlWithUsageIdentifier

const BYTE ctlWithUsageIdentifier[]
static
Initial value:
= {
0x30,0x1b,0x30,0x04,0x06,0x02,0x2a,0x03,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,
0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5411 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ decoded_hi_octet

const unsigned char decoded_hi_octet[] = { 'h','i' }
static

Definition at line 1888 of file encode.c.

Referenced by test_decodeOctets(), and test_encodeOctets().

◆ decoded_something_long_octet

const unsigned char decoded_something_long_octet[]
static
Initial value:
= {
's','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g' }

Definition at line 1890 of file encode.c.

Referenced by test_decodeOctets(), and test_encodeOctets().

◆ decodedRdnAttrs

CERT_RDN_ATTR decodedRdnAttrs[]
static
Initial value:
= { { RDNA(us) },
{ RDNA(wine) },
{ RDNIA5(aric) } }
static const BYTE wine[]
Definition: encode.c:678
static const BYTE minnesota[]
Definition: encode.c:672
static const BYTE codeweavers[]
Definition: encode.c:676
static const BYTE us[]
Definition: encode.c:671
static const BYTE localhostAttr[]
Definition: encode.c:680
static const BYTE aric[]
Definition: encode.c:682
#define RDNA(arr)
Definition: encode.c:685
#define RDNIA5(arr)
Definition: encode.c:686
static const BYTE minneapolis[]
Definition: encode.c:674

Definition at line 702 of file encode.c.

Referenced by test_decodeName().

◆ distPointWithIssuer

const BYTE distPointWithIssuer[]
static
Initial value:
= { 0x30, 0x17, 0x30, 0x15, 0xa2, 0x13,
0x86, 0x11, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69, 0x6e, 0x65,
0x68, 0x71, 0x2e, 0x6f, 0x72, 0x67 }

Definition at line 3563 of file encode.c.

Referenced by test_encodeCRLDistPoints().

◆ distPointWithReason

const BYTE distPointWithReason[]
static
Initial value:
= { 0x30, 0x06, 0x30, 0x04, 0x81, 0x02,
0x00, 0x03 }

Definition at line 3561 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ distPointWithUrl

const BYTE distPointWithUrl[]
static
Initial value:
= { 0x30, 0x19, 0x30, 0x17, 0xa0, 0x15,
0xa0, 0x13, 0x86, 0x11, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69,
0x6e, 0x65, 0x68, 0x71, 0x2e, 0x6f, 0x72, 0x67 }

Definition at line 3558 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ distPointWithUrlAndIssuer

const BYTE distPointWithUrlAndIssuer[]
static
Initial value:
= { 0x30, 0x2e, 0x30, 0x2c, 0xa0,
0x15, 0xa0, 0x13, 0x86, 0x11, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77,
0x69, 0x6e, 0x65, 0x68, 0x71, 0x2e, 0x6f, 0x72, 0x67, 0xa2, 0x13, 0x86, 0x11,
0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71,
0x2e, 0x6f, 0x72, 0x67 }

Definition at line 3566 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ DNSExcludedConstraints

BYTE DNSExcludedConstraints[]
static
Initial value:
= {
0x30,0x17,0xa1,0x15,0x30,0x13,0x82,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67 }

Definition at line 7176 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ dnsName

const WCHAR dnsName[] = L"winehq.org"
static

Definition at line 1388 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ DNSSubtree

CERT_GENERAL_SUBTREE DNSSubtree
static
Initial value:
= {
{ CERT_ALT_NAME_DNS_NAME, { 0 } }, 0 }

Definition at line 7304 of file encode.c.

Referenced by test_decodeNameConstraints().

◆ doublePKCSAttributes

const BYTE doublePKCSAttributes[]
static
Initial value:
= { 0x31,0x13,0x30,0x06,0x06,0x02,
0x2a,0x03,0x31,0x00,0x30,0x09,0x06,0x02,0x2d,0x06,0x31,0x03,0x02,0x01,0x01 }

Definition at line 6243 of file encode.c.

Referenced by test_decodePKCSAttributes(), and test_encodePKCSAttributes().

◆ embedded_null

char embedded_null[] = "foo\0com"
static

Definition at line 1223 of file encode.c.

Referenced by test_decodeNameValue().

◆ embeddedNullNameValue

struct EncodedNameValue embeddedNullNameValue
static
Initial value:

Definition at line 1264 of file encode.c.

Referenced by test_decodeNameValue(), and test_encodeNameValue().

◆ emptyConstraint

const BYTE emptyConstraint[] = { 0x30, 0x03, 0x03, 0x01, 0x00 }
static

Definition at line 2156 of file encode.c.

Referenced by test_decodeBasicConstraints(), and test_encodeBasicConstraints().

◆ emptyCTL

const BYTE emptyCTL[]
static
Initial value:
= {
0x30,0x17,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5405 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ emptyCTLWithVersion1

const BYTE emptyCTLWithVersion1[]
static
Initial value:
= {
0x30,0x1a,0x02,0x01,0x01,0x30,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x02,0x06,0x00 }

Definition at line 5408 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ emptyDistPoint

const BYTE emptyDistPoint[] = { 0x30, 0x02, 0x30, 0x00 }
static

Definition at line 3557 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ emptyDNSExcludedConstraints

BYTE emptyDNSExcludedConstraints[]
static
Initial value:
= {
0x30,0x06,0xa1,0x04,0x30,0x02,0x82,0x00 }

Definition at line 7174 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ emptyDNSPermittedConstraints

BYTE emptyDNSPermittedConstraints[]
static
Initial value:
= {
0x30,0x06,0xa0,0x04,0x30,0x02,0x82,0x00 }

Definition at line 7172 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ emptyDNSSubtree

CERT_GENERAL_SUBTREE emptyDNSSubtree
static
Initial value:
= {
{ CERT_ALT_NAME_DNS_NAME, { 0 } }, 0 }

Definition at line 7302 of file encode.c.

◆ emptyIndefiniteSequence

const BYTE emptyIndefiniteSequence[] = { 0x30,0x80,0x00,0x00 }
static

Definition at line 1016 of file encode.c.

Referenced by test_decodeName().

◆ emptyNameIDP

const BYTE emptyNameIDP[] = { 0x30,0x04,0xa0,0x02,0xa0,0x00 }
static

Definition at line 3791 of file encode.c.

Referenced by test_decodeCRLIssuingDistPoint(), and test_encodeCRLIssuingDistPoint().

◆ emptyPKCSAttr

const BYTE emptyPKCSAttr[]
static
Initial value:
= { 0x30,0x06,0x06,0x02,0x2a,0x03,0x31,
0x00 }

Definition at line 6129 of file encode.c.

Referenced by test_decodePKCSAttribute(), and test_encodePKCSAttribute().

◆ emptyPKCSAttributes

const BYTE emptyPKCSAttributes[] = { 0x31,0x00 }
static

Definition at line 6240 of file encode.c.

Referenced by test_decodePKCSAttributes(), and test_encodePKCSAttributes().

◆ emptyPKCSContentInfo

const BYTE emptyPKCSContentInfo[] = { 0x30,0x04,0x06,0x02,0x2a,0x03 }
static

Definition at line 5953 of file encode.c.

Referenced by test_decodePKCSContentInfo(), and test_encodePKCSContentInfo().

◆ emptyPKCSContentInfoExtraBytes

const BYTE emptyPKCSContentInfoExtraBytes[]
static
Initial value:
= { 0x30,0x04,0x06,0x02,0x2a,
0x03,0,0,0,0,0,0 }

Definition at line 5954 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ emptyRDNs

const BYTE emptyRDNs[] = { 0x30, 0x02, 0x31, 0 }
static

Definition at line 659 of file encode.c.

Referenced by test_decodeName(), test_decodeUnicodeName(), and test_encodeName().

◆ emptySequence

◆ emptyURL

const BYTE emptyURL[] = { 0x30, 0x02, 0x86, 0x00 }
static

Definition at line 1382 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ emptyURLExtraBytes

const BYTE emptyURLExtraBytes[] = { 0x30, 0x02, 0x86, 0x00, 0, 0, 0 }
static

Definition at line 1383 of file encode.c.

Referenced by test_decodeAltName().

◆ encoded_abcd

const BYTE encoded_abcd[]
static
Initial value:
= {
ASN_OCTETSTRING, 4, 'a','b','c','d',
}

Definition at line 6053 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ encoded_constructed_hi_octet

const unsigned char encoded_constructed_hi_octet[]
static
Initial value:
=

Definition at line 1943 of file encode.c.

Referenced by test_decodeOctets().

◆ encoded_constructed_hi_octet2

const unsigned char encoded_constructed_hi_octet2[]
static
Initial value:

Definition at line 1945 of file encode.c.

Referenced by test_decodeOctets().

◆ encoded_constructed_hi_octet3

const unsigned char encoded_constructed_hi_octet3[]
static
Initial value:

Definition at line 1947 of file encode.c.

Referenced by test_decodeOctets().

◆ encoded_constructed_hi_octet_invalid_end

const unsigned char encoded_constructed_hi_octet_invalid_end[]
static
Initial value:
=

Definition at line 1949 of file encode.c.

Referenced by test_decodeOctets().

◆ encoded_empty_octet

const unsigned char encoded_empty_octet[] = { ASN_OCTETSTRING,0 }
static

Definition at line 1894 of file encode.c.

Referenced by test_decodeOctets(), and test_encodeOctets().

◆ encoded_hi_octet

const unsigned char encoded_hi_octet[] = { ASN_OCTETSTRING,2,'h','i' }
static

Definition at line 1889 of file encode.c.

Referenced by test_decodeOctets(), and test_encodeOctets().

◆ encoded_something_long_octet

const unsigned char encoded_something_long_octet[]
static
Initial value:
= {
ASN_OCTETSTRING,15,'s','o','m','e','l','o','n','g',0xff,'s','t','r','i','n','g' }

Definition at line 1892 of file encode.c.

Referenced by test_decodeOctets(), and test_encodeOctets().

◆ encodedCommonName

const unsigned char encodedCommonName[]
static

◆ encodedCommonNameNoNull

BYTE encodedCommonNameNoNull[]
static
Initial value:
= { 0x30,0x14,0x31,0x12,0x30,0x10,
0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67 }

Definition at line 6536 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ encodedDirectoryName

const BYTE encodedDirectoryName[]
static
Initial value:
= {
0x30,0x19,0xa4,0x17,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1397 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ encodedDnsName

const BYTE encodedDnsName[]
static
Initial value:
= { 0x30, 0x0c, 0x82, 0x0a, 0x77, 0x69,
0x6e, 0x65, 0x68, 0x71, 0x2e, 0x6f, 0x72, 0x67 }

Definition at line 1389 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ encodedDomainName

const BYTE encodedDomainName[]
static
Initial value:
= { 0x30, 0x2b, 0x31, 0x29, 0x30, 0x11,
0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16,
0x03, 0x6f, 0x72, 0x67, 0x30, 0x14, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93,
0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x06, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71 }

Definition at line 2157 of file encode.c.

Referenced by test_decodeBasicConstraints(), and test_encodeBasicConstraints().

◆ encodedIPAddr

const BYTE encodedIPAddr[]
static

◆ encodedNameConstraints

◆ encodedOidName

const BYTE encodedOidName[] = { 0x30,0x04,0x88,0x02,0x2a,0x03 }
static

Definition at line 1396 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ encodedRDNAttrs

const BYTE encodedRDNAttrs[]
static
Initial value:
= {
0x30,0x81,0x96,0x31,0x81,0x93,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
0x53,0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x6c,0x6f,0x63,0x61,0x6c,0x68,
0x6f,0x73,0x74,0x30,0x10,0x06,0x03,0x55,0x04,0x08,0x13,0x09,0x4d,0x69,0x6e,0x6e,
0x65,0x73,0x6f,0x74,0x61,0x30,0x12,0x06,0x03,0x55,0x04,0x07,0x13,0x0b,0x4d,0x69,
0x6e,0x6e,0x65,0x61,0x70,0x6f,0x6c,0x69,0x73,0x30,0x12,0x06,0x03,0x55,0x04,0x0a,
0x13,0x0b,0x43,0x6f,0x64,0x65,0x57,0x65,0x61,0x76,0x65,0x72,0x73,0x30,0x17,0x06,
0x03,0x55,0x04,0x0b,0x13,0x10,0x57,0x69,0x6e,0x65,0x20,0x44,0x65,0x76,0x65,0x6c,
0x6f,0x70,0x6d,0x65,0x6e,0x74,0x30,0x21,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x01,0x09,0x01,0x16,0x14,0x61,0x72,0x69,0x63,0x40,0x63,0x6f,0x64,0x65,0x77,0x65,
0x61,0x76,0x65,0x72,0x73,0x2e,0x63,0x6f,0x6d
}

Definition at line 713 of file encode.c.

Referenced by test_decodeName(), and test_encodeName().

◆ encodedTwoRDNs

const BYTE encodedTwoRDNs[]
static
Initial value:
= {
0x30,0x2e,0x31,0x2c,0x30,0x2a,0x06,0x03,0x55,0x04,0x03,0x30,0x23,0x31,0x21,
0x30,0x0c,0x06,0x03,0x55,0x04,0x04,0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,
}

Definition at line 664 of file encode.c.

Referenced by test_encodeName(), and test_encodeUnicodeName().

◆ encodedURL

const BYTE encodedURL[]
static
Initial value:
= { 0x30, 0x13, 0x86, 0x11, 0x68, 0x74,
0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71, 0x2e,
0x6f, 0x72, 0x67 }

Definition at line 1385 of file encode.c.

Referenced by test_decodeAltName(), and test_encodeAltName().

◆ encodedUsage

const BYTE encodedUsage[]
static
Initial value:
= {
0x30, 0x1f, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03,
0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x06, 0x09,
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01 }

Definition at line 4836 of file encode.c.

Referenced by test_decodeEnhancedKeyUsage(), and test_encodeEnhancedKeyUsage().

◆ enumeratedTypes

const LPCSTR enumeratedTypes[]
static
Initial value:
#define X509_ENUMERATED
Definition: wincrypt.h:3547
#define szOID_CRL_REASON_CODE
Definition: wincrypt.h:3347

Definition at line 369 of file encode.c.

Referenced by test_decodeEnumerated(), and test_encodeEnumerated().

◆ enums

const struct encodedInt enums[]
static
Initial value:
= {
{ 1, bin18 },
{ -128, bin19 },
}
static const BYTE bin19[]
Definition: encode.c:356
static const BYTE bin18[]
Definition: encode.c:355

Definition at line 361 of file encode.c.

Referenced by test_decodeEnumerated(), test_encodeEnumerated(), type_new_enum(), and write_enums().

◆ expiredCert

const BYTE expiredCert[]
static
Initial value:
= { 0x30, 0x82, 0x01, 0x33, 0x30, 0x81, 0xe2,
0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0xc4, 0xd7, 0x7f, 0x0e, 0x6f, 0xa6,
0x8c, 0xaa, 0x47, 0x47, 0x40, 0xe7, 0xb7, 0x0b, 0x4a, 0x7f, 0x30, 0x09, 0x06,
0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1d, 0x05, 0x00, 0x30, 0x1f, 0x31, 0x1d, 0x30,
0x1b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x61, 0x72, 0x69, 0x63, 0x40,
0x63, 0x6f, 0x64, 0x65, 0x77, 0x65, 0x61, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x63,
0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x36, 0x39, 0x30, 0x31, 0x30, 0x31, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30,
0x31, 0x30, 0x36, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x1f, 0x31, 0x1d, 0x30,
0x1b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x61, 0x72, 0x69, 0x63, 0x40,
0x63, 0x6f, 0x64, 0x65, 0x77, 0x65, 0x61, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x63,
0x6f, 0x6d, 0x30, 0x5c, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41,
0x00, 0xa1, 0xaf, 0x4a, 0xea, 0xa7, 0x83, 0x57, 0xc0, 0x37, 0x33, 0x7e, 0x29,
0x5e, 0x0d, 0xfc, 0x44, 0x74, 0x3a, 0x1d, 0xc3, 0x1b, 0x1d, 0x96, 0xed, 0x4e,
0xf4, 0x1b, 0x98, 0xec, 0x69, 0x1b, 0x04, 0xea, 0x25, 0xcf, 0xb3, 0x2a, 0xf5,
0xd9, 0x22, 0xd9, 0x8d, 0x08, 0x39, 0x81, 0xc6, 0xe0, 0x4f, 0x12, 0x37, 0x2a,
0x3f, 0x80, 0xa6, 0x6c, 0x67, 0x43, 0x3a, 0xdd, 0x95, 0x0c, 0xbb, 0x2f, 0x6b,
0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
0x1d, 0x05, 0x00, 0x03, 0x41, 0x00, 0x8f, 0xa2, 0x5b, 0xd6, 0xdf, 0x34, 0xd0,
0xa2, 0xa7, 0x47, 0xf1, 0x13, 0x79, 0xd3, 0xf3, 0x39, 0xbd, 0x4e, 0x2b, 0xa3,
0xf4, 0x63, 0x37, 0xac, 0x5a, 0x0c, 0x5e, 0x4d, 0x0d, 0x54, 0x87, 0x4f, 0x31,
0xfb, 0xa0, 0xce, 0x8f, 0x9a, 0x2f, 0x4d, 0x48, 0xc6, 0x84, 0x8d, 0xf5, 0x70,
0x74, 0x17, 0xa5, 0xf3, 0x66, 0x47, 0x06, 0xd6, 0x64, 0x45, 0xbc, 0x52, 0xef,
0x49, 0xe5, 0xf9, 0x65, 0xf3 }

Definition at line 8283 of file encode.c.

Referenced by testImportPublicKey().

◆ ext0

const BYTE ext0[] = { 0x30,0x00 }
static

Definition at line 2731 of file encode.c.

◆ ext1

const BYTE ext1[]
static
Initial value:
= { 0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 2732 of file encode.c.

Referenced by compareExt(), sync_ext_cutoff_points(), and test_filename().

◆ ext2

const BYTE ext2[]
static
Initial value:
= { 0x30,0x11,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x04,
0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 2734 of file encode.c.

Referenced by __attribute__(), add_ext_holes(), compareExt(), divide_ext(), duplicate_extents(), duplicate_fcb(), set_zero_data(), sync_ext_cutoff_points(), test_filename(), and vol_get_disk_extents().

◆ ext3

const BYTE ext3[] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 }
static

Definition at line 2736 of file encode.c.

Referenced by vol_get_disk_extents().

◆ exts

Initial value:
= {
{ { 0, NULL }, ext0 },
{ { 1, &criticalExt }, ext1 },
{ { 1, &nonCriticalExt }, ext2 },
{ { 1, &extWithShortOid }, ext3 }
}
static const BYTE ext1[]
Definition: encode.c:2732
static const BYTE ext2[]
Definition: encode.c:2734
static CERT_EXTENSION extWithShortOid
Definition: encode.c:2728
static const BYTE ext0[]
Definition: encode.c:2731
static const BYTE ext3[]
Definition: encode.c:2736

Definition at line 2738 of file encode.c.

Referenced by add_ext_holes(), CRYPT_AsnDecodeExtensions(), CRYPT_AsnEncodeExtensions(), test_decodeExtensions(), test_encodeExtensions(), and test_PlaySound().

◆ extWithShortOid

CERT_EXTENSION extWithShortOid
static
Initial value:
=
{ oid_short, FALSE, { 0, NULL } }
static CHAR oid_short[]
Definition: encode.c:2727

Definition at line 2728 of file encode.c.

◆ generalCommonNameValue

BYTE generalCommonNameValue[]
static
Initial value:
= {
0x1b,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1216 of file encode.c.

◆ graphicCommonNameValue

BYTE graphicCommonNameValue[]
static
Initial value:
= {
0x19,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1212 of file encode.c.

◆ hash

const BYTE hash[]
static
Initial value:
= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd,
0xe, 0xf }

Definition at line 3387 of file encode.c.

Referenced by test_encodeCert(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ ia5CommonNameValue

BYTE ia5CommonNameValue[]
static
Initial value:
= {
0x16,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1210 of file encode.c.

◆ ia5EmbeddedNull

BYTE ia5EmbeddedNull[]
static
Initial value:
= {
0x16,0x07,0x66,0x6f,0x6f,0x00,0x63,0x6f,0x6d }

Definition at line 1224 of file encode.c.

Referenced by test_decodeNameValue().

◆ indefiniteSignedPKCSContent

const BYTE indefiniteSignedPKCSContent[]
static
Initial value:
= {
0x30,0x80,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,0x80,
0x30,0x80,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,
0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x80,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,
0x0d,0x01,0x07,0x01,0xa0,0x80,0x24,0x80,0x04,0x04,0x01,0x02,0x03,0x04,0x04,
0x04,0x01,0x02,0x03,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x81,0xd2,0x30,
0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,
0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,0x02,0x41,0x00,0xe2,0x54,0x3a,0xa7,
0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,0x53,0xe6,0x1f,0xe7,0x5d,0xf1,0x21,
0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,0x65,0x97,0x03,0x86,0x60,0xde,0xf3,
0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,0x62,0x17,0xa9,0xcd,0x79,0x3f,0x21,
0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,0x18,0x10,0x6b,0xd0,0x1c,0x10,0x79,
0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,
0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01,0x31,
0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,
0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x40,0x57,0xba,0xe0,0xad,
0xfe,0x36,0x8d,0xb3,0x88,0xa2,0x8d,0x84,0x82,0x52,0x09,0x09,0xd9,0xf0,0xb8,
0x04,0xfa,0xb5,0x51,0x0b,0x2b,0x2e,0xd5,0x72,0x3e,0x3d,0x13,0x8a,0x51,0xc3,
0x71,0x65,0x9a,0x52,0xf2,0x8f,0xb2,0x5b,0x39,0x28,0xb3,0x29,0x36,0xa5,0x8d,
0xe3,0x55,0x71,0x91,0xf9,0x2a,0xd1,0xb8,0xaa,0x52,0xb8,0x22,0x3a,0xeb,0x61,
0x00,0x00,0x00,0x00,0x00,0x00 }

Definition at line 6014 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ intPKCSAttr

const BYTE intPKCSAttr[]
static
Initial value:
= { 0x30,0x09,0x06,0x02,0x2a,0x03,0x31,0x03,
0x02,0x01,0x01 }

Definition at line 6133 of file encode.c.

Referenced by test_decodePKCSAttribute(), and test_encodePKCSAttribute().

◆ intPKCSContentInfo

const BYTE intPKCSContentInfo[]
static
Initial value:
= { 0x30,0x09,0x06,0x02,0x2a,0x03,0xa0,
0x03,0x02,0x01,0x01 }

Definition at line 5958 of file encode.c.

Referenced by test_decodePKCSContentInfo(), and test_encodePKCSContentInfo().

◆ ints

const struct encodedInt ints[]
static
Initial value:
= {
{ 1, bin1 },
{ 127, bin2 },
{ 128, bin3 },
{ 256, bin4 },
{ -128, bin5 },
{ -129, bin6 },
{ 0xbaddf00d, bin7 },
}
static const BYTE bin6[]
Definition: encode.c:49
static const BYTE bin4[]
Definition: encode.c:47
static const BYTE bin5[]
Definition: encode.c:48
static const BYTE bin7[]
Definition: encode.c:50
static const BYTE bin1[]
Definition: encode.c:44
static const BYTE bin2[]
Definition: encode.c:45
static const BYTE bin3[]
Definition: encode.c:46

Definition at line 52 of file encode.c.

Referenced by IStreamIteratorTest::copy_n_test(), TConsole::ReverseOn(), AlgTest::search_n_test(), test_decodeInt(), test_decodePKCSAttribute(), test_decodePKCSAttributes(), test_decodePKCSContentInfo(), test_decodeSequenceOfAny(), test_encodeInt(), test_encodePKCSAttribute(), test_encodePKCSAttributes(), test_encodePKCSContentInfo(), and test_encodeSequenceOfAny().

◆ intSequence

const BYTE intSequence[]
static
Initial value:
= { 0x30, 0x1b, 0x02, 0x01, 0x01, 0x02, 0x01,
0x7f, 0x02, 0x02, 0x00, 0x80, 0x02, 0x02, 0x01, 0x00, 0x02, 0x01, 0x80, 0x02,
0x02, 0xff, 0x7f, 0x02, 0x04, 0xba, 0xdd, 0xf0, 0x0d }

Definition at line 2617 of file encode.c.

Referenced by test_decodeSequenceOfAny(), and test_encodeSequenceOfAny().

◆ IPAddressSubtree

CERT_GENERAL_SUBTREE IPAddressSubtree
static
Initial value:
= {
{ CERT_ALT_NAME_IP_ADDRESS, { 0 } }, 0 }

Definition at line 7306 of file encode.c.

Referenced by test_decodeNameConstraints().

◆ IPAddressWithMinMaxSubtree

CERT_GENERAL_SUBTREE IPAddressWithMinMaxSubtree
static
Initial value:
= {
{ CERT_ALT_NAME_IP_ADDRESS, { 0 } }, 5, TRUE, 3 }

Definition at line 7310 of file encode.c.

Referenced by test_decodeNameConstraints().

◆ IPAddressWithMinSubtree

CERT_GENERAL_SUBTREE IPAddressWithMinSubtree
static
Initial value:
= {
{ CERT_ALT_NAME_IP_ADDRESS, { 0 } }, 5, 0 }

Definition at line 7308 of file encode.c.

Referenced by test_decodeNameConstraints().

◆ keyId

◆ keyUsages

const LPCSTR keyUsages[]
static
Initial value:
#define szOID_PKIX_KP_CLIENT_AUTH
Definition: wincrypt.h:3451
#define szOID_PKIX_KP_CODE_SIGNING
Definition: wincrypt.h:3452

Definition at line 4834 of file encode.c.

Referenced by test_decodeEnhancedKeyUsage(), and test_encodeEnhancedKeyUsage().

◆ localhost

◆ localhostAttr

const BYTE localhostAttr[]
static
Initial value:
= { 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f,
0x73, 0x74 }

Definition at line 680 of file encode.c.

◆ mappingOids

const LPCSTR mappingOids[]
static
Initial value:
#define X509_POLICY_MAPPINGS
Definition: wincrypt.h:3578
#define szOID_POLICY_MAPPINGS
Definition: wincrypt.h:3355
#define szOID_LEGACY_POLICY_MAPPINGS
Definition: wincrypt.h:3335

Definition at line 7661 of file encode.c.

Referenced by test_decodeCertPolicyMappings(), and test_encodeCertPolicyMappings().

◆ minimalPKCSSigner

const BYTE minimalPKCSSigner[]
static
Initial value:
= {
0x30,0x2b,0x02,0x01,0x00,0x30,0x18,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,0x00 }

Definition at line 6539 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ minneapolis

const BYTE minneapolis[]
static
Initial value:
= { 0x4d, 0x69, 0x6e, 0x6e, 0x65, 0x61, 0x70,
0x6f, 0x6c, 0x69, 0x73 }

Definition at line 674 of file encode.c.

◆ minnesota

const BYTE minnesota[]
static
Initial value:
= { 0x4d, 0x69, 0x6e, 0x6e, 0x65, 0x73, 0x6f,
0x74, 0x61 }

Definition at line 672 of file encode.c.

◆ mixedSequence

const BYTE mixedSequence[]
static
Initial value:
= { 0x30, 0x27, 0x17, 0x0d, 0x30, 0x35, 0x30,
0x36, 0x30, 0x36, 0x31, 0x36, 0x31, 0x30, 0x30, 0x30, 0x5a, 0x02, 0x01, 0x7f,
0x02, 0x02, 0x00, 0x80, 0x02, 0x02, 0x01, 0x00, 0x02, 0x01, 0x80, 0x02, 0x02,
0xff, 0x7f, 0x02, 0x04, 0xba, 0xdd, 0xf0, 0x0d }

Definition at line 2621 of file encode.c.

Referenced by test_decodeSequenceOfAny(), and test_encodeSequenceOfAny().

◆ mod1_encoded

const BYTE mod1_encoded[] = { 0x30,0x0f,0x02,0x08,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x03,0x02,0x00,0x01 }
static

Definition at line 2324 of file encode.c.

◆ mod2_encoded

const BYTE mod2_encoded[] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x02,0x00,0x01 }
static

Definition at line 2325 of file encode.c.

◆ mod3_encoded

const BYTE mod3_encoded[] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x80,0x02,0x03,0x02,0x00,0x01 }
static

Definition at line 2326 of file encode.c.

◆ mod4_encoded

const BYTE mod4_encoded[] = { 0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x02,0x00,0x01 }
static

Definition at line 2327 of file encode.c.

◆ modulus1

const BYTE modulus1[] = { 0,0,0,1,1,1,1,1 }
static

Definition at line 2320 of file encode.c.

Referenced by test_encodeRsaPublicKey(), and test_encodeRsaPublicKey_Bcrypt().

◆ modulus2

const BYTE modulus2[] = { 1,1,1,1,1,0,0,0 }
static

Definition at line 2321 of file encode.c.

◆ modulus3

const BYTE modulus3[] = { 0x80,1,1,1,1,0,0,0 }
static

Definition at line 2322 of file encode.c.

◆ modulus4

const BYTE modulus4[] = { 1,1,1,1,1,0,0,0x80 }
static

Definition at line 2323 of file encode.c.

◆ nameValues

struct EncodedNameValue nameValues[]
static

Definition at line 1227 of file encode.c.

Referenced by test_decodeNameValue(), and test_encodeNameValue().

◆ nihongoBMP

BYTE nihongoBMP[]
static
Initial value:
= { 0x1e,0x12,0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,
0x00,0x3a,0x00,0x2f,0x00,0x2f,0x22,0x6f,0x57,0x5b }

Definition at line 1731 of file encode.c.

◆ nihongoGeneral

BYTE nihongoGeneral[]
static
Initial value:
= { 0x1b,0x09,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
0x6f,0x5b }

Definition at line 1729 of file encode.c.

◆ nihongoT61

BYTE nihongoT61[]
static
Initial value:
= { 0x14,0x09,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,
0x5b }

Definition at line 1727 of file encode.c.

◆ nihongoUTF8

BYTE nihongoUTF8[]
static
Initial value:
= { 0x0c,0x0d,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
0xe2,0x89,0xaf,0xe5,0x9d,0x9b }

Definition at line 1733 of file encode.c.

◆ noncrit_ext_data

BYTE noncrit_ext_data[] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }
static

Definition at line 2721 of file encode.c.

◆ nonCriticalExt

CERT_EXTENSION nonCriticalExt
static
Initial value:
=
static BYTE noncrit_ext_data[]
Definition: encode.c:2721

Definition at line 2725 of file encode.c.

Referenced by test_encodeCRLToBeSigned().

◆ noticeNumbers

int noticeNumbers[] = { 2,3 }
static

◆ noticeWithDisplayText

const BYTE noticeWithDisplayText[]
static
Initial value:
= {
0x30,0x22,0x1e,0x20,0x00,0x54,0x00,0x68,0x00,0x69,0x00,0x73,0x00,0x20,0x00,
0x69,0x00,0x73,0x00,0x20,0x00,0x61,0x00,0x20,0x00,0x6e,0x00,0x6f,0x00,0x74,
0x00,0x69,0x00,0x63,0x00,0x65
}

Definition at line 7390 of file encode.c.

Referenced by test_decodePolicyQualifierUserNotice(), and test_encodePolicyQualifierUserNotice().

◆ noticeWithReference

BYTE noticeWithReference[]
static
Initial value:
= {
0x30,0x32,0x30,0x0e,0x16,0x04,0x57,0x69,0x6e,0x65,0x30,0x06,0x02,0x01,0x02,
0x02,0x01,0x03,0x1e,0x20,0x00,0x54,0x00,0x68,0x00,0x69,0x00,0x73,0x00,0x20,
0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x61,0x00,0x20,0x00,0x6e,0x00,0x6f,0x00,
0x74,0x00,0x69,0x00,0x63,0x00,0x65
}

Definition at line 7397 of file encode.c.

Referenced by test_decodeCertPolicies(), test_decodePolicyQualifierUserNotice(), test_encodeCertPolicies(), and test_encodePolicyQualifierUserNotice().

◆ numericCommonNameValue

BYTE numericCommonNameValue[]
static
Initial value:
= {
0x12,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1202 of file encode.c.

◆ ocsp_basic_response

const BYTE ocsp_basic_response[]
static
Initial value:
= {
0x30, 0x81, 0x9e, 0xa2, 0x16, 0x04, 0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8,
0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4, 0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95,
0x76, 0xb9, 0xf4, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x30, 0x33, 0x31,
0x30, 0x31, 0x38, 0x33, 0x36, 0x34, 0x38, 0x5a, 0x30, 0x73, 0x30, 0x71,
0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05,
0x00, 0x04, 0x14, 0xe4, 0xe3, 0x95, 0xa2, 0x29, 0xd3, 0xd4, 0xc1, 0xc3,
0x1f, 0xf0, 0x98, 0x0c, 0x0b, 0x4e, 0xc0, 0x09, 0x8a, 0xab, 0xd8, 0x04,
0x14, 0xb7, 0x6b, 0xa2, 0xea, 0xa8, 0xaa, 0x84, 0x8c, 0x79, 0xea, 0xb4,
0xda, 0x0f, 0x98, 0xb2, 0xc5, 0x95, 0x76, 0xb9, 0xf4, 0x02, 0x10, 0x08,
0x49, 0x8f, 0x6d, 0xd9, 0xef, 0xfb, 0x40, 0x55, 0x1e, 0xac, 0x54, 0x54,
0x87, 0xc1, 0xb1, 0x80, 0x00, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x30,
0x33, 0x31, 0x30, 0x31, 0x38, 0x32, 0x31, 0x30, 0x31, 0x5a, 0xa0, 0x11,
0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x30, 0x33, 0x31, 0x37, 0x31, 0x37,
0x33, 0x36, 0x30, 0x31, 0x5a
}

Definition at line 8661 of file encode.c.

Referenced by test_decodeOCSPBasicResponseInfo(), and test_decodeOCSPBasicSignedResponseInfo().

◆ ocsp_basic_response2

const BYTE ocsp_basic_response2[]
static
Initial value:
= {
0x30, 0x81, 0xbe, 0xa1, 0x34, 0x30, 0x32, 0x31, 0x0b, 0x30, 0x09, 0x06,
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x16, 0x30, 0x14,
0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0d, 0x4c, 0x65, 0x74, 0x27, 0x73,
0x20, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x31, 0x0b, 0x30, 0x09,
0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x02, 0x52, 0x33, 0x18, 0x0f, 0x32,
0x30, 0x32, 0x32, 0x31, 0x30, 0x32, 0x30, 0x30, 0x36, 0x30, 0x31, 0x30,
0x30, 0x5a, 0x30, 0x75, 0x30, 0x73, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x05,
0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0x48, 0xda, 0xc9,
0xa0, 0xfb, 0x2b, 0xd3, 0x2d, 0x4f, 0xf0, 0xde, 0x68, 0xd2, 0xf5, 0x67,
0xb7, 0x35, 0xf9, 0xb3, 0xc4, 0x04, 0x14, 0x14, 0x2e, 0xb3, 0x17, 0xb7,
0x58, 0x56, 0xcb, 0xae, 0x50, 0x09, 0x40, 0xe6, 0x1f, 0xaf, 0x9d, 0x8b,
0x14, 0xc2, 0xc6, 0x02, 0x12, 0x03, 0x26, 0x1c, 0x82, 0x80, 0xf3, 0x8c,
0x13, 0xef, 0xae, 0x83, 0x9d, 0x89, 0xb9, 0xcd, 0x59, 0x83, 0x5b, 0x80,
0x00, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x31, 0x30, 0x32, 0x30, 0x30,
0x36, 0x30, 0x30, 0x30, 0x30, 0x5a, 0xa0, 0x11, 0x18, 0x0f, 0x32, 0x30,
0x32, 0x32, 0x31, 0x30, 0x32, 0x37, 0x30, 0x35, 0x35, 0x39, 0x35, 0x38,
0x5a
}

Definition at line 8678 of file encode.c.

Referenced by test_decodeOCSPBasicResponseInfo().

◆ ocsp_basic_response_revoked

const BYTE ocsp_basic_response_revoked[]
static
Initial value:
= {
0x30, 0x81, 0xb1, 0xa2, 0x16, 0x04, 0x14, 0xa4, 0x8d, 0xe5, 0xbe, 0x7c,
0x79, 0xe4, 0x70, 0x23, 0x6d, 0x2e, 0x29, 0x34, 0xad, 0x23, 0x58, 0xdc,
0xf5, 0x31, 0x7f, 0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33,
0x31, 0x30, 0x31, 0x32, 0x35, 0x30, 0x35, 0x5a, 0x30, 0x81, 0x85, 0x30,
0x81, 0x82, 0x30, 0x49, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,
0x1a, 0x05, 0x00, 0x04, 0x14, 0x74, 0xb4, 0xe7, 0x23, 0x19, 0xc7, 0x65,
0x92, 0x15, 0x40, 0x44, 0x7b, 0xc7, 0xce, 0x3e, 0x90, 0xc2, 0x18, 0x76,
0xeb, 0x04, 0x14, 0xa4, 0x8d, 0xe5, 0xbe, 0x7c, 0x79, 0xe4, 0x70, 0x23,
0x6d, 0x2e, 0x29, 0x34, 0xad, 0x23, 0x58, 0xdc, 0xf5, 0x31, 0x7f, 0x02,
0x10, 0x0d, 0x2e, 0x67, 0xa2, 0x98, 0x85, 0x3b, 0x9a, 0x54, 0x52, 0xe3,
0xa2, 0x85, 0xa4, 0x57, 0x2f, 0xa1, 0x11, 0x18, 0x0f, 0x32, 0x30, 0x32,
0x31, 0x31, 0x30, 0x32, 0x37, 0x32, 0x31, 0x33, 0x38, 0x34, 0x38, 0x5a,
0x18, 0x0f, 0x32, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33, 0x31, 0x30, 0x31,
0x30, 0x39, 0x30, 0x31, 0x5a, 0xa0, 0x11, 0x18, 0x0f, 0x32, 0x30, 0x32,
0x32, 0x30, 0x34, 0x30, 0x37, 0x30, 0x30, 0x32, 0x34, 0x30, 0x31, 0x5a
}

Definition at line 8698 of file encode.c.

Referenced by test_decodeOCSPBasicResponseInfo().

◆ ocsp_basic_signed_response

const BYTE ocsp_basic_signed_response[]
static

Definition at line 8621 of file encode.c.

Referenced by test_decodeOCSPBasicSignedResponseInfo().

◆ ocsp_basic_signed_response_with_cert

const BYTE ocsp_basic_signed_response_with_cert[]
static

Definition at line 8741 of file encode.c.

Referenced by test_decodeOCSPBasicSignedResponseInfo().

◆ ocsp_response

const BYTE ocsp_response[]
static
Initial value:
= {
0x30, 0x03, 0x0a, 0x01, 0x06
}

Definition at line 8549 of file encode.c.

Referenced by test_decodeOCSPResponseInfo().

◆ ocsp_response2

const BYTE ocsp_response2[]
static

Definition at line 8553 of file encode.c.

Referenced by test_decodeOCSPResponseInfo().

◆ ocsp_signature

const BYTE ocsp_signature[]
static
Initial value:
= {
0x6a, 0x4c, 0xfa, 0xe6, 0xe3, 0x48, 0xbb, 0xd6, 0x18, 0x33, 0x04, 0x9d,
0x6a, 0x92, 0x4d, 0x01, 0x74, 0x4f, 0x1a, 0x70, 0xfa, 0xf2, 0x8b, 0xba,
0x0d, 0x2c, 0x06, 0x30, 0xc9, 0x55, 0xce, 0x95, 0x13, 0x4d, 0x4c, 0x65,
0x99, 0xe7, 0xd6, 0x78, 0x9c, 0x3c, 0x9a, 0x60, 0xeb, 0x43, 0x3c, 0x08,
0x1c, 0x02, 0x6d, 0x45, 0x2d, 0x5b, 0xdf, 0xab, 0xf2, 0x92, 0xf1, 0x71,
0x61, 0xb4, 0x34, 0xcf, 0x84, 0x1f, 0xc9, 0x3f, 0x45, 0x9e, 0x64, 0x89,
0x58, 0xdb, 0x2c, 0x73, 0xa8, 0x04, 0xae, 0xad, 0xf2, 0xc5, 0x80, 0x80,
0xcf, 0x96, 0x4b, 0xf1, 0xb4, 0xf1, 0x2a, 0x86, 0x1c, 0x7f, 0x1d, 0xcc,
0xbf, 0xd6, 0xa2, 0x3f, 0x44, 0xb8, 0x62, 0x5b, 0x9b, 0x55, 0xc1, 0x4e,
0x18, 0x67, 0x5a, 0xbe, 0x31, 0xf5, 0x16, 0x6d, 0x74, 0xc4, 0xf2, 0x60,
0x4f, 0xa1, 0x63, 0x49, 0xe9, 0xff, 0x37, 0x3d, 0x66, 0xcd, 0xc3, 0x79,
0x4e, 0x38, 0x68, 0x1b, 0xbf, 0x0b, 0x3b, 0xdb, 0xa0, 0x13, 0x70, 0xb8,
0xd1, 0x59, 0xe2, 0x8e, 0x88, 0xfe, 0x77, 0x39, 0xa8, 0x3f, 0x93, 0xe1,
0xc6, 0x5e, 0x13, 0x9e, 0xea, 0xec, 0x49, 0x65, 0x0b, 0x6d, 0xbf, 0x76,
0xd5, 0x11, 0x59, 0x7b, 0xfe, 0xe6, 0xb2, 0x58, 0xa8, 0xbd, 0xd0, 0xe6,
0x13, 0x26, 0x72, 0x83, 0x78, 0x90, 0x85, 0x82, 0x86, 0x9f, 0x2e, 0x20,
0x64, 0x90, 0xc3, 0xd1, 0x37, 0x50, 0xac, 0xde, 0x52, 0x8e, 0x83, 0x9f,
0x02, 0x7b, 0xff, 0xf1, 0xd4, 0xe5, 0x8b, 0x77, 0x8d, 0xef, 0x61, 0xcb,
0x85, 0x4d, 0xa0, 0x2e, 0x05, 0x28, 0xc0, 0x86, 0x78, 0x59, 0xa9, 0x94,
0xb3, 0x90, 0x6b, 0xf7, 0xff, 0xd3, 0x08, 0x96, 0x7c, 0xbe, 0x22, 0xd8,
0xb6, 0x35, 0xce, 0x1e, 0xae, 0x70, 0x34, 0x05, 0x51, 0x49, 0xac, 0x2f,
0xe8, 0x67, 0xcf, 0xa7
}

Definition at line 8716 of file encode.c.

Referenced by test_decodeOCSPBasicSignedResponseInfo().

◆ octetCommonNameValue

BYTE octetCommonNameValue[]
static
Initial value:
= {
0x04,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1200 of file encode.c.

Referenced by test_encodeCertToBeSigned().

◆ oid1

◆ oid_any_policy

char oid_any_policy[] = "2.5.29.32.0"
static

Definition at line 7508 of file encode.c.

Referenced by test_decodeCertPolicies(), and test_encodeCertPolicies().

◆ oid_aric

CHAR oid_aric[] = "1.2.840.113549.1.9.1"
static

Definition at line 694 of file encode.c.

◆ oid_basic_constraints2

CHAR oid_basic_constraints2[] = szOID_BASIC_CONSTRAINTS2
static

Definition at line 2722 of file encode.c.

◆ oid_bogus

CHAR oid_bogus[] = "1.2.3"
static

Definition at line 2860 of file encode.c.

◆ oid_codeweavers

CHAR oid_codeweavers[] = "2.5.4.10"
static

Definition at line 691 of file encode.c.

◆ oid_localhostAttr

CHAR oid_localhostAttr[] = "2.5.4.3"
static

Definition at line 693 of file encode.c.

◆ oid_minneapolis

CHAR oid_minneapolis[] = "2.5.4.7"
static

Definition at line 690 of file encode.c.

◆ oid_minnesota

CHAR oid_minnesota[] = "2.5.4.8"
static

Definition at line 689 of file encode.c.

◆ oid_rsa

CHAR oid_rsa[] = szOID_RSA
static

Definition at line 2861 of file encode.c.

◆ oid_short

CHAR oid_short[] = "1.1"
static

Definition at line 2727 of file encode.c.

◆ oid_us

CHAR oid_us[] = "2.5.4.6"
static

Definition at line 688 of file encode.c.

◆ oid_user_notice

char oid_user_notice[] = "1.3.6.1.5.5.7.2.2"
static

Definition at line 7513 of file encode.c.

Referenced by test_decodeCertPolicies(), and test_encodeCertPolicies().

◆ oid_wine

CHAR oid_wine[] = "2.5.4.11"
static

Definition at line 692 of file encode.c.

◆ oneBMP

BYTE oneBMP[] = { 0x1e, 0x02, 0x00, 0x31 }
static

Definition at line 1725 of file encode.c.

◆ oneGeneral

BYTE oneGeneral[] = { 0x1b, 0x01, 0x31 }
static

Definition at line 1724 of file encode.c.

◆ oneGraphic

BYTE oneGraphic[] = { 0x19, 0x01, 0x31 }
static

Definition at line 1721 of file encode.c.

◆ oneIA5

BYTE oneIA5[] = { 0x16, 0x01, 0x31 }
static

Definition at line 1720 of file encode.c.

◆ oneNumeric

BYTE oneNumeric[] = { 0x12, 0x01, 0x31 }
static

Definition at line 1716 of file encode.c.

◆ onePrintable

BYTE onePrintable[] = { 0x13, 0x01, 0x31 }
static

Definition at line 1717 of file encode.c.

◆ oneTeletex

BYTE oneTeletex[] = { 0x14, 0x01, 0x31 }
static

Definition at line 1718 of file encode.c.

◆ oneUniversal

BYTE oneUniversal[] = { 0x1c, 0x04, 0x00, 0x00, 0x00, 0x31 }
static

Definition at line 1723 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ oneUTF8

BYTE oneUTF8[] = { 0x0c, 0x01, 0x31 }
static

Definition at line 1726 of file encode.c.

◆ oneVideotex

BYTE oneVideotex[] = { 0x15, 0x01, 0x31 }
static

Definition at line 1719 of file encode.c.

◆ oneVisible

BYTE oneVisible[] = { 0x1a, 0x01, 0x31 }
static

Definition at line 1722 of file encode.c.

◆ org

◆ params

const BYTE params[] = { 0x02, 0x01, 0x01 }
static

Definition at line 2834 of file encode.c.

◆ permittedAndExcludedConstraints

BYTE permittedAndExcludedConstraints[]
static
Initial value:
= {
0x30,0x25,0xa0,0x0c,0x30,0x0a,0x87,0x08,0x30,0x06,0x87,0x04,0x7f,0x00,0x00,
0x01,0xa1,0x15,0x30,0x13,0x82,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,
0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67 }

Definition at line 7179 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ permittedAndExcludedWithMinConstraints

BYTE permittedAndExcludedWithMinConstraints[]
static
Initial value:
= {
0x30,0x28,0xa0,0x0f,0x30,0x0d,0x87,0x08,0x30,0x06,0x87,0x04,0x7f,0x00,0x00,
0x01,0x80,0x01,0x05,0xa1,0x15,0x30,0x13,0x82,0x11,0x68,0x74,0x74,0x70,0x3a,
0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67 }

Definition at line 7183 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ permittedAndExcludedWithMinMaxConstraints

BYTE permittedAndExcludedWithMinMaxConstraints[]
static
Initial value:
= {
0x30,0x2b,0xa0,0x12,0x30,0x10,0x87,0x08,0x30,0x06,0x87,0x04,0x7f,0x00,0x00,
0x01,0x80,0x01,0x05,0x81,0x01,0x03,0xa1,0x15,0x30,0x13,0x82,0x11,0x68,0x74,
0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67 }

Definition at line 7187 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ PKCSSignerWithAuthAttr

const BYTE PKCSSignerWithAuthAttr[]
static
Initial value:
= {
0x30,0x62,0x02,0x01,0x00,0x30,0x19,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x01,0x01,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0xa0,0x20,0x30,0x1e,0x06,
0x03,0x55,0x04,0x03,0x31,0x17,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,
0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x30,
0x06,0x06,0x02,0x2d,0x06,0x05,0x00,0x04,0x10,0x00,0x01,0x02,0x03,0x04,0x05,
0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f }

Definition at line 6564 of file encode.c.

Referenced by test_decodePKCSSignerInfo(), and test_encodePKCSSignerInfo().

◆ PKCSSignerWithHash

const BYTE PKCSSignerWithHash[]
static
Initial value:
= {
0x30,0x40,0x02,0x01,0x00,0x30,0x19,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x01,0x01,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0x30,0x06,0x06,0x02,0x2d,
0x06,0x05,0x00,0x04,0x10,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x0a,0x0b,0x0c,0x0d,0x0e,0x0f }

Definition at line 6558 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ PKCSSignerWithHashAlgo

const BYTE PKCSSignerWithHashAlgo[]
static
Initial value:
= {
0x30,0x2e,0x02,0x01,0x00,0x30,0x19,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x01,0x01,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0x30,0x04,0x06,0x00,0x05,
0x00,0x04,0x00 }

Definition at line 6548 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ PKCSSignerWithHashAndEncryptionAlgo

const BYTE PKCSSignerWithHashAndEncryptionAlgo[]
static
Initial value:
= {
0x30,0x30,0x02,0x01,0x00,0x30,0x19,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x01,0x01,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0x30,0x06,0x06,0x02,0x2d,
0x06,0x05,0x00,0x04,0x00 }

Definition at line 6553 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ PKCSSignerWithSerial

const BYTE PKCSSignerWithSerial[]
static
Initial value:
= {
0x30,0x2c,0x02,0x01,0x00,0x30,0x19,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,
0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x02,
0x01,0x01,0x30,0x04,0x06,0x00,0x05,0x00,0x30,0x04,0x06,0x00,0x05,0x00,0x04,
0x00 }

Definition at line 6543 of file encode.c.

Referenced by test_decodeCMSSignerInfo(), test_decodePKCSSignerInfo(), test_encodeCMSSignerInfo(), and test_encodePKCSSignerInfo().

◆ policiesWithAnyPolicy

const BYTE policiesWithAnyPolicy[]
static
Initial value:
= {
0x30,0x08,0x30,0x06,0x06,0x04,0x55,0x1d,0x20,0x00
}

Definition at line 7509 of file encode.c.

Referenced by test_decodeCertPolicies(), and test_encodeCertPolicies().

◆ policyConstraintsWithBoth

const BYTE policyConstraintsWithBoth[]
static
Initial value:
= {
0x30,0x06,0x80,0x01,0x01,0x81,0x01,0x01 }

Definition at line 7805 of file encode.c.

Referenced by test_decodeCertPolicyConstraints(), and test_encodeCertPolicyConstraints().

◆ policyConstraintsWithInhibitMapping

const BYTE policyConstraintsWithInhibitMapping[]
static
Initial value:
= {
0x30,0x03,0x81,0x01,0x01 }

Definition at line 7803 of file encode.c.

Referenced by test_decodeCertPolicyConstraints(), and test_encodeCertPolicyConstraints().

◆ policyConstraintsWithRequireExplicit

const BYTE policyConstraintsWithRequireExplicit[]
static
Initial value:
= {
0x30,0x03,0x80,0x01,0x00 }

Definition at line 7801 of file encode.c.

Referenced by test_decodeCertPolicyConstraints(), and test_encodeCertPolicyConstraints().

◆ policyMappingWithOneMapping

const BYTE policyMappingWithOneMapping[]
static
Initial value:
= {
0x30,0x0a,0x30,0x08,0x06,0x02,0x2a,0x03,0x06,0x02,0x53,0x04 }

Definition at line 7656 of file encode.c.

Referenced by test_decodeCertPolicyMappings(), and test_encodeCertPolicyMappings().

◆ policyMappingWithTwoMappings

const BYTE policyMappingWithTwoMappings[]
static
Initial value:
= {
0x30,0x14,0x30,0x08,0x06,0x02,0x2a,0x03,0x06,0x02,0x53,0x04,0x30,0x08,0x06,
0x02,0x2b,0x04,0x06,0x02,0x55,0x06 }

Definition at line 7658 of file encode.c.

Referenced by test_decodeCertPolicyMappings(), and test_encodeCertPolicyMappings().

◆ printableCommonNameValue

BYTE printableCommonNameValue[]
static
Initial value:
= {
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1204 of file encode.c.

Referenced by test_encodeNameValue().

◆ pubKeys

const struct encodedPublicKey pubKeys[]
static
Initial value:
= {
{ { { oid_bogus, { 0, NULL } }, { 0, NULL, 0 } },
{ { oid_bogus, { 2, bin72 } }, { 0, NULL, 0 } } },
{ { { oid_rsa, { 0, NULL } }, { 0, NULL, 0} },
{ { oid_rsa, { 2, bin72 } }, { 0, NULL, 0 } } },
{ { { oid_rsa, { 0, NULL } }, { sizeof(aKey), (BYTE *)aKey, 0} },
{ { oid_rsa, { 2, bin72 } }, { sizeof(aKey), (BYTE *)aKey, 0} } },
{ { { oid_rsa, { sizeof(params), (BYTE *)params } }, { sizeof(aKey),
(BYTE *)aKey, 0 } },
{ { oid_rsa, { sizeof(params), (BYTE *)params } }, { sizeof(aKey),
(BYTE *)aKey, 0 } } },
}
GLenum const GLfloat * params
Definition: glext.h:5645
static const unsigned char bin65[]
Definition: encode.c:2838
static const unsigned char bin68[]
Definition: encode.c:2844
static const unsigned char bin71[]
Definition: encode.c:2854
static CHAR oid_bogus[]
Definition: encode.c:2860
static const unsigned char bin69[]
Definition: encode.c:2847
static const BYTE params[]
Definition: encode.c:2834
static CHAR oid_rsa[]
Definition: encode.c:2861
static const unsigned char bin64[]
Definition: encode.c:2836
static unsigned char bin72[]
Definition: encode.c:2858
static const unsigned char bin66[]
Definition: encode.c:2840
static const unsigned char bin67[]
Definition: encode.c:2842
static const unsigned char bin70[]
Definition: encode.c:2850

Definition at line 2863 of file encode.c.

Referenced by test_decodePublicKeyInfo(), and test_encodePublicKeyInfo().

◆ rdnAttrs

CERT_RDN_ATTR rdnAttrs[]
static
Initial value:
= { { RDNA(us) },
{ RDNA(wine) },
{ RDNIA5(aric) } }

Definition at line 695 of file encode.c.

Referenced by test_encodeName().

◆ rsaPrivKeyCoefficient

const BYTE rsaPrivKeyCoefficient[]
static
Initial value:
= {
0xf9,0x85,0x26,0x39,0x96,0x35,0x02,0xfb,0xd9,0xd4,0xf0,0xbd,
0xcb,0xd5,0x3d,0xce,0x8b,0xb6,0x8b,0xc5,0x6c,0x11,0x44,0x1e,
0x39,0x88,0x46,0x4a,0x31,0xe6,0xa1,0x3a,0x2b,0xfc,0x2a,0x05,
0xa1,0x68,0x18,0x88,0xa6,0xd0,0xb1,0xc6,0x0b,0xa3,0x3e,0x68,
0xb2,0x4d,0xf1,0xf2,0x1c,0x40,0xdb,0xf8,0x1a,0x44,0xf6,0x84,
0x04,0x96,0xff,0xce,0x3a,0x7c,0x3c,0xd6,0x60,0xbc,0x14,0x14,
0xf7,0xc1,0x9d,0xcd,0x62,0x46,0x8e,0x3e,0x47,0xb6,0x5b,0x91,
0x74,0xb6,0x65,0x66,0x2a,0x13,0xdd,0x63,0x25,0x00,0xae,0x6b,
0x68,0x4e,0x9c,0xc8,0x47,0x7c,0x83,0x52,0x51,0x14,0x8a,0x0f,
0xa2,0x50,0xbd,0x45,0xf0,0x6b,0xbf,0x46,0x20,0xda,0xd7,0x07,
0x1e,0x9a,0xec,0xe1,0x34,0x31,0xb4,0xda }

Definition at line 8116 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyDer

const BYTE rsaPrivKeyDer[]
static

Definition at line 7944 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyExponent1

const BYTE rsaPrivKeyExponent1[]
static
Initial value:
= {
0xa1,0xca,0x03,0xc2,0xbc,0x0c,0x7b,0x61,0x6f,0x4e,0xf3,0xde,
0x81,0xfb,0x44,0xa7,0x70,0xae,0xe8,0xb3,0x61,0x7a,0x86,0xac,
0x7e,0xcd,0xf9,0xbc,0xe9,0x34,0x32,0x2d,0x7d,0x78,0x93,0xe2,
0xac,0x87,0x45,0xe9,0xde,0x35,0x6d,0x8c,0xe0,0x16,0x09,0x9d,
0x54,0xd9,0x49,0x62,0x73,0x5f,0xd7,0x5c,0x9a,0xba,0x80,0xef,
0xbe,0xf5,0xda,0x9a,0x8c,0x03,0x79,0x9b,0xad,0x9e,0xff,0x0a,
0x15,0x39,0x69,0xba,0x22,0x46,0xdd,0xbb,0x09,0xf9,0xa3,0x47,
0x0b,0xae,0xce,0x10,0xac,0x22,0x86,0xb0,0x0a,0xf3,0x26,0x9f,
0x98,0xa5,0x90,0xd4,0x94,0x0b,0xcb,0x76,0xa8,0xbf,0x26,0x76,
0x01,0x5e,0x53,0x03,0x3e,0x30,0x29,0x39,0x67,0x9e,0x9f,0x54,
0x93,0xa0,0xaf,0xe2,0x08,0x02,0xe7,0x86 }

Definition at line 8092 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyExponent2

const BYTE rsaPrivKeyExponent2[]
static
Initial value:
= {
0x85,0xfd,0x95,0x6b,0xb1,0x67,0x28,0x1d,0xe4,0xf1,0x20,0xbf,
0x64,0x1d,0xf8,0x52,0xa2,0x4a,0x65,0xbd,0x98,0x55,0xf7,0x10,
0x74,0x30,0x95,0x5a,0x7d,0xea,0x0a,0xc4,0xa5,0xf0,0x5a,0x5f,
0xc3,0x50,0xb0,0x6b,0xa2,0x90,0xf6,0x3d,0xe6,0xfa,0xe3,0xc0,
0xcb,0x14,0x6d,0xda,0x2b,0x96,0x86,0x26,0xb8,0xcb,0x2b,0xa6,
0x21,0xbe,0x83,0x6a,0x5e,0xa3,0x15,0xfa,0xa5,0x7c,0xba,0xf5,
0xc2,0xd9,0x51,0x3b,0x61,0x35,0xb0,0x12,0x92,0xaa,0xec,0xe6,
0x52,0xf6,0x53,0xab,0x2c,0x76,0x10,0xfe,0x5d,0xd5,0xd4,0x96,
0x05,0xe2,0xd9,0xae,0x22,0xb0,0x29,0x6a,0x80,0x88,0x17,0x5b,
0x30,0x15,0xe6,0x20,0xab,0x19,0x11,0x48,0x1a,0x0d,0xf6,0x1b,
0x9d,0x35,0x17,0x4f,0xa1,0x4a,0x5b,0x69 }

Definition at line 8104 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyModulus

const BYTE rsaPrivKeyModulus[]
static
Initial value:
= {
0x43,0x55,0x9f,0x73,0x9a,0xb8,0x4f,0x8f,0x49,0xbe,0xf9,0x6c,
0xbc,0xaa,0x20,0xc5,0xe7,0x49,0x25,0x03,0x50,0x0c,0x87,0x2d,
0x63,0xf6,0xe7,0x81,0x5e,0x54,0x0f,0x36,0x24,0xfa,0x50,0x1c,
0x86,0xfd,0x65,0x5a,0x75,0xcf,0xfd,0x9c,0xe1,0x85,0x09,0x47,
0x62,0x40,0xe8,0xcb,0xf9,0xcb,0xdc,0xf0,0xf9,0x73,0x2b,0xe9,
0xba,0x63,0xd6,0x23,0x2f,0xf1,0x86,0xf2,0xc5,0x54,0xd1,0x0e,
0x5c,0x09,0xa8,0x77,0x8a,0xa9,0x1f,0xd5,0xb9,0x2c,0xf0,0xa7,
0x76,0x20,0x53,0xff,0x17,0xa9,0x42,0xfc,0x1a,0x7c,0x74,0x4a,
0x2e,0x41,0x3b,0x90,0x31,0x2b,0xd7,0xf2,0xa4,0x9c,0xaf,0x99,
0xea,0x9a,0x58,0x4f,0xc0,0xe8,0x94,0xcc,0x44,0x61,0xe5,0xe2,
0xe5,0x61,0xfe,0xb8,0xb0,0x42,0x7b,0x12,0x64,0x1d,0xfc,0xf6,
0x0c,0xe6,0x08,0x65,0x01,0x76,0xda,0x7a,0x11,0x41,0x60,0x03,
0xc2,0x14,0x93,0x0f,0xbb,0xc1,0x68,0x97,0xb7,0xfd,0x28,0x1e,
0x84,0x61,0xe5,0xe1,0xd2,0x3d,0x85,0x91,0x3b,0x29,0x3a,0x36,
0x9e,0xe2,0x73,0x62,0x3c,0xde,0x1a,0x7b,0xc9,0x0b,0x74,0x85,
0x6c,0x27,0x68,0xd1,0x6c,0xf2,0x66,0x58,0xc7,0x2f,0xdd,0x11,
0xba,0x76,0x55,0x7a,0x3b,0x1b,0xba,0xd1,0xbc,0x4a,0x3a,0x69,
0x2d,0x32,0xdf,0x59,0x35,0xf2,0xe0,0x16,0xe0,0x91,0xd5,0xe1,
0x3f,0xeb,0xe0,0x01,0x7a,0x3a,0xe4,0x06,0x39,0x45,0x3b,0x99,
0x69,0xb0,0xfb,0x07,0x34,0xdf,0x90,0x9c,0x54,0x65,0x97,0x7e,
0x64,0x31,0xf8,0xf9,0x26,0xd4,0x41,0x1c,0xb0,0x41,0x25,0xeb,
0x41,0x3c,0xba,0xae }

Definition at line 8045 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyPrime1

const BYTE rsaPrivKeyPrime1[]
static
Initial value:
= {
0xe9,0x51,0xdb,0x33,0xb7,0xbf,0x8e,0xa7,0x20,0x74,0xd7,0x86,
0xc5,0x3a,0x4a,0x16,0xd7,0x5e,0xed,0x3b,0xe7,0x77,0xb9,0xbf,
0xd9,0xe2,0xb8,0xa6,0x2e,0xd9,0xd0,0x4e,0x53,0xbe,0x11,0x5d,
0x52,0x3b,0xf0,0xca,0xe7,0x56,0xe7,0x20,0x02,0xd8,0x70,0x30,
0xa8,0xc3,0x72,0xd1,0xce,0xdb,0x38,0x00,0x74,0x59,0xd2,0x2f,
0xf8,0x31,0xe5,0x4d,0x6c,0xcf,0x25,0x6c,0x37,0x46,0x49,0xac,
0xef,0x24,0xcd,0xc7,0x80,0x96,0xd5,0x22,0x47,0xe0,0xdf,0x33,
0x0a,0x4a,0x53,0x3d,0x76,0xdb,0xf7,0x39,0x63,0x79,0xa3,0x0d,
0xfa,0x8a,0x95,0xb0,0x98,0x62,0xb8,0x7f,0xc3,0xbe,0x68,0xa4,
0x9f,0x7f,0x5f,0x1e,0x3b,0x48,0x7b,0x99,0x20,0xe0,0x5b,0xfc,
0x4e,0xb6,0x76,0xed,0xdd,0xfe,0x5e,0xe3 }

Definition at line 8068 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyPrime2

const BYTE rsaPrivKeyPrime2[]
static
Initial value:
= {
0x4b,0xe6,0x2f,0xa5,0x08,0x3d,0xa9,0xf5,0x36,0x10,0x97,0x39,
0xf3,0xc1,0xfb,0x86,0x48,0xaf,0x64,0xc6,0x9b,0x5f,0xe6,0xcf,
0xb2,0x7b,0x39,0xa5,0x37,0x2c,0x61,0x1a,0x68,0xe2,0xe0,0xb0,
0xfa,0x53,0xf1,0x7b,0x1d,0x3d,0x6b,0x70,0xa4,0x64,0x3a,0xe7,
0xe1,0xe1,0xa0,0xaf,0x99,0x95,0xf2,0x4d,0x40,0x05,0x32,0xa4,
0xab,0xac,0xee,0x97,0xca,0xa3,0xd6,0xe9,0xc0,0x9f,0x4d,0xb0,
0xed,0x4a,0xe2,0x3a,0x29,0xe6,0xc3,0x2b,0xcd,0xa6,0xa9,0x87,
0x7c,0xee,0x93,0x84,0x40,0xf2,0x40,0xae,0xc6,0x8e,0xd6,0x4a,
0xaf,0xfc,0x5e,0x7d,0x9c,0x68,0x6f,0x18,0x72,0x1c,0x66,0x82,
0x5d,0x66,0xaa,0x62,0x91,0xab,0xe1,0x0f,0xe9,0x4a,0x9d,0xce,
0xce,0xe8,0xcf,0x6e,0xf0,0x57,0xba,0xc4 }

Definition at line 8080 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyPrivateExponent

const BYTE rsaPrivKeyPrivateExponent[]
static
Initial value:
= {
0x11,0x90,0xb6,0x9f,0x62,0x9c,0x87,0x7e,0x9c,0x4c,0xbd,0x8c,
0xf0,0xf8,0x2d,0x00,0x01,0x94,0xbc,0x68,0x39,0x13,0x3b,0x74,
0x03,0x66,0xda,0xd2,0xde,0x79,0x96,0x61,0xba,0x6e,0x90,0xdf,
0xed,0x25,0xdd,0x76,0xaa,0xfa,0x1d,0x15,0x65,0x99,0xba,0xf7,
0x18,0xd5,0x15,0x85,0x33,0xf2,0xfd,0x60,0xb1,0x9f,0x66,0x9f,
0x86,0x0c,0x69,0x06,0x5d,0x4c,0x5e,0xd8,0xf5,0x45,0x2d,0xf8,
0x05,0x45,0xde,0xa4,0x71,0x58,0x81,0xce,0xe2,0xbb,0xb3,0x54,
0x12,0xff,0x86,0x2d,0xd4,0xe5,0x03,0x90,0xa9,0x92,0xb9,0xe3,
0x73,0xf2,0x69,0xbf,0xe2,0x75,0xab,0x59,0xfe,0x1b,0x48,0x8a,
0xaf,0xdb,0xb0,0x7f,0x7e,0xb7,0x8c,0xfc,0x95,0x23,0x14,0x20,
0x27,0x3d,0x74,0x4c,0x00,0xeb,0x23,0x20,0xc8,0x9c,0x2f,0x43,
0x68,0x1d,0x97,0x02,0x15,0xcc,0xfc,0xde,0xda,0xe0,0x80,0xfd,
0x95,0xbe,0xba,0xee,0xb3,0xd3,0xdc,0xd0,0xc2,0x63,0x16,0x40,
0x97,0x04,0xa4,0xed,0x61,0x6d,0x37,0x03,0x84,0x00,0xb2,0x44,
0x09,0x8b,0x6f,0xb3,0x44,0xac,0x54,0x66,0xf3,0x26,0x93,0xee,
0xf7,0x91,0x76,0xa5,0x98,0xf8,0x3a,0x07,0x47,0x8b,0xdd,0x69,
0x61,0x1f,0xdd,0x12,0x90,0x2e,0xe3,0xcd,0xc3,0xb7,0xc9,0x6d,
0xfa,0xe8,0xa5,0x96,0x33,0x74,0xc9,0xc0,0x1f,0x3f,0x65,0xda,
0x6f,0x12,0x75,0x17,0x8a,0xdb,0x4f,0x29,0xa2,0xfc,0x47,0x34,
0x02,0xf6,0x86,0xcb,0x6a,0x74,0x9d,0x46,0x93,0x27,0x11,0x8c,
0xef,0xd6,0xc9,0x2c,0x65,0x89,0xd6,0x78,0x98,0x32,0x03,0x69,
0x5b,0xcd,0x03,0x99 }

Definition at line 8128 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPubKeys

const struct EncodedRSAPubKey rsaPubKeys[]
static
Initial value:
= {
{ modulus1, sizeof(modulus1), mod1_encoded, sizeof(modulus1) },
{ modulus2, sizeof(modulus2), mod2_encoded, 5 },
{ modulus3, sizeof(modulus3), mod3_encoded, 5 },
{ modulus4, sizeof(modulus4), mod4_encoded, 8 },
}
static const BYTE mod2_encoded[]
Definition: encode.c:2325
static const BYTE mod4_encoded[]
Definition: encode.c:2327
static const BYTE modulus4[]
Definition: encode.c:2323
static const BYTE mod3_encoded[]
Definition: encode.c:2326
static const BYTE modulus2[]
Definition: encode.c:2321
static const BYTE modulus3[]
Definition: encode.c:2322
static const BYTE mod1_encoded[]
Definition: encode.c:2324

Definition at line 2337 of file encode.c.

Referenced by test_decodeRsaPublicKey(), test_decodeRsaPublicKey_Bcrypt(), test_encodeRsaPublicKey(), and test_encodeRsaPublicKey_Bcrypt().

◆ serialNum

◆ signedBigCert

const BYTE signedBigCert[]
static

Definition at line 3390 of file encode.c.

Referenced by test_decodeCert(), and test_encodeCert().

◆ signedBigCertWithIndefiniteSeq

const BYTE signedBigCertWithIndefiniteSeq[]
static

Definition at line 3425 of file encode.c.

Referenced by test_decodeCert().

◆ signedCTL

const BYTE signedCTL[]
static
Initial value:
= {
0x30,0x81,0xc7,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,0xa0,
0x81,0xb9,0x30,0x81,0xb6,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,0x08,0x2a,
0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x28,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x07,0x01,0xa0,0x1b,0x04,0x19,0x30,0x17,0x30,0x00,
0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
0x30,0x5a,0x30,0x02,0x06,0x00,0x31,0x77,0x30,0x75,0x02,0x01,0x01,0x30,0x1a,
0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,
0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,
0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x04,0x06,0x00,0x05,
0x00,0x04,0x40,0xca,0xd8,0x32,0xd1,0xbd,0x97,0x61,0x54,0xd6,0x80,0xcf,0x0d,
0xbd,0xa2,0x42,0xc7,0xca,0x37,0x91,0x7d,0x9d,0xac,0x8c,0xdf,0x05,0x8a,0x39,
0xc6,0x07,0xc1,0x37,0xe6,0xb9,0xd1,0x0d,0x26,0xec,0xa5,0xb0,0x8a,0x51,0x26,
0x2b,0x4f,0x73,0x44,0x86,0x83,0x5e,0x2b,0x6e,0xcc,0xf8,0x1b,0x85,0x53,0xe9,
0x7a,0x80,0x8f,0x6b,0x42,0x19,0x93 }

Definition at line 5744 of file encode.c.

Referenced by test_decodeCTL().

◆ signedCTLWithCTLInnerContent

const BYTE signedCTLWithCTLInnerContent[]
static
Initial value:
= {
0x30,0x82,0x01,0x0f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x07,0x02,
0xa0,0x82,0x01,0x00,0x30,0x81,0xfd,0x02,0x01,0x01,0x31,0x0e,0x30,0x0c,0x06,
0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x30,0x30,0x06,0x09,
0x2b,0x06,0x01,0x04,0x01,0x82,0x37,0x0a,0x01,0xa0,0x23,0x30,0x21,0x30,0x00,
0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
0x30,0x5a,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,
0x00,0x31,0x81,0xb5,0x30,0x81,0xb2,0x02,0x01,0x01,0x30,0x1a,0x30,0x15,0x31,
0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,
0x4c,0x61,0x6e,0x67,0x00,0x02,0x01,0x01,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,
0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0xa0,0x3b,0x30,0x18,0x06,0x09,0x2a,0x86,
0x48,0x86,0xf7,0x0d,0x01,0x09,0x03,0x31,0x0b,0x06,0x09,0x2b,0x06,0x01,0x04,
0x01,0x82,0x37,0x0a,0x01,0x30,0x1f,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
0x01,0x09,0x04,0x31,0x12,0x04,0x10,0x54,0x71,0xbc,0xe1,0x56,0x31,0xa2,0xf9,
0x65,0x70,0x34,0xf8,0xe2,0xe9,0xb4,0xf4,0x30,0x04,0x06,0x00,0x05,0x00,0x04,
0x40,0x2f,0x1b,0x9f,0x5a,0x4a,0x15,0x73,0xfa,0xb1,0x93,0x3d,0x09,0x52,0xdf,
0x6b,0x98,0x4b,0x13,0x5e,0xe7,0xbf,0x65,0xf4,0x9c,0xc2,0xb1,0x77,0x09,0xb1,
0x66,0x4d,0x72,0x0d,0xb1,0x1a,0x50,0x20,0xe0,0x57,0xa2,0x39,0xc7,0xcd,0x7f,
0x8e,0xe7,0x5f,0x76,0x2b,0xd1,0x6a,0x82,0xb3,0x30,0x25,0x61,0xf6,0x25,0x23,
0x57,0x6c,0x0b,0x47,0xb8 }

Definition at line 5759 of file encode.c.

Referenced by test_decodeCTL().

◆ singleCapability

const BYTE singleCapability[]
static
Initial value:
= {
0x30,0x06,0x30,0x04,0x06,0x02,0x2d,0x06 }

Definition at line 6367 of file encode.c.

Referenced by test_decodePKCSSMimeCapabilities(), and test_encodePKCSSMimeCapabilities().

◆ singleCapabilitywithNULL

const BYTE singleCapabilitywithNULL[]
static
Initial value:
= {
0x30,0x08,0x30,0x06,0x06,0x02,0x2d,0x06,0x05,0x00 }

Definition at line 6371 of file encode.c.

Referenced by test_decodePKCSSMimeCapabilities().

◆ singlePKCSAttributes

const BYTE singlePKCSAttributes[]
static
Initial value:
= { 0x31,0x08,0x30,0x06,0x06,0x02,
0x2a,0x03,0x31,0x00 }

Definition at line 6241 of file encode.c.

Referenced by test_decodePKCSAttributes(), and test_encodePKCSAttributes().

◆ surName

const char surName[] = "Lang"
static

Definition at line 656 of file encode.c.

Referenced by test_decodeName(), and test_encodeName().

◆ t61CommonNameValue

BYTE t61CommonNameValue[]
static
Initial value:
= {
0x14,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1206 of file encode.c.

◆ times

const struct encodedFiletime times[]
static
Initial value:
= {
{ { 2005, 6, 1, 6, 16, 10, 0, 0 }, bin20 },
{ { 1945, 6, 1, 6, 16, 10, 0, 0 }, bin21 },
{ { 2145, 6, 1, 6, 16, 10, 0, 0 }, bin22 },
}
static const BYTE bin21[]
Definition: encode.c:536
static const BYTE bin22[]
Definition: encode.c:538
static const BYTE bin20[]
Definition: encode.c:534

Definition at line 541 of file encode.c.

Referenced by _futime32(), _futime64(), _utime32(), _utime64(), _wutime32(), _wutime64(), common_futime(), common_utime(), deflate_fast(), fill_window(), generate_random(), GetThreadTimes(), QueryIdleProcessorCycleTime(), QueryIdleProcessorCycleTimeEx(), test_decodeFiletime(), test_decodeSequenceOfAny(), test_encodeFiletime(), and test_encodeSequenceOfAny().

◆ twoCapabilities

const BYTE twoCapabilities[]
static
Initial value:
= {
0x30,0x0c,0x30,0x04,0x06,0x02,0x2d,0x06,0x30,0x04,0x06,0x02,0x2a,0x03 }

Definition at line 6369 of file encode.c.

Referenced by test_decodePKCSSMimeCapabilities(), and test_encodePKCSSMimeCapabilities().

◆ twoPolicies

const BYTE twoPolicies[]
static
Initial value:
= {
0x30,0x50,0x30,0x06,0x06,0x04,0x55,0x1d,0x20,0x00,0x30,0x46,0x06,0x02,0x2a,
0x03,0x30,0x40,0x30,0x3e,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x02,
0x30,0x32,0x30,0x0e,0x16,0x04,0x57,0x69,0x6e,0x65,0x30,0x06,0x02,0x01,0x02,
0x02,0x01,0x03,0x1e,0x20,0x00,0x54,0x00,0x68,0x00,0x69,0x00,0x73,0x00,0x20,
0x00,0x69,0x00,0x73,0x00,0x20,0x00,0x61,0x00,0x20,0x00,0x6e,0x00,0x6f,0x00,
0x74,0x00,0x69,0x00,0x63,0x00,0x65
}

Definition at line 7514 of file encode.c.

Referenced by test_decodeCertPolicies(), and test_encodeCertPolicies().

◆ twoRDNs

const BYTE twoRDNs[]
static
Initial value:
= {
0x30,0x23,0x31,0x21,0x30,0x0c,0x06,0x03,0x55,0x04,0x04,
0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0}

Definition at line 660 of file encode.c.

Referenced by test_decodeName(), test_encodeName(), and test_encodeUnicodeName().

◆ twoRDNsExtraBytes

const BYTE twoRDNsExtraBytes[]
static
Initial value:
= {
0x30,0x23,0x31,0x21,0x30,0x0c,0x06,0x03,0x55,0x04,0x04,
0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0,0,0,0,0,0}

Definition at line 1017 of file encode.c.

Referenced by test_decodeName().

◆ twoRDNsNoNull

const BYTE twoRDNsNoNull[]
static
Initial value:
= {
0x30,0x21,0x31,0x1f,0x30,0x0b,0x06,0x03,0x55,0x04,0x04,0x13,0x04,0x4c,0x61,
0x6e,0x67,0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67 }

Definition at line 848 of file encode.c.

Referenced by test_decodeUnicodeName(), and test_encodeUnicodeName().

◆ unicodeErrors

struct UnicodeExpectedError unicodeErrors[]
static
Initial value:

Definition at line 1700 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ unicodeResults

struct UnicodeExpectedResult unicodeResults[]
static
Initial value:
= {
{ CERT_RDN_IA5_STRING, L"1", { sizeof(oneIA5), oneIA5 } },
{ CERT_RDN_BMP_STRING, L"1", { sizeof(oneBMP), oneBMP } },
{ CERT_RDN_UTF8_STRING, L"1", { sizeof(oneUTF8), oneUTF8 } },
{ CERT_RDN_BMP_STRING, L"http://\x226f\x575b", { sizeof(nihongoBMP), nihongoBMP } },
{ CERT_RDN_UTF8_STRING, L"http://\x226f\x575b", { sizeof(nihongoUTF8), nihongoUTF8 } },
}
static BYTE oneGraphic[]
Definition: encode.c:1721
static BYTE nihongoUTF8[]
Definition: encode.c:1733
static BYTE onePrintable[]
Definition: encode.c:1717
static BYTE oneUTF8[]
Definition: encode.c:1726
static BYTE oneTeletex[]
Definition: encode.c:1718
static BYTE oneIA5[]
Definition: encode.c:1720
static BYTE oneBMP[]
Definition: encode.c:1725
static BYTE oneGeneral[]
Definition: encode.c:1724
static BYTE oneVideotex[]
Definition: encode.c:1719
static BYTE oneNumeric[]
Definition: encode.c:1716
static BYTE nihongoBMP[]
Definition: encode.c:1731
static BYTE oneVisible[]
Definition: encode.c:1722
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2940
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2935
#define CERT_RDN_UNIVERSAL_STRING
Definition: wincrypt.h:2936
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2933
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2930
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2928
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2938
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2932

Definition at line 1736 of file encode.c.

Referenced by test_decodeUnicodeNameValue(), and test_encodeUnicodeNameValue().

◆ unicodeWeirdness

struct UnicodeExpectedResult unicodeWeirdness[]
static
Initial value:
= {
{ CERT_RDN_TELETEX_STRING, L"http://\x226f\x575b", { sizeof(nihongoT61), nihongoT61 } },
{ CERT_RDN_GENERAL_STRING, L"http://\x226f\x575b", { sizeof(nihongoGeneral), nihongoGeneral } },
}
static BYTE nihongoT61[]
Definition: encode.c:1727
static BYTE nihongoGeneral[]
Definition: encode.c:1729

Definition at line 1752 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ url

const WCHAR url[] = L"http://winehq.org"
static

Definition at line 1384 of file encode.c.

Referenced by _open_simple_request(), _protocol_start(), _test_current_url(), _test_doc_load_from_path(), _test_GetCurMoniker(), _test_open(), _test_security_info(), _test_server_open(), add_fav_to_menu(), add_favs_to_menu(), async_doc_navigate(), AtlAxCreateControlLicEx(), bind_to_object(), BookmarkToURL(), build_proxy_path_url(), cache_containers_find(), cache_entry_exists(), check_CFE_LINK_rcvd(), check_url_canonicalize(), cldap_openW(), ClOleCommandTarget_Exec(), combine_url(), FavoritesMenu::Command(), CommitUrlCacheEntryW(), component_free(), component_GetUrl(), confirm_safety(), cookie_parse_url(), create_cache_entry(), create_callback(), create_cookie_url(), create_doc_from_url(), create_moniker(), create_moniker_from_url(), create_parseError(), create_redirect_nschannel(), create_uri(), CreateUrlCacheEntryW(), CryptRetrieveObjectByUrlA(), dde_proc(), decode_url(), DecodeDirectoryURL(), DeleteUrlCacheEntryW(), DocHostContainer_set_url(), DocObjectService_FireDocumentComplete(), DocObjectService_FireNavigateComplete2(), DoSync(), download_script(), download_url(), MDIShellBrowserChild::entry_selected(), escape_url(), exec_hyperlink(), exec_shldocvw_67(), file_protocol_start(), FileToURL(), find_mime_from_buffer(), find_mime_from_url(), free_fav_menu_data(), FTP_FtpOpenFileW(), FTPDecodeURL(), FtpProtocol_open_request(), generate_moniker(), get_protocol_info(), get_security_id_for_url(), get_url(), get_url_components(), GetUrlCacheEntryInfoExW(), ChildWindow::go_to(), MDIMainFrame::go_to(), GopherProtocol_open_request(), BrowserNavigator::goto_url(), handle_navigation_error(), handle_redirect(), hlink_frame_navigate(), html_window_navigate(), HTMLDocument_open(), HtmlHelpW(), HTMLLocation_get_host(), HTMLLocation_get_href(), HTMLLocation_get_pathname(), HTMLPrivateWindow_GetAddressBarUrl(), HTMLPrivateWindow_GetPendingUrl(), HTMLPrivateWindow_SuperNavigate(), HTMLWindow2_navigate(), HTMLWindow2_open(), HTMLWindow3_showModelessDialog(), HTMLXMLHttpRequest_open(), HTTP_HandleRedirect(), HTTP_HttpSendRequestW(), http_protocol_start(), HttpProtocol_open_request(), HTTPREQ_QueryOption(), hyperlink_dlgproc(), ie_dialog_open_proc(), ie_navigate(), IEHTMLWindow2_navigate(), IEHTMLWindow2_open(), iewnd_OnCommand(), install_codebase(), InternetCheckConnectionA(), InternetCrackUrlA(), InternetCrackUrlW_test(), InternetExplorerManager_CreateObject(), InternetGetCookieA(), InternetGetCookieExA(), InternetGetCookieW(), InternetGetProxyInfo(), InternetGetSecurityInfoByURLA(), InternetGetSecurityInfoByURLW(), InternetHostSecurityManager_ProcessUrlAction(), InternetHostSecurityManager_QueryCustomPolicy(), InternetSetCookieA(), InternetSetCookieExA(), InternetSetCookieW(), InternetShowSecurityInfoByURLA(), InternetShowSecurityInfoByURLW(), is_registered_protocol(), IsLoggingEnabledA(), IsLoggingEnabledW(), IsProtectedModeURL(), IsUrlCacheEntryExpiredA(), IsUrlCacheEntryExpiredW(), FileChildWindow::jump_to_int(), MDIShellBrowserChild::jump_to_int(), WebChildWindow::jump_to_int(), ldap_initW(), ldap_openW(), ldap_sslinitW(), LogXfer(), map_url_to_zone(), MimeHtmlProtocol_Start(), MimeHtmlProtocolInfo_CombineUrl(), MkProtocol_StartEx(), navigate_hlink(), navigate_url(), DWebBrowserEvents2Impl::NavigateComplete2(), WebChildWindow::NavigateComplete2(), BrowserNavigator::navigated(), networkconfig_AddLoggingUrl(), networkconfig_GetLoggingUrl(), notif_complete(), on_before_navigate2(), open_dde_url(), OpenCmd(), parse_canonicalize_url(), parse_domain(), parse_encode(), parse_mhtml_url(), parse_path_from_url(), parse_proxy_url(), parse_rootdocument(), parse_schema(), parse_security_domain(), parse_security_url(), parse_url(), parse_url_element(), parse_url_from_outside(), parseError_get_url(), ParseURLA(), ParseURLFromOutsideSourceA(), ParseURLFromOutsideSourceW(), ParseURLW(), PathCreateFromUrlAlloc(), PathCreateFromUrlW(), perform_test(), PersistFile_Load(), PersistFile_Save(), PrintHosts(), process_component(), protocol_start(), PrPhilBar(), PrSizeAndRateMeter(), PrStatBar(), PwdCmd(), query_global_option(), ready_media(), res_sec_url_cmp(), ResProtocol_Start(), RetrieveUrlCacheEntryFileW(), rewrite_url(), rpcrt4_ncacn_http_open(), run_js_script(), run_script(), SaveUnsavedBookmark(), SecManagerImpl_MapUrlToZoneEx2(), set_auth_cookie(), set_current_mon(), set_dochost_url(), set_moniker(), SDIMainFrame::set_url(), ChildWindow::set_url(), SetStartupURL(), SetUrlCacheEntryInfoW(), SHRestricted2A(), SHRestricted2W(), skip_schema(), SplitFileSysURL(), test_async_xhr(), test_async_xhr_abort(), test_basic_request(), test_crack_url(), test_CreateURLMoniker(), test_decodeAltName(), test_decodeAuthorityInfoAccess(), test_decodeAuthorityKeyId2(), test_decodeCRLDistPoints(), test_decodeCRLIssuingDistPoint(), test_decodeNameConstraints(), test_encodeAltName(), test_encodeAuthorityInfoAccess(), test_encodeAuthorityKeyId2(), test_encodeCRLDistPoints(), test_encodeCRLIssuingDistPoint(), test_encodeNameConstraints(), test_file_protocol_url(), test_http_cache(), test_http_protocol_url(), test_InternetCanonicalizeUrlA(), test_IWinHttpRequest(), test_long_url(), test_MimeOleObjectFromMoniker(), test_MsiSourceListAddSourceEx(), test_MsiSourceListEnumSources(), test_MsiSourceListSetInfo(), test_open_window(), test_ParseURL(), test_PathCreateFromUrl(), test_persist(), test_protocol_fail(), test_protocol_url(), test_proxy_direct(), test_reference(), test_res_url(), test_SecurityManager(), test_sync_xhr(), test_UrlApplyScheme(), test_urlcacheW(), test_UrlCanonicalizeA(), test_UrlCreateFromPath(), test_UrlEscapeA(), test_UrlEscapeW(), test_UrlGetPart(), test_UrlIs(), test_urls(), test_UrlUnescape(), test_WinHttpDetectAutoProxyConfigUrl(), test_xmlelem_collection(), translate_url(), try_application_url(), UniformResourceLocatorA_AddRef(), UniformResourceLocatorA_GetUrl(), UniformResourceLocatorA_InvokeCommand(), UniformResourceLocatorA_QueryInterface(), UniformResourceLocatorA_Release(), UniformResourceLocatorA_SetUrl(), UniformResourceLocatorW_AddRef(), UniformResourceLocatorW_GetUrl(), UniformResourceLocatorW_InvokeCommand(), UniformResourceLocatorW_QueryInterface(), UniformResourceLocatorW_Release(), UniformResourceLocatorW_SetUrl(), UnlockUrlCacheEntryFileW(), update_addrbar(), url_apply_default_scheme(), url_create_from_path(), url_entry_free(), url_forward_slash(), url_guess_scheme(), UrlApplySchemeA(), UrlApplySchemeW(), urlcache_decode_url(), urlcache_encode_url(), urlcache_encode_url_alloc(), urlcache_entry_commit(), urlcache_entry_create(), urlcache_entry_get_file(), urlcache_get_entry_info(), UrlCanonicalizeA(), UrlCanonicalizeW(), UrlCreateFromPathA(), UrlCreateFromPathW(), URLDownloadToCacheFileA(), UrlEscapeA(), UrlEscapeW(), UrlFixupW(), UrlGetLocationA(), UrlGetLocationW(), UrlGetPartA(), UrlGetPartW(), UrlHashA(), UrlHashW(), UrlIsA(), UrlIsNoHistoryA(), UrlIsNoHistoryW(), UrlIsOpaqueA(), UrlIsOpaqueW(), UrlIsW(), UrlUnescapeA(), UrlUnescapeW(), WebBrowser_Navigate2(), winhttp_request_Open(), WinHttpCrackUrl(), WinHttpCreateUrl(), WinHttpCreateUrl_test(), WinHttpDetectAutoProxyConfigUrl(), WinHttpGetProxyForUrl(), WMCheckURLExtension(), WMReader_Open(), WMReaderAdvanced4_GetURL(), and ChildWindow::WndProc().

◆ urlIDP

const BYTE urlIDP[]
static
Initial value:
= { 0x30,0x17,0xa0,0x15,0xa0,0x13,0x86,0x11,0x68,
0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,
0x67 }

Definition at line 3792 of file encode.c.

Referenced by test_decodeCRLIssuingDistPoint(), and test_encodeCRLIssuingDistPoint().

◆ us

◆ utf8CommonNameValue

BYTE utf8CommonNameValue[]
static
Initial value:
= {
0x0c,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1221 of file encode.c.

◆ v1Cert

const BYTE v1Cert[]
static
Initial value:
= { 0x30, 0x33, 0x02, 0x00, 0x30, 0x02, 0x06, 0x00,
0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30,
0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x07, 0x30,
0x02, 0x06, 0x00, 0x03, 0x01, 0x00 }

Definition at line 2974 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithConstraints

const BYTE v1CertWithConstraints[]
static
Initial value:
= { 0x30, 0x4b, 0x02, 0x00, 0x30,
0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31,
0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36,
0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00, 0xa3, 0x16, 0x30, 0x14,
0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30,
0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 }

Definition at line 2994 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithIssuerUniqueId

const BYTE v1CertWithIssuerUniqueId[]
static
Initial value:
= {
0x30,0x38,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,
0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,
0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,
0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0x81,0x02,0x00,0x01 }

Definition at line 3051 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithPubKey

const BYTE v1CertWithPubKey[]
static
Initial value:
= {
0x30,0x81,0x95,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,
0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,
0x01,0x01 }

Definition at line 3018 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithPubKeyNoNull

const BYTE v1CertWithPubKeyNoNull[]
static
Initial value:
= {
0x30,0x81,0x93,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x20,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,
0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 3030 of file encode.c.

Referenced by test_encodeCertToBeSigned().

◆ v1CertWithSerial

const BYTE v1CertWithSerial[]
static
Initial value:
= { 0x30, 0x4c, 0x02, 0x01, 0x01, 0x30,
0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31,
0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36,
0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00, 0xa3, 0x16, 0x30, 0x14,
0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x08, 0x30,
0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01 }

Definition at line 3001 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithSubjectIssuerSerialAndIssuerUniqueId

const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId[]
static
Initial value:
= {
0x30,0x81,0x99,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x05,0x00,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x81,0x02,0x00,0x01,0xa3,0x16,0x30,
0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,
0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 3056 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull

const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull[]
static
Initial value:
= {
0x30,0x81,0x97,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x20,0x30,0x0b,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
0x01,0x01,0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x81,0x02,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,
0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,
0xff,0x02,0x01,0x01 }

Definition at line 3068 of file encode.c.

Referenced by test_encodeCertToBeSigned().

◆ v1CertWithSubjectKeyId

const BYTE v1CertWithSubjectKeyId[]
static
Initial value:
= {
0x30,0x7b,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,0x11,
0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,
0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,0x06,
0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,
0x00,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x17,0x30,0x15,0x30,
0x13,0x06,0x03,0x55,0x1d,0x0e,0x04,0x0c,0x04,0x0a,0x4a,0x75,0x61,0x6e,0x20,
0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 3041 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v1CRL

const BYTE v1CRL[]
static
Initial value:
= { 0x30, 0x15, 0x30, 0x02, 0x06, 0x00, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a }

Definition at line 3985 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v1CRLWithEntryExt

const BYTE v1CRLWithEntryExt[]
static
Initial value:
= { 0x30,0x5a,0x30,0x02,0x06,0x00,0x30,
0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,
0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x2c,0x30,0x2a,0x02,0x01,
0x01,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,
0x30,0x30,0x5a,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,
0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 4008 of file encode.c.

Referenced by test_encodeCRLToBeSigned().

◆ v1CRLWithExt

const BYTE v1CRLWithExt[]
static
Initial value:
= { 0x30,0x5c,0x30,0x02,0x06,0x00,0x30,0x15,
0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,
0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,
0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x16,0x30,0x14,0x02,0x01,0x01,
0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
0x30,0x5a,0xa0,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 4015 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v1CRLWithIssuer

const BYTE v1CRLWithIssuer[]
static
Initial value:
= { 0x30, 0x2c, 0x30, 0x02, 0x06, 0x00,
0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0a,
0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18, 0x0f, 0x31,
0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x5a }

Definition at line 3991 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v1CRLWithIssuerAndEmptyEntry

const BYTE v1CRLWithIssuerAndEmptyEntry[]
static
Initial value:
= { 0x30, 0x43, 0x30, 0x02,
0x06, 0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18,
0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x5a, 0x30, 0x15, 0x30, 0x13, 0x02, 0x00, 0x18, 0x0f, 0x31, 0x36,
0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a }

Definition at line 3996 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v1CRLWithIssuerAndEntry

const BYTE v1CRLWithIssuerAndEntry[]
static
Initial value:
= { 0x30, 0x44, 0x30, 0x02, 0x06,
0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a, 0x30, 0x16, 0x30, 0x14, 0x02, 0x01, 0x01, 0x18, 0x0f, 0x31, 0x36,
0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a }

Definition at line 4002 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v2Cert

const BYTE v2Cert[]
static
Initial value:
= { 0x30, 0x38, 0xa0, 0x03, 0x02, 0x01, 0x01, 0x02,
0x00, 0x30, 0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31,
0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00 }

Definition at line 2979 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v2CRL

const BYTE v2CRL[]
static
Initial value:
= { 0x30, 0x18, 0x02, 0x01, 0x01, 0x30, 0x02, 0x06,
0x00, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x5a }

Definition at line 3988 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v2CRLWithExt

const BYTE v2CRLWithExt[]
static
Initial value:
= { 0x30,0x5c,0x02,0x01,0x01,0x30,0x02,0x06,
0x00,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,
0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00,0x18,0x0f,0x31,0x36,0x30,0x31,
0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x16,0x30,0x14,
0x02,0x01,0x01,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,
0x30,0x30,0x30,0x30,0x5a,0xa0,0x13,0x30,0x11,0x30,0x0f,0x06,0x03,0x55,0x1d,
0x13,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 }

Definition at line 4022 of file encode.c.

Referenced by test_decodeCRLToBeSigned(), and test_encodeCRLToBeSigned().

◆ v3Cert

const BYTE v3Cert[]
static
Initial value:
= { 0x30, 0x38, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
0x00, 0x30, 0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31,
0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f,
0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x5a, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00 }

Definition at line 2984 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ v4Cert

const BYTE v4Cert[]
static
Initial value:
= {
0x30,0x38,0xa0,0x03,0x02,0x01,0x03,0x02,0x00,0x30,0x02,0x06,0x00,0x30,0x22,
0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,
0x30,0x30,0x30,0x5a,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00 }

Definition at line 2989 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ verisignCRL

const BYTE verisignCRL[]
static

Definition at line 4146 of file encode.c.

Referenced by test_decodeCRLToBeSigned().

◆ verisignCRLWithLotsOfEntries

const BYTE verisignCRLWithLotsOfEntries[]
static

Definition at line 4181 of file encode.c.

Referenced by test_decodeCRLToBeSigned().

◆ videotexCommonNameValue

BYTE videotexCommonNameValue[]
static
Initial value:
= {
0x15,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1208 of file encode.c.

◆ visibleCommonNameValue

BYTE visibleCommonNameValue[]
static
Initial value:
= {
0x1a,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 }

Definition at line 1214 of file encode.c.

◆ wine

const BYTE wine[]
static
Initial value:
= { 0x57, 0x69, 0x6e, 0x65, 0x20, 0x44, 0x65, 0x76,
0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74 }

Definition at line 678 of file encode.c.

Referenced by test_CreateAssemblyCacheItem(), test_InstallAssembly(), test_QueryAssemblyInfo(), test_SHGetFolderPathAndSubDirA(), and test_SQLGetPrivateProfileStringW().