ReactOS 0.4.15-dev-7961-gdcf9eb0
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

static BOOL (WINAPI *pCryptDecodeObjectEx)(DWORD
 
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 int strncmpW (const WCHAR *str1, const WCHAR *str2, int n)
 
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_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)
 
 START_TEST (encode)
 

Variables

static LPCSTR
 
static const BYTE DWORD
 
static const BYTE PCRYPT_DECODE_PARA
 
static const BYTE void DWORD *static const void PCRYPT_ENCODE_PARA
 
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 WCHAR commonNameW [] = { 'J','u','a','n',' ','L','a','n','g',0 }
 
static WCHAR surNameW [] = { 'L','a','n','g',0 }
 
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 []
 
static const BYTE encodedURL []
 
static const WCHAR nihongoURL []
 
static const WCHAR dnsName [] = { 'w','i','n','e','h','q','.','o','r','g',0 }
 
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 const WCHAR oneW [] = { '1',0 }
 
static const WCHAR aW [] = { 'a',0 }
 
static const WCHAR quoteW [] = { '"', 0 }
 
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,0x01,0x00,0x01 }
 
static const BYTE mod2_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,0x00,0x01 }
 
static const BYTE mod3_encoded [] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x80,0x02,0x03,0x01,0x00,0x01 }
 
static const BYTE mod4_encoded [] = { 0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,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 WCHAR noticeText []
 
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"
 

Macro Definition Documentation

◆ RDNA

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

Definition at line 703 of file encode.c.

◆ RDNIA5

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

Definition at line 704 of file encode.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pCryptDecodeObjectEx)
static

◆ compareAltNameEntry()

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

Definition at line 3847 of file encode.c.

3849{
3850 ok(expected->dwAltNameChoice == got->dwAltNameChoice,
3851 "Expected name choice %d, got %d\n", expected->dwAltNameChoice,
3852 got->dwAltNameChoice);
3853 if (expected->dwAltNameChoice == got->dwAltNameChoice)
3854 {
3855 switch (got->dwAltNameChoice)
3856 {
3860 case CERT_ALT_NAME_URL:
3862 ok((!U(*expected).pwszURL && !U(*got).pwszURL) ||
3863 (!U(*expected).pwszURL && !lstrlenW(U(*got).pwszURL)) ||
3864 (!U(*got).pwszURL && !lstrlenW(U(*expected).pwszURL)) ||
3865 !lstrcmpW(U(*expected).pwszURL, U(*got).pwszURL),
3866 "Unexpected name\n");
3867 break;
3871 ok(U(*got).IPAddress.cbData == U(*expected).IPAddress.cbData,
3872 "Unexpected IP address length %d\n", U(*got).IPAddress.cbData);
3873 ok(!memcmp(U(*got).IPAddress.pbData, U(*expected).IPAddress.pbData,
3874 U(*got).IPAddress.cbData), "Unexpected value\n");
3875 break;
3876 }
3877 }
3878}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define U(x)
Definition: wordpad.c:45
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL expected
Definition: store.c:2063
DWORD dwAltNameChoice
Definition: wincrypt.h:333
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
#define CERT_ALT_NAME_IP_ADDRESS
Definition: wincrypt.h:352
#define CERT_ALT_NAME_EDI_PARTY_NAME
Definition: wincrypt.h:350
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:346
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:347
#define CERT_ALT_NAME_REGISTERED_ID
Definition: wincrypt.h:353
#define CERT_ALT_NAME_X400_ADDRESS
Definition: wincrypt.h:348

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 3880 of file encode.c.

3882{
3883 DWORD i;
3884
3885 ok(expected->cAltEntry == got->cAltEntry, "Expected %d entries, got %d\n",
3886 expected->cAltEntry, got->cAltEntry);
3887 for (i = 0; i < min(expected->cAltEntry, got->cAltEntry); i++)
3888 compareAltNameEntry(&expected->rgAltEntry[i], &got->rgAltEntry[i]);
3889}
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:3847
#define min(a, b)
Definition: monoChain.cc:55
PCERT_ALT_NAME_ENTRY rgAltEntry
Definition: wincrypt.h:357

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 5305 of file encode.c.

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

Referenced by test_decodeAuthorityInfoAccess().

◆ compareCRLIssuingDistPoints()

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

Definition at line 3900 of file encode.c.

3902{
3903 compareDistPointName(&expected->DistPointName, &got->DistPointName);
3904 ok(got->fOnlyContainsUserCerts == expected->fOnlyContainsUserCerts,
3905 "Unexpected fOnlyContainsUserCerts\n");
3906 ok(got->fOnlyContainsCACerts == expected->fOnlyContainsCACerts,
3907 "Unexpected fOnlyContainsCACerts\n");
3908 ok(got->OnlySomeReasonFlags.cbData == expected->OnlySomeReasonFlags.cbData,
3909 "Unexpected reason flags\n");
3910 ok(got->fIndirectCRL == expected->fIndirectCRL,
3911 "Unexpected fIndirectCRL\n");
3912}
static void compareDistPointName(const CRL_DIST_POINT_NAME *expected, const CRL_DIST_POINT_NAME *got)
Definition: encode.c:3891
CRL_DIST_POINT_NAME DistPointName
Definition: wincrypt.h:563
CRYPT_BIT_BLOB OnlySomeReasonFlags
Definition: wincrypt.h:566

Referenced by test_decodeCRLIssuingDistPoint().

◆ compareCTLInfo()

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

Definition at line 5620 of file encode.c.

5622{
5623 DWORD i, j, k;
5624
5625 ok(expected->dwVersion == got->dwVersion,
5626 "%s: expected version %d, got %d\n", header, expected->dwVersion,
5627 got->dwVersion);
5628 ok(expected->SubjectUsage.cUsageIdentifier ==
5630 "%s: expected %d usage identifiers, got %d\n", header,
5631 expected->SubjectUsage.cUsageIdentifier,
5633 for (i = 0; i < expected->SubjectUsage.cUsageIdentifier; i++)
5634 ok(!strcmp(expected->SubjectUsage.rgpszUsageIdentifier[i],
5636 "%s[%d]: expected %s, got %s\n", header, i,
5637 expected->SubjectUsage.rgpszUsageIdentifier[i],
5639 ok(expected->ListIdentifier.cbData == got->ListIdentifier.cbData,
5640 "%s: expected list identifier of %d bytes, got %d\n", header,
5641 expected->ListIdentifier.cbData, got->ListIdentifier.cbData);
5642 if (expected->ListIdentifier.cbData)
5643 ok(!memcmp(expected->ListIdentifier.pbData, got->ListIdentifier.pbData,
5644 expected->ListIdentifier.cbData),
5645 "%s: unexpected list identifier value\n", header);
5646 ok(expected->SequenceNumber.cbData == got->SequenceNumber.cbData,
5647 "%s: expected sequence number of %d bytes, got %d\n", header,
5648 expected->SequenceNumber.cbData, got->SequenceNumber.cbData);
5649 if (expected->SequenceNumber.cbData)
5650 ok(!memcmp(expected->SequenceNumber.pbData, got->SequenceNumber.pbData,
5651 expected->SequenceNumber.cbData),
5652 "%s: unexpected sequence number value\n", header);
5653 ok(!memcmp(&expected->ThisUpdate, &got->ThisUpdate, sizeof(FILETIME)),
5654 "%s: expected this update = (%d, %d), got (%d, %d)\n", header,
5655 expected->ThisUpdate.dwLowDateTime, expected->ThisUpdate.dwHighDateTime,
5657 ok(!memcmp(&expected->NextUpdate, &got->NextUpdate, sizeof(FILETIME)),
5658 "%s: expected next update = (%d, %d), got (%d, %d)\n", header,
5659 expected->NextUpdate.dwLowDateTime, expected->NextUpdate.dwHighDateTime,
5661 if (expected->SubjectAlgorithm.pszObjId &&
5662 *expected->SubjectAlgorithm.pszObjId && !got->SubjectAlgorithm.pszObjId)
5663 ok(0, "%s: expected subject algorithm %s, got NULL\n", header,
5664 expected->SubjectAlgorithm.pszObjId);
5665 if (expected->SubjectAlgorithm.pszObjId && got->SubjectAlgorithm.pszObjId)
5666 ok(!strcmp(expected->SubjectAlgorithm.pszObjId,
5668 "%s: expected subject algorithm %s, got %s\n", header,
5669 expected->SubjectAlgorithm.pszObjId, got->SubjectAlgorithm.pszObjId);
5670 ok(expected->SubjectAlgorithm.Parameters.cbData ==
5672 "%s: expected subject algorithm parameters of %d bytes, got %d\n", header,
5673 expected->SubjectAlgorithm.Parameters.cbData,
5675 if (expected->SubjectAlgorithm.Parameters.cbData)
5676 ok(!memcmp(expected->SubjectAlgorithm.Parameters.pbData,
5678 expected->SubjectAlgorithm.Parameters.cbData),
5679 "%s: unexpected subject algorithm parameter value\n", header);
5680 ok(expected->cCTLEntry == got->cCTLEntry,
5681 "%s: expected %d CTL entries, got %d\n", header, expected->cCTLEntry,
5682 got->cCTLEntry);
5683 for (i = 0; i < expected->cCTLEntry; i++)
5684 {
5685 ok(expected->rgCTLEntry[i].SubjectIdentifier.cbData ==
5687 "%s[%d]: expected subject identifier of %d bytes, got %d\n",
5688 header, i, expected->rgCTLEntry[i].SubjectIdentifier.cbData,
5690 if (expected->rgCTLEntry[i].SubjectIdentifier.cbData)
5691 ok(!memcmp(expected->rgCTLEntry[i].SubjectIdentifier.pbData,
5693 expected->rgCTLEntry[i].SubjectIdentifier.cbData),
5694 "%s[%d]: unexpected subject identifier value\n",
5695 header, i);
5696 for (j = 0; j < expected->rgCTLEntry[i].cAttribute; j++)
5697 {
5698 ok(!strcmp(expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5700 "%s[%d][%d]: expected attribute OID %s, got %s\n", header, i, j,
5701 expected->rgCTLEntry[i].rgAttribute[j].pszObjId,
5703 for (k = 0; k < expected->rgCTLEntry[i].rgAttribute[j].cValue; k++)
5704 {
5705 ok(expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData ==
5707 "%s[%d][%d][%d]: expected value of %d bytes, got %d\n",
5708 header, i, j, k,
5709 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData,
5711 if (expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData)
5712 ok(!memcmp(
5713 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].pbData,
5715 expected->rgCTLEntry[i].rgAttribute[j].rgValue[k].cbData),
5716 "%s[%d][%d][%d]: unexpected value\n",
5717 header, i, j, k);
5718 }
5719 }
5720 }
5721 ok(expected->cExtension == got->cExtension,
5722 "%s: expected %d extensions, got %d\n", header, expected->cExtension,
5723 got->cExtension);
5724 for (i = 0; i < expected->cExtension; i++)
5725 {
5726 ok(!strcmp(expected->rgExtension[i].pszObjId,
5727 got->rgExtension[i].pszObjId), "%s[%d]: expected %s, got %s\n",
5728 header, i, expected->rgExtension[i].pszObjId,
5729 got->rgExtension[i].pszObjId);
5730 ok(expected->rgExtension[i].fCritical == got->rgExtension[i].fCritical,
5731 "%s[%d]: expected fCritical = %d, got %d\n", header, i,
5732 expected->rgExtension[i].fCritical, got->rgExtension[i].fCritical);
5733 ok(expected->rgExtension[i].Value.cbData ==
5734 got->rgExtension[i].Value.cbData,
5735 "%s[%d]: expected extension value to have %d bytes, got %d\n",
5736 header, i, expected->rgExtension[i].Value.cbData,
5737 got->rgExtension[i].Value.cbData);
5738 if (expected->rgExtension[i].Value.cbData)
5739 ok(!memcmp(expected->rgExtension[i].Value.pbData,
5740 got->rgExtension[i].Value.pbData,
5741 expected->rgExtension[i].Value.cbData),
5742 "%s[%d]: unexpected extension value\n", header, i);
5743 }
5744}
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:230
CRYPT_OBJID_BLOB Value
Definition: wincrypt.h:232
BYTE * pbData
Definition: wincrypt.h:103
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:127
PCRYPT_DATA_BLOB rgValue
Definition: wincrypt.h:590
CRYPT_DATA_BLOB SubjectIdentifier
Definition: wincrypt.h:724
PCRYPT_ATTRIBUTE rgAttribute
Definition: wincrypt.h:726
CRYPT_INTEGER_BLOB SequenceNumber
Definition: wincrypt.h:733
DWORD cExtension
Definition: wincrypt.h:739
DWORD dwVersion
Definition: wincrypt.h:730
CRYPT_ALGORITHM_IDENTIFIER SubjectAlgorithm
Definition: wincrypt.h:736
FILETIME NextUpdate
Definition: wincrypt.h:735
PCTL_ENTRY rgCTLEntry
Definition: wincrypt.h:738
CRYPT_DATA_BLOB ListIdentifier
Definition: wincrypt.h:732
DWORD cCTLEntry
Definition: wincrypt.h:737
CTL_USAGE SubjectUsage
Definition: wincrypt.h:731
FILETIME ThisUpdate
Definition: wincrypt.h:734
PCERT_EXTENSION rgExtension
Definition: wincrypt.h:740
DWORD cUsageIdentifier
Definition: wincrypt.h:719
LPSTR * rgpszUsageIdentifier
Definition: wincrypt.h:720
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 3891 of file encode.c.

3893{
3894 ok(got->dwDistPointNameChoice == expected->dwDistPointNameChoice,
3895 "Unexpected name choice %d\n", got->dwDistPointNameChoice);
3897 compareAltNameInfo(&(U(*expected).FullName), &(U(*got).FullName));
3898}
static void compareAltNameInfo(const CERT_ALT_NAME_INFO *expected, const CERT_ALT_NAME_INFO *got)
Definition: encode.c:3880
DWORD dwDistPointNameChoice
Definition: wincrypt.h:507
#define CRL_DIST_POINT_FULL_NAME
Definition: wincrypt.h:514

Referenced by compareCRLIssuingDistPoints().

◆ compareNames()

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

Definition at line 1048 of file encode.c.

1050{
1051 ok(got->cRDN == expected->cRDN, "Expected %d RDNs, got %d\n",
1052 expected->cRDN, got->cRDN);
1053 if (got->cRDN)
1054 {
1055 DWORD i;
1056
1057 for (i = 0; i < got->cRDN; i++)
1058 compareRDNs(&expected->rgRDN[i], &got->rgRDN[i]);
1059 }
1060}
static void compareRDNs(const CERT_RDN *expected, const CERT_RDN *got)
Definition: encode.c:1035
PCERT_RDN rgRDN
Definition: wincrypt.h:268

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 994 of file encode.c.

996{
997 if (expected->dwValueType == CERT_RDN_UTF8_STRING &&
999 {
1000 win_skip("Can't handle CERT_RDN_UTF8_STRING\n");
1001 return;
1002 }
1003
1004 ok(got->dwValueType == expected->dwValueType,
1005 "Expected string type %d, got %d\n", expected->dwValueType,
1006 got->dwValueType);
1007 ok(got->Value.cbData == expected->Value.cbData ||
1008 got->Value.cbData == expected->Value.cbData - sizeof(WCHAR) /* Win8 */,
1009 "String type %d: unexpected data size, got %d, expected %d\n",
1010 expected->dwValueType, got->Value.cbData, expected->Value.cbData);
1011 if (got->Value.cbData && got->Value.pbData)
1012 ok(!memcmp(got->Value.pbData, expected->Value.pbData,
1013 min(got->Value.cbData, expected->Value.cbData)),
1014 "String type %d: unexpected value\n", expected->dwValueType);
1015}
#define win_skip
Definition: test.h:160
DWORD dwValueType
Definition: wincrypt.h:272
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:273
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
#define CERT_RDN_ENCODED_BLOB
Definition: wincrypt.h:2777
__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 2875 of file encode.c.

2877{
2878 ok(!strcmp(expected->Algorithm.pszObjId, got->Algorithm.pszObjId),
2879 "Expected OID %s, got %s\n", expected->Algorithm.pszObjId,
2880 got->Algorithm.pszObjId);
2881 ok(expected->Algorithm.Parameters.cbData ==
2883 "Expected parameters of %d bytes, got %d\n",
2884 expected->Algorithm.Parameters.cbData, got->Algorithm.Parameters.cbData);
2885 if (expected->Algorithm.Parameters.cbData)
2886 ok(!memcmp(expected->Algorithm.Parameters.pbData,
2888 "Unexpected algorithm parameters\n");
2889 ok(expected->PublicKey.cbData == got->PublicKey.cbData,
2890 "Expected public key of %d bytes, got %d\n",
2891 expected->PublicKey.cbData, got->PublicKey.cbData);
2892 if (expected->PublicKey.cbData)
2893 ok(!memcmp(expected->PublicKey.pbData, got->PublicKey.pbData,
2894 got->PublicKey.cbData), "Unexpected public key value\n");
2895}
CRYPT_BIT_BLOB PublicKey
Definition: wincrypt.h:226
CRYPT_ALGORITHM_IDENTIFIER Algorithm
Definition: wincrypt.h:225
BYTE * pbData
Definition: wincrypt.h:197

Referenced by test_decodePublicKeyInfo().

◆ compareRDNAttrs()

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

Definition at line 1017 of file encode.c.

1019{
1020 if (expected->pszObjId && *expected->pszObjId)
1021 {
1022 ok(got->pszObjId != NULL, "Expected OID %s, got NULL\n",
1023 expected->pszObjId);
1024 if (got->pszObjId)
1025 {
1026 ok(!strcmp(got->pszObjId, expected->pszObjId),
1027 "Got unexpected OID %s, expected %s\n", got->pszObjId,
1028 expected->pszObjId);
1029 }
1030 }
1031 compareNameValues((const CERT_NAME_VALUE *)&expected->dwValueType,
1032 (const CERT_NAME_VALUE *)&got->dwValueType);
1033}
#define NULL
Definition: types.h:112
static void compareNameValues(const CERT_NAME_VALUE *expected, const CERT_NAME_VALUE *got)
Definition: encode.c:994
LPSTR pszObjId
Definition: wincrypt.h:256
DWORD dwValueType
Definition: wincrypt.h:257

Referenced by compareRDNs().

◆ compareRDNs()

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

Definition at line 1035 of file encode.c.

1036{
1037 ok(got->cRDNAttr == expected->cRDNAttr,
1038 "Expected %d RDN attrs, got %d\n", expected->cRDNAttr, got->cRDNAttr);
1039 if (got->cRDNAttr)
1040 {
1041 DWORD i;
1042
1043 for (i = 0; i < got->cRDNAttr; i++)
1044 compareRDNAttrs(&expected->rgRDNAttr[i], &got->rgRDNAttr[i]);
1045 }
1046}
static void compareRDNAttrs(const CERT_RDN_ATTR *expected, const CERT_RDN_ATTR *got)
Definition: encode.c:1017
DWORD cRDNAttr
Definition: wincrypt.h:262
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:263

Referenced by compareNames().

◆ compareSMimeCapabilities()

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

Definition at line 6451 of file encode.c.

6453{
6454 DWORD i;
6455
6456 ok(got->cCapability == expected->cCapability,
6457 "%s: expected %d capabilities, got %d\n", header, expected->cCapability,
6458 got->cCapability);
6459 for (i = 0; i < expected->cCapability; i++)
6460 {
6461 ok(!strcmp(expected->rgCapability[i].pszObjId,
6462 got->rgCapability[i].pszObjId), "%s[%d]: expected %s, got %s\n",
6463 header, i, expected->rgCapability[i].pszObjId,
6464 got->rgCapability[i].pszObjId);
6465 ok(expected->rgCapability[i].Parameters.cbData ==
6467 "%s[%d]: expected %d bytes, got %d\n", header, i,
6468 expected->rgCapability[i].Parameters.cbData,
6470 if (expected->rgCapability[i].Parameters.cbData)
6471 ok(!memcmp(expected->rgCapability[i].Parameters.pbData,
6473 expected->rgCapability[i].Parameters.cbData),
6474 "%s[%d]: unexpected value\n", header, i);
6475 }
6476}
PCRYPT_SMIME_CAPABILITY rgCapability
Definition: wincrypt.h:693
CRYPT_OBJID_BLOB Parameters
Definition: wincrypt.h:688

Referenced by test_decodePKCSSMimeCapabilities().

◆ compareTime()

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

Definition at line 498 of file encode.c.

499{
500 SYSTEMTIME st;
501
502 FileTimeToSystemTime(got, &st);
503 ok((expected->wYear == st.wYear &&
504 expected->wMonth == st.wMonth &&
505 expected->wDay == st.wDay &&
506 expected->wHour == st.wHour &&
507 expected->wMinute == st.wMinute &&
508 expected->wSecond == st.wSecond &&
509 abs(expected->wMilliseconds - st.wMilliseconds) <= 1) ||
510 /* Some Windows systems only seem to be accurate in their time decoding to
511 * within about an hour.
512 */
513 broken(expected->wYear == st.wYear &&
514 expected->wMonth == st.wMonth &&
515 expected->wDay == st.wDay &&
516 abs(expected->wHour - st.wHour) <= 1),
517 "Got unexpected value for time decoding:\nexpected %s, got %s\n",
519}
#define broken(x)
Definition: _sntprintf.h:21
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:487
static const char * printSystemTime(const SYSTEMTIME *st)
Definition: encode.c:478
WORD wYear
Definition: winbase.h:905
WORD wMilliseconds
Definition: winbase.h:912
WORD wMonth
Definition: winbase.h:906
WORD wHour
Definition: winbase.h:909
WORD wSecond
Definition: winbase.h:911
WORD wMinute
Definition: winbase.h:910
WORD wDay
Definition: winbase.h:908

Referenced by testTimeDecoding().

◆ printFileTime()

static const char * printFileTime ( const FILETIME ft)
static

Definition at line 487 of file encode.c.

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

Referenced by compareTime().

◆ printSystemTime()

static const char * printSystemTime ( const SYSTEMTIME st)
static

Definition at line 478 of file encode.c.

479{
480 static char buf[64];
481
482 sprintf(buf, "%02d-%02d-%04d %02d:%02d:%02d.%03d", st->wMonth, st->wDay,
483 st->wYear, st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
484 return buf;
485}

Referenced by compareTime().

◆ START_TEST()

START_TEST ( encode  )

Definition at line 8508 of file encode.c.

8509{
8510 static const DWORD encodings[] = { X509_ASN_ENCODING, PKCS_7_ASN_ENCODING,
8512 HMODULE hCrypt32;
8513 DWORD i;
8514
8515 hCrypt32 = GetModuleHandleA("crypt32.dll");
8516 pCryptDecodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptDecodeObjectEx");
8517 pCryptEncodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptEncodeObjectEx");
8518 if (!pCryptDecodeObjectEx || !pCryptEncodeObjectEx)
8519 {
8520 win_skip("CryptDecodeObjectEx() is not available\n");
8521 return;
8522 }
8523
8524 for (i = 0; i < ARRAY_SIZE(encodings); i++)
8525 {
8526 test_encodeInt(encodings[i]);
8527 test_decodeInt(encodings[i]);
8528 test_encodeEnumerated(encodings[i]);
8529 test_decodeEnumerated(encodings[i]);
8530 test_encodeFiletime(encodings[i]);
8531 test_decodeFiletime(encodings[i]);
8532 test_encodeName(encodings[i]);
8533 test_decodeName(encodings[i]);
8534 test_encodeUnicodeName(encodings[i]);
8535 test_decodeUnicodeName(encodings[i]);
8536 test_encodeNameValue(encodings[i]);
8537 test_decodeNameValue(encodings[i]);
8538 test_encodeUnicodeNameValue(encodings[i]);
8539 test_decodeUnicodeNameValue(encodings[i]);
8540 test_encodeAltName(encodings[i]);
8541 test_decodeAltName(encodings[i]);
8542 test_encodeOctets(encodings[i]);
8543 test_decodeOctets(encodings[i]);
8544 test_encodeBits(encodings[i]);
8545 test_decodeBits(encodings[i]);
8546 test_encodeBasicConstraints(encodings[i]);
8547 test_decodeBasicConstraints(encodings[i]);
8548 test_encodeRsaPublicKey(encodings[i]);
8549 test_decodeRsaPublicKey(encodings[i]);
8550 test_encodeSequenceOfAny(encodings[i]);
8551 test_decodeSequenceOfAny(encodings[i]);
8552 test_encodeExtensions(encodings[i]);
8553 test_decodeExtensions(encodings[i]);
8554 test_encodePublicKeyInfo(encodings[i]);
8555 test_decodePublicKeyInfo(encodings[i]);
8556 test_encodeCertToBeSigned(encodings[i]);
8557 test_decodeCertToBeSigned(encodings[i]);
8558 test_encodeCert(encodings[i]);
8559 test_decodeCert(encodings[i]);
8560 test_encodeCRLDistPoints(encodings[i]);
8561 test_decodeCRLDistPoints(encodings[i]);
8564 test_encodeCRLToBeSigned(encodings[i]);
8565 test_decodeCRLToBeSigned(encodings[i]);
8566 test_encodeEnhancedKeyUsage(encodings[i]);
8567 test_decodeEnhancedKeyUsage(encodings[i]);
8568 test_encodeAuthorityKeyId(encodings[i]);
8569 test_decodeAuthorityKeyId(encodings[i]);
8570 test_encodeAuthorityKeyId2(encodings[i]);
8571 test_decodeAuthorityKeyId2(encodings[i]);
8574 test_encodeCTL(encodings[i]);
8575 test_decodeCTL(encodings[i]);
8576 test_encodePKCSContentInfo(encodings[i]);
8577 test_decodePKCSContentInfo(encodings[i]);
8578 test_encodePKCSAttribute(encodings[i]);
8579 test_decodePKCSAttribute(encodings[i]);
8580 test_encodePKCSAttributes(encodings[i]);
8581 test_decodePKCSAttributes(encodings[i]);
8584 test_encodePKCSSignerInfo(encodings[i]);
8585 test_decodePKCSSignerInfo(encodings[i]);
8586 test_encodeCMSSignerInfo(encodings[i]);
8587 test_decodeCMSSignerInfo(encodings[i]);
8588 test_encodeNameConstraints(encodings[i]);
8589 test_decodeNameConstraints(encodings[i]);
8592 test_encodeCertPolicies(encodings[i]);
8593 test_decodeCertPolicies(encodings[i]);
8594 test_encodeCertPolicyMappings(encodings[i]);
8595 test_decodeCertPolicyMappings(encodings[i]);
8598 test_decodeRsaPrivateKey(encodings[i]);
8599 }
8601}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static void test_decodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3235
static void test_decodeOctets(DWORD dwEncoding)
Definition: encode.c:2027
static void test_encodeEnumerated(DWORD dwEncoding)
Definition: encode.c:376
static void test_encodeName(DWORD dwEncoding)
Definition: encode.c:744
static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7465
static void test_decodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4987
static void test_decodeName(DWORD dwEncoding)
Definition: encode.c:1068
static void test_encodeAltName(DWORD dwEncoding)
Definition: encode.c:1452
static void test_encodeInt(DWORD dwEncoding)
Definition: encode.c:89
static void test_decodeCTL(DWORD dwEncoding)
Definition: encode.c:5782
static void test_encodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2425
static void test_decodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3914
static void test_decodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7806
static void test_decodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6318
static void test_encodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6149
static void test_encodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6394
static void test_decodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:7061
static void test_encodeCTL(DWORD dwEncoding)
Definition: encode.c:5447
static void test_decodeNameValue(DWORD dwEncoding)
Definition: encode.c:1366
static void test_encodeExtensions(DWORD dwEncoding)
Definition: encode.c:2710
static void test_decodePKCSAttribute(DWORD dwEncoding)
Definition: encode.c:6208
static void test_encodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7892
static void test_decodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2304
static void test_decodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2897
static void test_encodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7594
static void test_decodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5136
static void test_decodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3643
static void test_decodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6760
static void test_encodeCert(DWORD dwEncoding)
Definition: encode.c:3440
static void test_decodeInt(DWORD dwEncoding)
Definition: encode.c:205
static void test_decodeCertPolicies(DWORD dwEncoding)
Definition: encode.c:7650
static void test_decodeBits(DWORD dwEncoding)
Definition: encode.c:2155
static void test_encodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5230
static void test_encodeBasicConstraints(DWORD dwEncoding)
Definition: encode.c:2242
static void test_encodeCRLDistPoints(DWORD dwEncoding)
Definition: encode.c:3552
static void test_encodeBits(DWORD dwEncoding)
Definition: encode.c:2126
static void test_decodeRsaPublicKey(DWORD dwEncoding)
Definition: encode.c:2516
static void test_encodeFiletime(DWORD dwEncoding)
Definition: encode.c:562
static void test_decodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7385
static void test_encodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1820
static void test_decodeExtensions(DWORD dwEncoding)
Definition: encode.c:2734
static void test_encodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4836
static void test_decodePKCSSMimeCapabilities(DWORD dwEncoding)
Definition: encode.c:6478
static void test_decodeAltName(DWORD dwEncoding)
Definition: encode.c:1565
static void test_decodeEnhancedKeyUsage(DWORD dwEncoding)
Definition: encode.c:4868
static void test_decodeAuthorityInfoAccess(DWORD dwEncoding)
Definition: encode.c:5325
static void test_encodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4018
static void test_encodeNameValue(DWORD dwEncoding)
Definition: encode.c:1314
static void test_encodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:894
static void test_encodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2591
static void test_decodePolicyQualifierUserNotice(DWORD dwEncoding)
Definition: encode.c:7516
static void test_encodePKCSAttributes(DWORD dwEncoding)
Definition: encode.c:6265
static void test_encodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:5971
static void test_encodePublicKeyInfo(DWORD dwEncoding)
Definition: encode.c:2848
static void test_encodeCRLIssuingDistPoint(DWORD dwEncoding)
Definition: encode.c:3774
static void test_encodeCertPolicyMappings(DWORD dwEncoding)
Definition: encode.c:7736
static void test_encodeCMSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6891
static void test_encodePKCSSignerInfo(DWORD dwEncoding)
Definition: encode.c:6594
static void test_decodeCRLToBeSigned(DWORD dwEncoding)
Definition: encode.c:4682
static void test_decodeCert(DWORD dwEncoding)
Definition: encode.c:3463
static void test_encodeAuthorityKeyId(DWORD dwEncoding)
Definition: encode.c:4928
static void test_encodeNameConstraints(DWORD dwEncoding)
Definition: encode.c:7241
static void testPortPublicKeyInfo(void)
Definition: encode.c:8485
static void test_encodeOctets(DWORD dwEncoding)
Definition: encode.c:1971
static void test_decodeUnicodeNameValue(DWORD dwEncoding)
Definition: encode.c:1932
static void test_decodeCertPolicyConstraints(DWORD dwEncoding)
Definition: encode.c:7965
static void test_decodeFiletime(DWORD dwEncoding)
Definition: encode.c:607
static void test_decodeRsaPrivateKey(DWORD dwEncoding)
Definition: encode.c:8248
static void test_decodePKCSContentInfo(DWORD dwEncoding)
Definition: encode.c:6082
static void test_decodeSequenceOfAny(DWORD dwEncoding)
Definition: encode.c:2635
static void test_decodeEnumerated(DWORD dwEncoding)
Definition: encode.c:409
static void test_encodeAuthorityKeyId2(DWORD dwEncoding)
Definition: encode.c:5067
static void test_decodeUnicodeName(DWORD dwEncoding)
Definition: encode.c:1167
static void test_encodeCertToBeSigned(DWORD dwEncoding)
Definition: encode.c:3051
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2299

◆ strncmpW()

static int strncmpW ( const WCHAR str1,
const WCHAR str2,
int  n 
)
inlinestatic

Definition at line 1925 of file encode.c.

1926{
1927 if (n <= 0) return 0;
1928 while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
1929 return *str1 - *str2;
1930}
GLdouble n
Definition: glext.h:7729

◆ test_decodeAltName()

static void test_decodeAltName ( DWORD  dwEncoding)
static

Definition at line 1565 of file encode.c.

1566{
1567 static const BYTE unimplementedType[] = { 0x30, 0x06, 0x85, 0x04, 0x7f,
1568 0x00, 0x00, 0x01 };
1569 static const BYTE bogusType[] = { 0x30, 0x06, 0x89, 0x04, 0x7f, 0x00, 0x00,
1570 0x01 };
1571 static const BYTE dns_embedded_null[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1572 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1573 static const BYTE dns_embedded_bell[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1574 0x6f,0x2e,0x63,0x6f,0x6d,0x07,0x62,0x61,0x64,0x64,0x69,0x65 };
1575 static const BYTE url_embedded_null[] = { 0x30,0x10,0x86,0x0e,0x66,0x6f,
1576 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1577 BOOL ret;
1578 BYTE *buf = NULL;
1579 DWORD bufSize = 0;
1581
1582 /* Test some bogus ones first */
1583 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1584 unimplementedType, sizeof(unimplementedType), CRYPT_DECODE_ALLOC_FLAG,
1585 NULL, &buf, &bufSize);
1587 GetLastError() == OSS_DATA_ERROR /* Win9x */),
1588 "Expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x\n",
1589 GetLastError());
1590 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1591 bogusType, sizeof(bogusType), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
1592 &bufSize);
1594 GetLastError() == OSS_DATA_ERROR /* Win9x */),
1595 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
1596 GetLastError());
1597 /* Now expected cases */
1598 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, emptySequence,
1600 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1601 if (ret)
1602 {
1604
1605 ok(info->cAltEntry == 0, "Expected 0 entries, got %d\n",
1606 info->cAltEntry);
1607 LocalFree(buf);
1608 }
1609 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, emptyURL,
1611 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1612 if (ret)
1613 {
1615
1616 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1617 info->cAltEntry);
1618 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1619 "Expected CERT_ALT_NAME_URL, got %d\n",
1620 info->rgAltEntry[0].dwAltNameChoice);
1621 ok(U(info->rgAltEntry[0]).pwszURL == NULL || !*U(info->rgAltEntry[0]).pwszURL,
1622 "Expected empty URL\n");
1623 LocalFree(buf);
1624 }
1625 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1627 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1628 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedURL,
1630 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1631 if (ret)
1632 {
1634
1635 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1636 info->cAltEntry);
1637 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_URL,
1638 "Expected CERT_ALT_NAME_URL, got %d\n",
1639 info->rgAltEntry[0].dwAltNameChoice);
1640 ok(!lstrcmpW(U(info->rgAltEntry[0]).pwszURL, url), "Unexpected URL\n");
1641 LocalFree(buf);
1642 }
1643 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedDnsName,
1645 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1646 if (ret)
1647 {
1649
1650 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1651 info->cAltEntry);
1652 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1653 "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1654 info->rgAltEntry[0].dwAltNameChoice);
1655 ok(!lstrcmpW(U(info->rgAltEntry[0]).pwszDNSName, dnsName),
1656 "Unexpected DNS name\n");
1657 LocalFree(buf);
1658 }
1659 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedIPAddr,
1661 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1662 if (ret)
1663 {
1665
1666 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1667 info->cAltEntry);
1668 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_IP_ADDRESS,
1669 "Expected CERT_ALT_NAME_IP_ADDRESS, got %d\n",
1670 info->rgAltEntry[0].dwAltNameChoice);
1671 ok(U(info->rgAltEntry[0]).IPAddress.cbData == sizeof(localhost),
1672 "Unexpected IP address length %d\n",
1673 U(info->rgAltEntry[0]).IPAddress.cbData);
1674 ok(!memcmp(U(info->rgAltEntry[0]).IPAddress.pbData, localhost,
1675 sizeof(localhost)), "Unexpected IP address value\n");
1676 LocalFree(buf);
1677 }
1678 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedOidName,
1680 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1681 if (ret)
1682 {
1684
1685 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1686 info->cAltEntry);
1687 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_REGISTERED_ID,
1688 "Expected CERT_ALT_NAME_REGISTERED_ID, got %d\n",
1689 info->rgAltEntry[0].dwAltNameChoice);
1690 ok(!strcmp(U(info->rgAltEntry[0]).pszRegisteredID, "1.2.3"),
1691 "Expected OID 1.2.3, got %s\n", U(info->rgAltEntry[0]).pszRegisteredID);
1692 LocalFree(buf);
1693 }
1694 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1697 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1698 if (ret)
1699 {
1701
1702 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1703 info->cAltEntry);
1704 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DIRECTORY_NAME,
1705 "Expected CERT_ALT_NAME_DIRECTORY_NAME, got %d\n",
1706 info->rgAltEntry[0].dwAltNameChoice);
1707 ok(U(info->rgAltEntry[0]).DirectoryName.cbData ==
1708 sizeof(encodedCommonName), "Unexpected directory name length %d\n",
1709 U(info->rgAltEntry[0]).DirectoryName.cbData);
1710 ok(!memcmp(U(info->rgAltEntry[0]).DirectoryName.pbData,
1712 "Unexpected directory name value\n");
1713 LocalFree(buf);
1714 }
1715 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1716 dns_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1717 NULL, &buf, &bufSize);
1718 /* Fails on WinXP with CRYPT_E_ASN1_RULE. I'm not too concerned about the
1719 * particular failure, just that it doesn't decode.
1720 * It succeeds on (broken) Windows versions that haven't addressed
1721 * embedded NULLs in alternate names.
1722 */
1723 ok(!ret || broken(ret), "expected failure\n");
1724 /* An embedded bell character is allowed, however. */
1725 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1726 dns_embedded_bell, sizeof(dns_embedded_bell), CRYPT_DECODE_ALLOC_FLAG,
1727 NULL, &buf, &bufSize);
1728 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1729 if (ret)
1730 {
1732
1733 ok(info->cAltEntry == 1, "Expected 1 entries, got %d\n",
1734 info->cAltEntry);
1735 ok(info->rgAltEntry[0].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME,
1736 "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1737 info->rgAltEntry[0].dwAltNameChoice);
1738 LocalFree(buf);
1739 }
1740 ret = pCryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME,
1741 url_embedded_null, sizeof(dns_embedded_null), CRYPT_DECODE_ALLOC_FLAG,
1742 NULL, &buf, &bufSize);
1743 /* Again, fails on WinXP with CRYPT_E_ASN1_RULE. I'm not too concerned
1744 * about the particular failure, just that it doesn't decode.
1745 * It succeeds on (broken) Windows versions that haven't addressed
1746 * embedded NULLs in alternate names.
1747 */
1748 ok(!ret || broken(ret), "expected failure\n");
1749}
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:1443
static const WCHAR dnsName[]
Definition: encode.c:1439
static const unsigned char encodedCommonName[]
Definition: encode.c:1445
static const BYTE encodedOidName[]
Definition: encode.c:1447
static const BYTE emptyURLExtraBytes[]
Definition: encode.c:1431
static const WCHAR url[]
Definition: encode.c:1432
static const BYTE emptySequence[]
Definition: encode.c:676
static const BYTE encodedURL[]
Definition: encode.c:1434
static const BYTE localhost[]
Definition: encode.c:1442
static const BYTE emptyURL[]
Definition: encode.c:1430
static const BYTE encodedDnsName[]
Definition: encode.c:1440
static const BYTE encodedDirectoryName[]
Definition: encode.c:1448
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define X509_ALTERNATE_NAME
Definition: wincrypt.h:3377
#define CRYPT_E_ASN1_CORRUPT
Definition: winerror.h:3087
#define OSS_DATA_ERROR
Definition: winerror.h:3042
#define CRYPT_E_ASN1_BADTAG
Definition: winerror.h:3095
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_decodeAuthorityInfoAccess()

static void test_decodeAuthorityInfoAccess ( DWORD  dwEncoding)
static

Definition at line 5325 of file encode.c.

5326{
5327 static char oid1[] = "1.2.3";
5328 static char oid2[] = "1.5.6";
5329 BOOL ret;
5330 LPBYTE buf = NULL;
5331 DWORD size = 0;
5332
5333 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5335 &buf, &size);
5336 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5337 if (ret)
5338 {
5340
5341 compareAuthorityInfoAccess("empty AIA", &aia,
5343 LocalFree(buf);
5344 buf = NULL;
5345 }
5346 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5349 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5350 if (ret)
5351 {
5352 CERT_ACCESS_DESCRIPTION accessDescription;
5354
5355 accessDescription.pszAccessMethod = oid1;
5357 U(accessDescription.AccessLocation).pwszURL = (LPWSTR)url;
5358 aia.cAccDescr = 1;
5359 aia.rgAccDescr = &accessDescription;
5360 compareAuthorityInfoAccess("AIA with URL", &aia,
5362 LocalFree(buf);
5363 buf = NULL;
5364 }
5365 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5368 NULL, &buf, &size);
5369 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5370 if (ret)
5371 {
5372 CERT_ACCESS_DESCRIPTION accessDescription[2];
5374
5375 accessDescription[0].pszAccessMethod = oid1;
5376 accessDescription[0].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5377 U(accessDescription[0].AccessLocation).pwszURL = (LPWSTR)url;
5378 accessDescription[1].pszAccessMethod = oid2;
5379 accessDescription[1].AccessLocation.dwAltNameChoice =
5381 U(accessDescription[1].AccessLocation).IPAddress.cbData =
5382 sizeof(encodedIPAddr);
5383 U(accessDescription[1].AccessLocation).IPAddress.pbData =
5385 aia.cAccDescr = 2;
5386 aia.rgAccDescr = accessDescription;
5387 compareAuthorityInfoAccess("AIA with URL and IP addr", &aia,
5389 LocalFree(buf);
5390 buf = NULL;
5391 }
5392 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5395 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5397 if (buf)
5398 {
5399 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS,
5402 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
5404 }
5405}
static WCHAR aia[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1601
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLsizeiptr size
Definition: glext.h:5919
static const BYTE authorityInfoAccessWithUrl[]
Definition: encode.c:5222
static const BYTE authorityInfoAccessWithUrlAndIPAddr[]
Definition: encode.c:5225
static void compareAuthorityInfoAccess(LPCSTR header, const CERT_AUTHORITY_INFO_ACCESS *expected, const CERT_AUTHORITY_INFO_ACCESS *got)
Definition: encode.c:5305
static char oid1[]
Definition: encode.c:7583
unsigned char * LPBYTE
Definition: typedefs.h:53
#define X509_AUTHORITY_INFO_ACCESS
Definition: wincrypt.h:3399
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId()

static void test_decodeAuthorityKeyId ( DWORD  dwEncoding)
static

Definition at line 4987 of file encode.c.

4988{
4989 BOOL ret;
4990 LPBYTE buf = NULL;
4991 DWORD size = 0;
4992
4993 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
4995 &buf, &size);
4996 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4997 if (ret)
4998 {
5000
5001 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5002 size);
5003 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5004 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5005 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5006 LocalFree(buf);
5007 }
5008 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5011 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5012 if (ret)
5013 {
5015
5016 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5017 size);
5018 ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5019 ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5020 "Unexpected key id\n");
5021 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5022 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5023 LocalFree(buf);
5024 }
5025 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5028 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5029 if (ret)
5030 {
5032
5033 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5034 size);
5035 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5036 ok(info->CertIssuer.cbData == sizeof(encodedCommonName),
5037 "Unexpected issuer len\n");
5038 ok(!memcmp(info->CertIssuer.pbData, encodedCommonName,
5039 sizeof(encodedCommonName)), "Unexpected issuer\n");
5040 ok(info->CertSerialNumber.cbData == 0, "Expected no serial number\n");
5041 LocalFree(buf);
5042 }
5043 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID,
5046 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5047 if (ret)
5048 {
5050
5051 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID_INFO), "Unexpected size %d\n",
5052 size);
5053 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5054 ok(info->CertIssuer.cbData == 0, "Expected no issuer name\n");
5055 ok(info->CertSerialNumber.cbData == sizeof(serialNum),
5056 "Unexpected serial number len\n");
5057 ok(!memcmp(info->CertSerialNumber.pbData, serialNum, sizeof(serialNum)),
5058 "Unexpected serial number\n");
5059 LocalFree(buf);
5060 }
5061}
static const BYTE serialNum[]
Definition: encode.c:3049
static const BYTE authorityKeyIdWithIssuer[]
Definition: encode.c:4923
static const BYTE authorityKeyIdWithId[]
Definition: encode.c:4921
static const BYTE authorityKeyIdWithSerial[]
Definition: encode.c:4926
static BYTE keyId[]
Definition: encode.c:4920
#define X509_AUTHORITY_KEY_ID
Definition: wincrypt.h:3374

Referenced by START_TEST().

◆ test_decodeAuthorityKeyId2()

static void test_decodeAuthorityKeyId2 ( DWORD  dwEncoding)
static

Definition at line 5136 of file encode.c.

5137{
5138 BOOL ret;
5139 LPBYTE buf = NULL;
5140 DWORD size = 0;
5141
5142 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5144 &buf, &size);
5145 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5146 if (ret)
5147 {
5149
5150 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5151 size);
5152 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5153 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5154 "Expected no issuer name entries\n");
5155 ok(info->AuthorityCertSerialNumber.cbData == 0,
5156 "Expected no serial number\n");
5157 LocalFree(buf);
5158 }
5159 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5162 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5163 if (ret)
5164 {
5166
5167 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5168 size);
5169 ok(info->KeyId.cbData == sizeof(keyId), "Unexpected key id len\n");
5170 ok(!memcmp(info->KeyId.pbData, keyId, sizeof(keyId)),
5171 "Unexpected key id\n");
5172 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5173 "Expected no issuer name entries\n");
5174 ok(info->AuthorityCertSerialNumber.cbData == 0,
5175 "Expected no serial number\n");
5176 LocalFree(buf);
5177 }
5178 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5181 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5182 if (ret)
5183 {
5185
5186 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5187 size);
5188 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5189 ok(info->AuthorityCertIssuer.cAltEntry == 1,
5190 "Expected 1 issuer entry, got %d\n",
5191 info->AuthorityCertIssuer.cAltEntry);
5192 ok(info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice ==
5193 CERT_ALT_NAME_URL, "Expected CERT_ALT_NAME_URL, got %d\n",
5194 info->AuthorityCertIssuer.rgAltEntry[0].dwAltNameChoice);
5195 ok(!lstrcmpW(U(info->AuthorityCertIssuer.rgAltEntry[0]).pwszURL,
5196 url), "Unexpected URL\n");
5197 ok(info->AuthorityCertSerialNumber.cbData == 0,
5198 "Expected no serial number\n");
5199 LocalFree(buf);
5200 }
5201 ret = pCryptDecodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2,
5204 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5205 if (ret)
5206 {
5208
5209 ok(size >= sizeof(CERT_AUTHORITY_KEY_ID2_INFO), "Unexpected size %d\n",
5210 size);
5211 ok(info->KeyId.cbData == 0, "Expected no key id\n");
5212 ok(info->AuthorityCertIssuer.cAltEntry == 0,
5213 "Expected no issuer name entries\n");
5214 ok(info->AuthorityCertSerialNumber.cbData == sizeof(serialNum),
5215 "Unexpected serial number len\n");
5216 ok(!memcmp(info->AuthorityCertSerialNumber.pbData, serialNum,
5217 sizeof(serialNum)), "Unexpected serial number\n");
5218 LocalFree(buf);
5219 }
5220}
static const BYTE authorityKeyIdWithIssuerUrl[]
Definition: encode.c:5063
#define X509_AUTHORITY_KEY_ID2
Definition: wincrypt.h:3398

Referenced by START_TEST().

◆ test_decodeBasicConstraints()

static void test_decodeBasicConstraints ( DWORD  dwEncoding)
static

Definition at line 2304 of file encode.c.

2305{
2306 static const BYTE inverted[] = { 0x30, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01,
2307 0xff };
2308 static const struct Constraints2 badBool = { { TRUE, TRUE, 1 }, bin63 };
2309 DWORD i;
2310 BOOL ret;
2311 BYTE *buf = NULL;
2312 DWORD bufSize = 0;
2313
2314 /* First test with simpler info2 */
2315 for (i = 0; i < ARRAY_SIZE(constraints2); i++)
2316 {
2317 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2320 ok(ret, "CryptDecodeObjectEx failed for item %d: %08x\n", i,
2321 GetLastError());
2322 if (ret)
2323 {
2326
2327 ok(!memcmp(info, &constraints2[i].info, sizeof(*info)),
2328 "Unexpected value for item %d\n", i);
2329 LocalFree(buf);
2330 }
2331 }
2332 /* Check with the order of encoded elements inverted */
2333 buf = (PBYTE)1;
2334 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2335 inverted, inverted[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
2336 &bufSize);
2338 GetLastError() == OSS_DATA_ERROR /* Win9x */),
2339 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2340 GetLastError());
2341 ok(!buf, "Expected buf to be set to NULL\n");
2342 /* Check with a non-DER bool */
2343 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2344 badBool.encoded, badBool.encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
2345 &buf, &bufSize);
2346 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2347 if (ret)
2348 {
2351
2352 ok(!memcmp(info, &badBool.info, sizeof(*info)), "Unexpected value\n");
2353 LocalFree(buf);
2354 }
2355 /* Check with a non-basic constraints value */
2356 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2360 GetLastError() == OSS_DATA_ERROR /* Win9x */),
2361 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2362 GetLastError());
2363 /* Now check with the more complex CERT_BASIC_CONSTRAINTS_INFO */
2364 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS,
2366 &buf, &bufSize);
2367 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2368 if (ret)
2369 {
2371
2372 ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2373 ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2374 ok(info->cSubtreesConstraint == 0, "Expected no subtree constraints\n");
2375 LocalFree(buf);
2376 }
2377 ret = pCryptDecodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS,
2380 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2381 if (ret)
2382 {
2384
2385 ok(info->SubjectType.cbData == 0, "Expected no subject type\n");
2386 ok(!info->fPathLenConstraint, "Expected no path length constraint\n");
2387 ok(info->cSubtreesConstraint == 1, "Expected a subtree constraint\n");
2388 if (info->cSubtreesConstraint && info->rgSubtreesConstraint)
2389 {
2390 ok(info->rgSubtreesConstraint[0].cbData ==
2391 sizeof(encodedDomainName), "Wrong size %d\n",
2392 info->rgSubtreesConstraint[0].cbData);
2393 ok(!memcmp(info->rgSubtreesConstraint[0].pbData, encodedDomainName,
2394 sizeof(encodedDomainName)), "Unexpected value\n");
2395 }
2396 LocalFree(buf);
2397 }
2398}
#define TRUE
Definition: types.h:120
static const unsigned char bin63[]
Definition: encode.c:2302
static const BYTE emptyConstraint[]
Definition: encode.c:2231
static const BYTE constraintWithDomainName[]
Definition: encode.c:2236
static const struct Constraints2 constraints2[]
Definition: encode.c:2218
static const BYTE encodedDomainName[]
Definition: encode.c:2232
BYTE * PBYTE
Definition: pedump.c:66
CERT_BASIC_CONSTRAINTS2_INFO info
Definition: encode.c:2210
const BYTE * encoded
Definition: encode.c:2211
#define X509_BASIC_CONSTRAINTS2
Definition: wincrypt.h:3380
#define X509_BASIC_CONSTRAINTS
Definition: wincrypt.h:3378

Referenced by START_TEST().

◆ test_decodeBits()

static void test_decodeBits ( DWORD  dwEncoding)
static

Definition at line 2155 of file encode.c.

2156{
2157 static const BYTE ber[] = "\x03\x02\x01\xff";
2158 static const BYTE berDecoded = 0xfe;
2159 DWORD i;
2160 BOOL ret;
2161 BYTE *buf = NULL;
2162 DWORD bufSize = 0;
2163
2164 /* normal cases */
2165 for (i = 0; i < ARRAY_SIZE(bits); i++)
2166 {
2167 ret = pCryptDecodeObjectEx(dwEncoding, X509_BITS, bits[i].encoded,
2168 bits[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
2169 &bufSize);
2170 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2171 if (ret)
2172 {
2174
2175 ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + bits[i].cbDecoded,
2176 "Got unexpected size %d\n", bufSize);
2177 blob = (CRYPT_BIT_BLOB *)buf;
2178 ok(blob->cbData == bits[i].cbDecoded,
2179 "Got unexpected length %d, expected %d\n", blob->cbData,
2180 bits[i].cbDecoded);
2181 if (blob->cbData && bits[i].cbDecoded)
2182 ok(!memcmp(blob->pbData, bits[i].decoded, bits[i].cbDecoded),
2183 "Unexpected value\n");
2184 LocalFree(buf);
2185 }
2186 }
2187 /* special case: check that something that's valid in BER but not in DER
2188 * decodes successfully
2189 */
2190 ret = pCryptDecodeObjectEx(dwEncoding, X509_BITS, ber, ber[1] + 2,
2192 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2193 if (ret)
2194 {
2196
2197 ok(bufSize >= sizeof(CRYPT_BIT_BLOB) + sizeof(berDecoded),
2198 "Got unexpected size %d\n", bufSize);
2199 blob = (CRYPT_BIT_BLOB *)buf;
2200 ok(blob->cbData == sizeof(berDecoded),
2201 "Got unexpected length %d\n", blob->cbData);
2202 if (blob->cbData)
2203 ok(*blob->pbData == berDecoded, "Unexpected value\n");
2204 LocalFree(buf);
2205 }
2206}
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:3392

Referenced by START_TEST().

◆ test_decodeCert()

static void test_decodeCert ( DWORD  dwEncoding)
static

Definition at line 3463 of file encode.c.

3464{
3465 BOOL ret;
3466 BYTE *buf = NULL;
3467 DWORD size = 0;
3468
3469 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT, signedBigCert,
3471 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3472 if (ret)
3473 {
3475
3476 ok(info->ToBeSigned.cbData == sizeof(bigCert),
3477 "Wrong cert size %d\n", info->ToBeSigned.cbData);
3478 ok(!memcmp(info->ToBeSigned.pbData, bigCert, info->ToBeSigned.cbData),
3479 "Unexpected cert\n");
3480 ok(info->Signature.cbData == sizeof(hash),
3481 "Wrong signature size %d\n", info->Signature.cbData);
3482 ok(!memcmp(info->Signature.pbData, hash, info->Signature.cbData),
3483 "Unexpected signature\n");
3484 LocalFree(buf);
3485 }
3486 /* A signed cert decodes as a CERT_INFO too */
3487 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, signedBigCert,
3489 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3490 if (ret)
3491 {
3493
3494 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3495 ok(info->SerialNumber.cbData == 1,
3496 "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3497 ok(*info->SerialNumber.pbData == *serialNum,
3498 "Expected serial number %d, got %d\n", *serialNum,
3499 *info->SerialNumber.pbData);
3500 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3501 "Wrong size %d\n", info->Issuer.cbData);
3502 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3503 "Unexpected issuer\n");
3504 ok(info->Subject.cbData == sizeof(encodedCommonName),
3505 "Wrong size %d\n", info->Subject.cbData);
3506 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3507 info->Subject.cbData), "Unexpected subject\n");
3508 LocalFree(buf);
3509 }
3510 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, signedBigCertWithIndefiniteSeq,
3512 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3513 if (ret)
3514 {
3516
3517 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3518 ok(info->SerialNumber.cbData == 1,
3519 "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3520 ok(*info->SerialNumber.pbData == *serialNum,
3521 "Expected serial number %d, got %d\n", *serialNum,
3522 *info->SerialNumber.pbData);
3523 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3524 "Wrong size %d\n", info->Issuer.cbData);
3525 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3526 "Unexpected issuer\n");
3527 ok(info->Subject.cbData == sizeof(encodedCommonName),
3528 "Wrong size %d\n", info->Subject.cbData);
3529 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3530 info->Subject.cbData), "Unexpected subject\n");
3531 LocalFree(buf);
3532 }
3533}
static const BYTE bigCert[]
Definition: encode.c:2976
static const BYTE signedBigCert[]
Definition: encode.c:3368
static const BYTE signedBigCertWithIndefiniteSeq[]
Definition: encode.c:3403
Definition: _hash_fun.h:40
#define X509_CERT_TO_BE_SIGNED
Definition: wincrypt.h:3366
#define X509_CERT
Definition: wincrypt.h:3365

Referenced by START_TEST().

◆ test_decodeCertPolicies()

static void test_decodeCertPolicies ( DWORD  dwEncoding)
static

Definition at line 7650 of file encode.c.

7651{
7652 BOOL ret;
7654 DWORD size;
7655
7656 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7658 &info, &size);
7659 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7660 if (ret)
7661 {
7662 ok(info->cPolicyInfo == 0, "unexpected policy info %d\n",
7663 info->cPolicyInfo);
7664 LocalFree(info);
7665 }
7666 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7669 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7670 if (ret)
7671 {
7672 ok(info->cPolicyInfo == 1, "unexpected policy info %d\n",
7673 info->cPolicyInfo);
7674 ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7675 "unexpected policy id %s\n",
7676 info->rgPolicyInfo[0].pszPolicyIdentifier);
7677 ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7678 "unexpected policy qualifier count %d\n",
7679 info->rgPolicyInfo[0].cPolicyQualifier);
7680 LocalFree(info);
7681 }
7682 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7683 twoPolicies, sizeof(twoPolicies),
7685 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7686 if (ret)
7687 {
7688 ok(info->cPolicyInfo == 2, "unexpected policy info %d\n",
7689 info->cPolicyInfo);
7690 ok(!strcmp(info->rgPolicyInfo[0].pszPolicyIdentifier, oid_any_policy),
7691 "unexpected policy id %s\n",
7692 info->rgPolicyInfo[0].pszPolicyIdentifier);
7693 ok(info->rgPolicyInfo[0].cPolicyQualifier == 0,
7694 "unexpected policy qualifier count %d\n",
7695 info->rgPolicyInfo[0].cPolicyQualifier);
7696 ok(!strcmp(info->rgPolicyInfo[1].pszPolicyIdentifier, oid1),
7697 "unexpected policy id %s\n",
7698 info->rgPolicyInfo[1].pszPolicyIdentifier);
7699 ok(info->rgPolicyInfo[1].cPolicyQualifier == 1,
7700 "unexpected policy qualifier count %d\n",
7701 info->rgPolicyInfo[1].cPolicyQualifier);
7702 ok(!strcmp(
7703 info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId,
7704 oid_user_notice), "unexpected policy qualifier id %s\n",
7705 info->rgPolicyInfo[1].rgPolicyQualifier[0].pszPolicyQualifierId);
7706 ok(info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData ==
7707 sizeof(noticeWithReference), "unexpected qualifier size %d\n",
7708 info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.cbData);
7709 ok(!memcmp(
7710 info->rgPolicyInfo[1].rgPolicyQualifier[0].Qualifier.pbData,
7712 "unexpected qualifier value\n");
7713 LocalFree(info);
7714 }
7715 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7716 twoPolicies, sizeof(twoPolicies), 0, NULL, NULL, &size);
7717 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7719 if (info)
7720 {
7721 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_POLICIES,
7722 twoPolicies, sizeof(twoPolicies), 0, NULL, info, &size);
7723 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7725 }
7726}
static char oid_any_policy[]
Definition: encode.c:7579
static const BYTE twoPolicies[]
Definition: encode.c:7585
static char oid_user_notice[]
Definition: encode.c:7584
static const BYTE policiesWithAnyPolicy[]
Definition: encode.c:7580
static BYTE noticeWithReference[]
Definition: encode.c:7458
#define X509_CERT_POLICIES
Definition: wincrypt.h:3381

Referenced by START_TEST().

◆ test_decodeCertPolicyConstraints()

static void test_decodeCertPolicyConstraints ( DWORD  dwEncoding)
static

Definition at line 7965 of file encode.c.

7966{
7968 DWORD size;
7969 BOOL ret;
7970
7971 /* Again, even though CAs must not issue such constraints, they can be
7972 * decoded.
7973 */
7974 ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
7976 &info, &size);
7978 "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7980 {
7981 win_skip("no policy mappings support\n");
7982 return;
7983 }
7984 if (ret)
7985 {
7986 ok(!info->fRequireExplicitPolicy,
7987 "expected require explicit = FALSE\n");
7988 ok(!info->fInhibitPolicyMapping,
7989 "expected implicit mapping = FALSE\n");
7990 LocalFree(info);
7991 }
7992 ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
7995 NULL, &info, &size);
7996 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7997 if (ret)
7998 {
7999 ok(info->fRequireExplicitPolicy,
8000 "expected require explicit = TRUE\n");
8001 ok(info->dwRequireExplicitPolicySkipCerts == 0, "expected 0, got %d\n",
8002 info->dwRequireExplicitPolicySkipCerts);
8003 ok(!info->fInhibitPolicyMapping,
8004 "expected implicit mapping = FALSE\n");
8005 LocalFree(info);
8006 }
8007 ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
8010 NULL, &info, &size);
8011 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
8012 if (ret)
8013 {
8014 ok(!info->fRequireExplicitPolicy,
8015 "expected require explicit = FALSE\n");
8016 ok(info->fInhibitPolicyMapping,
8017 "expected implicit mapping = TRUE\n");
8018 ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %d\n",
8019 info->dwInhibitPolicyMappingSkipCerts);
8020 LocalFree(info);
8021 }
8022 ret = pCryptDecodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS,
8025 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
8026 if (ret)
8027 {
8028 ok(info->fRequireExplicitPolicy,
8029 "expected require explicit = TRUE\n");
8030 ok(info->dwRequireExplicitPolicySkipCerts == 1, "expected 1, got %d\n",
8031 info->dwRequireExplicitPolicySkipCerts);
8032 ok(info->fInhibitPolicyMapping,
8033 "expected implicit mapping = TRUE\n");
8034 ok(info->dwInhibitPolicyMappingSkipCerts == 1, "expected 1, got %d\n",
8035 info->dwInhibitPolicyMappingSkipCerts);
8036 LocalFree(info);
8037 }
8038}
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static const BYTE policyConstraintsWithRequireExplicit[]
Definition: encode.c:7885
static const BYTE policyConstraintsWithInhibitMapping[]
Definition: encode.c:7887
static const BYTE policyConstraintsWithBoth[]
Definition: encode.c:7889
#define X509_POLICY_CONSTRAINTS
Definition: wincrypt.h:3427

Referenced by START_TEST().

◆ test_decodeCertPolicyMappings()

static void test_decodeCertPolicyMappings ( DWORD  dwEncoding)
static

Definition at line 7806 of file encode.c.

7807{
7808 DWORD size, i;
7810 BOOL ret;
7811
7812 /* Each of the mapping OIDs is equivalent, so check with all of them */
7813 for (i = 0; i < ARRAY_SIZE(mappingOids); i++)
7814 {
7815 ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7817 &info, &size);
7819 "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7821 {
7822 win_skip("no policy mappings support\n");
7823 return;
7824 }
7825 if (ret)
7826 {
7827 ok(info->cPolicyMapping == 0,
7828 "expected 0 policy mappings, got %d\n", info->cPolicyMapping);
7829 LocalFree(info);
7830 }
7831 ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7834 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7835 if (ret)
7836 {
7837 ok(info->cPolicyMapping == 1,
7838 "expected 1 policy mappings, got %d\n", info->cPolicyMapping);
7839 ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7840 "unexpected issuer policy %s\n",
7841 info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7842 ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7843 "2.3.4"), "unexpected subject policy %s\n",
7844 info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7845 LocalFree(info);
7846 }
7847 ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7850 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7851 if (ret)
7852 {
7853 ok(info->cPolicyMapping == 2,
7854 "expected 2 policy mappings, got %d\n", info->cPolicyMapping);
7855 ok(!strcmp(info->rgPolicyMapping[0].pszIssuerDomainPolicy, "1.2.3"),
7856 "unexpected issuer policy %s\n",
7857 info->rgPolicyMapping[0].pszIssuerDomainPolicy);
7858 ok(!strcmp(info->rgPolicyMapping[0].pszSubjectDomainPolicy,
7859 "2.3.4"), "unexpected subject policy %s\n",
7860 info->rgPolicyMapping[0].pszSubjectDomainPolicy);
7861 ok(!strcmp(info->rgPolicyMapping[1].pszIssuerDomainPolicy, "1.3.4"),
7862 "unexpected issuer policy %s\n",
7863 info->rgPolicyMapping[1].pszIssuerDomainPolicy);
7864 ok(!strcmp(info->rgPolicyMapping[1].pszSubjectDomainPolicy,
7865 "2.5.6"), "unexpected subject policy %s\n",
7866 info->rgPolicyMapping[1].pszSubjectDomainPolicy);
7867 LocalFree(info);
7868 }
7869 ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7871 NULL, NULL, &size);
7872 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7874 if (info)
7875 {
7876 ret = pCryptDecodeObjectEx(dwEncoding, mappingOids[i],
7878 NULL, info, &size);
7879 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7881 }
7882 }
7883}
static const BYTE policyMappingWithTwoMappings[]
Definition: encode.c:7730
static const BYTE policyMappingWithOneMapping[]
Definition: encode.c:7728
static const LPCSTR mappingOids[]
Definition: encode.c:7733

Referenced by START_TEST().

◆ test_decodeCertToBeSigned()

static void test_decodeCertToBeSigned ( DWORD  dwEncoding)
static

Definition at line 3235 of file encode.c.

3236{
3237 static const BYTE *corruptCerts[] = { v1Cert, v2Cert, v3Cert, v4Cert,
3239 BOOL ret;
3240 BYTE *buf = NULL;
3241 DWORD size = 0, i;
3242
3243 /* Test with NULL pbEncoded */
3244 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, NULL, 0,
3246 ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
3247 GetLastError() == OSS_BAD_ARG /* Win9x */),
3248 "Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n", GetLastError());
3249 if (0)
3250 {
3251 /* Crashes on win9x */
3252 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, NULL, 1,
3255 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
3256 }
3257 /* The following certs all fail with CRYPT_E_ASN1_CORRUPT or
3258 * CRYPT_E_ASN1_BADTAG, because at a minimum a cert must have a non-zero
3259 * serial number, an issuer, a subject, and a public key.
3260 */
3261 for (i = 0; i < ARRAY_SIZE(corruptCerts); i++)
3262 {
3263 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3264 corruptCerts[i], corruptCerts[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
3265 &buf, &size);
3266 ok(!ret, "Expected failure\n");
3267 }
3268 /* The following succeeds, even though v1 certs are not allowed to have
3269 * extensions.
3270 */
3271 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3274 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3275 if (ret)
3276 {
3278
3279 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3280 ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %d\n",
3281 info->dwVersion);
3282 ok(info->cExtension == 1, "expected 1 extension, got %d\n",
3283 info->cExtension);
3284 LocalFree(buf);
3285 }
3286 /* The following also succeeds, even though V1 certs are not allowed to
3287 * have issuer unique ids.
3288 */
3289 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3293 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3294 if (ret)
3295 {
3297
3298 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3299 ok(info->dwVersion == CERT_V1, "expected CERT_V1, got %d\n",
3300 info->dwVersion);
3301 ok(info->IssuerUniqueId.cbData == sizeof(serialNum),
3302 "unexpected issuer unique id size %d\n", info->IssuerUniqueId.cbData);
3303 ok(!memcmp(info->IssuerUniqueId.pbData, serialNum, sizeof(serialNum)),
3304 "unexpected issuer unique id value\n");
3305 LocalFree(buf);
3306 }
3307 /* Now check with serial number, subject and issuer specified */
3308 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, bigCert,
3310 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3311 if (ret)
3312 {
3314
3315 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3316 ok(info->SerialNumber.cbData == 1,
3317 "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3318 ok(*info->SerialNumber.pbData == *serialNum,
3319 "Expected serial number %d, got %d\n", *serialNum,
3320 *info->SerialNumber.pbData);
3321 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3322 "Wrong size %d\n", info->Issuer.cbData);
3323 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3324 "Unexpected issuer\n");
3325 ok(info->Subject.cbData == sizeof(encodedCommonName),
3326 "Wrong size %d\n", info->Subject.cbData);
3327 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3328 info->Subject.cbData), "Unexpected subject\n");
3329 LocalFree(buf);
3330 }
3331 /* Check again with pub key specified */
3332 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED,
3334 &buf, &size);
3335 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3336 if (ret)
3337 {
3339
3340 ok(size >= sizeof(CERT_INFO), "Wrong size %d\n", size);
3341 ok(info->SerialNumber.cbData == 1,
3342 "Expected serial number size 1, got %d\n", info->SerialNumber.cbData);
3343 ok(*info->SerialNumber.pbData == *serialNum,
3344 "Expected serial number %d, got %d\n", *serialNum,
3345 *info->SerialNumber.pbData);
3346 ok(info->Issuer.cbData == sizeof(encodedCommonName),
3347 "Wrong size %d\n", info->Issuer.cbData);
3348 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
3349 "Unexpected issuer\n");
3350 ok(info->Subject.cbData == sizeof(encodedCommonName),
3351 "Wrong size %d\n", info->Subject.cbData);
3352 ok(!memcmp(info->Subject.pbData, encodedCommonName,
3353 info->Subject.cbData), "Unexpected subject\n");
3354 ok(!strcmp(info->SubjectPublicKeyInfo.Algorithm.pszObjId,
3355 szOID_RSA_RSA), "Expected szOID_RSA_RSA, got %s\n",
3356 info->SubjectPublicKeyInfo.Algorithm.pszObjId);
3357 ok(info->SubjectPublicKeyInfo.PublicKey.cbData == sizeof(aKey),
3358 "Wrong size %d\n", info->SubjectPublicKeyInfo.PublicKey.cbData);
3359 ok(!memcmp(info->SubjectPublicKeyInfo.PublicKey.pbData, aKey,
3360 sizeof(aKey)), "Unexpected public key\n");
3361 LocalFree(buf);
3362 }
3363}
static const BYTE v3Cert[]
Definition: encode.c:2952
static const BYTE v1Cert[]
Definition: encode.c:2942
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueId[]
Definition: encode.c:3024
static const BYTE v1CertWithPubKey[]
Definition: encode.c:2986
static const BYTE v2Cert[]
Definition: encode.c:2947
static const BYTE v1CertWithConstraints[]
Definition: encode.c:2962
static const BYTE v1CertWithSerial[]
Definition: encode.c:2969
static const BYTE aKey[]
Definition: encode.c:2797
static const BYTE v1CertWithSubjectKeyId[]
Definition: encode.c:3009
static const BYTE v1CertWithIssuerUniqueId[]
Definition: encode.c:3019
static const BYTE v4Cert[]
Definition: encode.c:2957
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define CERT_V1
Definition: wincrypt.h:2656
#define szOID_RSA_RSA
Definition: wincrypt.h:3015
#define OSS_BAD_ARG
Definition: winerror.h:3043
#define CRYPT_E_ASN1_EOD
Definition: winerror.h:3086

Referenced by START_TEST().

◆ test_decodeCMSSignerInfo()

static void test_decodeCMSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 7061 of file encode.c.

7062{
7063 BOOL ret;
7064 LPBYTE buf = NULL;
7065 DWORD size = 0;
7067 static const char oid1[] = "1.2.3", oid2[] = "1.5.6";
7068
7069 /* A CMS signer can't be decoded without a serial number. */
7070 SetLastError(0xdeadbeef);
7071 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7074 ok(!ret, "expected failure\n");
7076 {
7077 skip("no CMS_SIGNER_INFO decode support\n");
7078 return;
7079 }
7081 "Expected CRYPT_E_ASN1_CORRUPT, got %x\n", GetLastError());
7082 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7085 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
7086 if (ret)
7087 {
7089 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
7090 info->dwVersion);
7091 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7092 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %d\n",
7093 info->SignerId.dwIdChoice);
7094 ok(U(info->SignerId).IssuerSerialNumber.Issuer.cbData ==
7095 sizeof(encodedCommonNameNoNull), "Unexpected size %d\n",
7096 U(info->SignerId).IssuerSerialNumber.Issuer.cbData);
7097 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.Issuer.pbData,
7099 U(info->SignerId).IssuerSerialNumber.Issuer.cbData),
7100 "Unexpected value\n");
7101 ok(U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
7102 sizeof(serialNum), "Unexpected size %d\n",
7103 U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData);
7104 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.SerialNumber.pbData,
7105 serialNum, sizeof(serialNum)), "Unexpected value\n");
7106 LocalFree(buf);
7107 }
7108 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7111 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
7112 if (ret)
7113 {
7115 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
7116 info->dwVersion);
7117 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7118 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %d\n",
7119 info->SignerId.dwIdChoice);
7120 ok(U(info->SignerId).IssuerSerialNumber.Issuer.cbData ==
7121 sizeof(encodedCommonNameNoNull), "Unexpected size %d\n",
7122 U(info->SignerId).IssuerSerialNumber.Issuer.cbData);
7123 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.Issuer.pbData,
7125 U(info->SignerId).IssuerSerialNumber.Issuer.cbData),
7126 "Unexpected value\n");
7127 ok(U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
7128 sizeof(serialNum), "Unexpected size %d\n",
7129 U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData);
7130 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.SerialNumber.pbData,
7131 serialNum, sizeof(serialNum)), "Unexpected value\n");
7132 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7133 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7134 LocalFree(buf);
7135 }
7136 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7139 NULL, &buf, &size);
7140 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
7141 if (ret)
7142 {
7144 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
7145 info->dwVersion);
7146 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7147 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %d\n",
7148 info->SignerId.dwIdChoice);
7149 ok(U(info->SignerId).IssuerSerialNumber.Issuer.cbData ==
7150 sizeof(encodedCommonNameNoNull), "Unexpected size %d\n",
7151 U(info->SignerId).IssuerSerialNumber.Issuer.cbData);
7152 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.Issuer.pbData,
7154 U(info->SignerId).IssuerSerialNumber.Issuer.cbData),
7155 "Unexpected value\n");
7156 ok(U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
7157 sizeof(serialNum), "Unexpected size %d\n",
7158 U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData);
7159 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.SerialNumber.pbData,
7160 serialNum, sizeof(serialNum)), "Unexpected value\n");
7161 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7162 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7163 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, oid2),
7164 "Expected %s, got %s\n", oid2, info->HashEncryptionAlgorithm.pszObjId);
7165 LocalFree(buf);
7166 }
7167 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7170 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
7171 if (ret)
7172 {
7174 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
7175 info->dwVersion);
7176 ok(info->SignerId.dwIdChoice == CERT_ID_ISSUER_SERIAL_NUMBER,
7177 "Expected CERT_ID_ISSUER_SERIAL_NUMBER, got %d\n",
7178 info->SignerId.dwIdChoice);
7179 ok(U(info->SignerId).IssuerSerialNumber.Issuer.cbData ==
7180 sizeof(encodedCommonNameNoNull), "Unexpected size %d\n",
7181 U(info->SignerId).IssuerSerialNumber.Issuer.cbData);
7182 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.Issuer.pbData,
7184 U(info->SignerId).IssuerSerialNumber.Issuer.cbData),
7185 "Unexpected value\n");
7186 ok(U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData ==
7187 sizeof(serialNum), "Unexpected size %d\n",
7188 U(info->SignerId).IssuerSerialNumber.SerialNumber.cbData);
7189 ok(!memcmp(U(info->SignerId).IssuerSerialNumber.SerialNumber.pbData,
7190 serialNum, sizeof(serialNum)), "Unexpected value\n");
7191 ok(!strcmp(info->HashAlgorithm.pszObjId, oid1),
7192 "Expected %s, got %s\n", oid1, info->HashAlgorithm.pszObjId);
7193 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, oid2),
7194 "Expected %s, got %s\n", oid2, info->HashEncryptionAlgorithm.pszObjId);
7195 ok(info->EncryptedHash.cbData == sizeof(hash), "Unexpected size %d\n",
7196 info->EncryptedHash.cbData);
7197 ok(!memcmp(info->EncryptedHash.pbData, hash, sizeof(hash)),
7198 "Unexpected value\n");
7199 LocalFree(buf);
7200 }
7201 ret = pCryptDecodeObjectEx(dwEncoding, CMS_SIGNER_INFO,
7204 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
7205 if (ret)
7206 {
7208 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
7209 info->dwVersion);
7210 ok(info->SignerId.dwIdChoice == CERT_ID_KEY_IDENTIFIER,
7211 "Expected CERT_ID_KEY_IDENTIFIER, got %d\n",
7212 info->SignerId.dwIdChoice);
7213 ok(U(info->SignerId).KeyId.cbData == sizeof(serialNum),
7214 "Unexpected size %d\n", U(info->SignerId).KeyId.cbData);
7215 ok(!memcmp(U(info->SignerId).KeyId.pbData, serialNum, sizeof(serialNum)),
7216 "Unexpected value\n");
7217 LocalFree(buf);
7218 }
7219}
#define skip(...)
Definition: atltest.h:64
#define SetLastError(x)
Definition: compat.h:752
static const BYTE CMSSignerWithKeyId[]
Definition: encode.c:6887
static const BYTE minimalPKCSSigner[]
Definition: encode.c:6560
static const BYTE PKCSSignerWithHashAndEncryptionAlgo[]
Definition: encode.c:6574
static const BYTE PKCSSignerWithHash[]
Definition: encode.c:6579
static BYTE encodedCommonNameNoNull[]
Definition: encode.c:6557
static const BYTE PKCSSignerWithHashAlgo[]
Definition: encode.c:6569
static const BYTE PKCSSignerWithSerial[]
Definition: encode.c:6564
#define CERT_ID_ISSUER_SERIAL_NUMBER
Definition: wincrypt.h:3673
#define CERT_ID_KEY_IDENTIFIER
Definition: wincrypt.h:3674
#define CMS_SIGNER_INFO
Definition: wincrypt.h:3437

Referenced by START_TEST().

◆ test_decodeCRLDistPoints()

static void test_decodeCRLDistPoints ( DWORD  dwEncoding)
static

Definition at line 3643 of file encode.c.

3644{
3645 BOOL ret;
3646 BYTE *buf = NULL;
3647 DWORD size = 0;
3651
3652 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3654 &buf, &size);
3655 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3656 if (ret)
3657 {
3659 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3660 "Wrong size %d\n", size);
3661 ok(info->cDistPoint == 1, "Expected 1 dist points, got %d\n",
3662 info->cDistPoint);
3663 point = info->rgDistPoint;
3664 ok(point->DistPointName.dwDistPointNameChoice == CRL_DIST_POINT_NO_NAME,
3665 "Expected CRL_DIST_POINT_NO_NAME, got %d\n",
3666 point->DistPointName.dwDistPointNameChoice);
3667 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3668 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3669 LocalFree(buf);
3670 }
3671 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3673 &buf, &size);
3674 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3675 if (ret)
3676 {
3678 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3679 "Wrong size %d\n", size);
3680 ok(info->cDistPoint == 1, "Expected 1 dist points, got %d\n",
3681 info->cDistPoint);
3682 point = info->rgDistPoint;
3683 ok(point->DistPointName.dwDistPointNameChoice ==
3685 "Expected CRL_DIST_POINT_FULL_NAME, got %d\n",
3686 point->DistPointName.dwDistPointNameChoice);
3687 ok(U(point->DistPointName).FullName.cAltEntry == 1,
3688 "Expected 1 name entry, got %d\n",
3689 U(point->DistPointName).FullName.cAltEntry);
3690 entry = U(point->DistPointName).FullName.rgAltEntry;
3691 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3692 "Expected CERT_ALT_NAME_URL, got %d\n", entry->dwAltNameChoice);
3693 ok(!lstrcmpW(U(*entry).pwszURL, url), "Unexpected name\n");
3694 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3695 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3696 LocalFree(buf);
3697 }
3698 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3700 NULL, &buf, &size);
3701 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3702 if (ret)
3703 {
3705 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3706 "Wrong size %d\n", size);
3707 ok(info->cDistPoint == 1, "Expected 1 dist points, got %d\n",
3708 info->cDistPoint);
3709 point = info->rgDistPoint;
3710 ok(point->DistPointName.dwDistPointNameChoice ==
3712 "Expected CRL_DIST_POINT_NO_NAME, got %d\n",
3713 point->DistPointName.dwDistPointNameChoice);
3714 ok(point->ReasonFlags.cbData == sizeof(crlReason),
3715 "Expected reason length\n");
3716 ok(!memcmp(point->ReasonFlags.pbData, &crlReason, sizeof(crlReason)),
3717 "Unexpected reason\n");
3718 ok(point->CRLIssuer.cAltEntry == 0, "Expected no issuer\n");
3719 LocalFree(buf);
3720 }
3721 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3724 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3725 if (ret)
3726 {
3728 ok(size >= sizeof(CRL_DIST_POINTS_INFO) + sizeof(CRL_DIST_POINT),
3729 "Wrong size %d\n", size);
3730 ok(info->cDistPoint == 1, "Expected 1 dist points, got %d\n",
3731 info->cDistPoint);
3732 point = info->rgDistPoint;
3733 ok(point->DistPointName.dwDistPointNameChoice ==
3735 "Expected CRL_DIST_POINT_FULL_NAME, got %d\n",
3736 point->DistPointName.dwDistPointNameChoice);
3737 ok(U(point->DistPointName).FullName.cAltEntry == 1,
3738 "Expected 1 name entry, got %d\n",
3739 U(point->DistPointName).FullName.cAltEntry);
3740 entry = U(point->DistPointName).FullName.rgAltEntry;
3741 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3742 "Expected CERT_ALT_NAME_URL, got %d\n", entry->dwAltNameChoice);
3743 ok(!lstrcmpW(U(*entry).pwszURL, url), "Unexpected name\n");
3744 ok(point->ReasonFlags.cbData == 0, "Expected no reason\n");
3745 ok(point->CRLIssuer.cAltEntry == 1,
3746 "Expected 1 issuer entry, got %d\n", point->CRLIssuer.cAltEntry);
3747 entry = point->CRLIssuer.rgAltEntry;
3748 ok(entry->dwAltNameChoice == CERT_ALT_NAME_URL,
3749 "Expected CERT_ALT_NAME_URL, got %d\n", entry->dwAltNameChoice);
3750 ok(!lstrcmpW(U(*entry).pwszURL, url), "Unexpected name\n");
3751 LocalFree(buf);
3752 }
3753 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3755 NULL, NULL, &size);
3756 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3758 if (buf)
3759 {
3760 ret = pCryptDecodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS,
3762 NULL, buf, &size);
3763 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3765 }
3766}
POINTL point
Definition: edittest.c:50
uint32_t entry
Definition: isohybrid.c:63
static const BYTE emptyDistPoint[]
Definition: encode.c:3535
static const BYTE distPointWithUrl[]
Definition: encode.c:3536
static const BYTE crlReason
Definition: encode.c:3549
static const BYTE distPointWithReason[]
Definition: encode.c:3539
static const BYTE distPointWithUrlAndIssuer[]
Definition: encode.c:3544
Definition: wincrypt.h:332
#define CRL_DIST_POINT_NO_NAME
Definition: wincrypt.h:513
struct _CRL_DIST_POINTS_INFO * PCRL_DIST_POINTS_INFO
#define X509_CRL_DIST_POINTS
Definition: wincrypt.h:3402

Referenced by START_TEST().

◆ test_decodeCRLIssuingDistPoint()

static void test_decodeCRLIssuingDistPoint ( DWORD  dwEncoding)
static

Definition at line 3914 of file encode.c.

3915{
3916 BOOL ret;
3917 BYTE *buf = NULL;
3918 DWORD size = 0;
3919 CRL_ISSUING_DIST_POINT point = { { 0 } };
3920
3921 ret = pCryptDecodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT,
3923 &buf, &size);
3925 {
3926 skip("no X509_ISSUING_DIST_POINT decode support\n");
3927 return;
3928 }
3929 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3930 if (ret)
3931 {
3933 LocalFree(buf);
3934 }
3935 ret = pCryptDecodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT,
3937 &buf, &size);
3938 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3939 if (ret)
3940 {
3941 point.fOnlyContainsUserCerts = point.fOnlyContainsCACerts = TRUE;
3943 LocalFree(buf);
3944 }
3945 ret = pCryptDecodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT,
3947 &buf, &size);
3948 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3949 if (ret)
3950 {
3951 point.fOnlyContainsCACerts = point.fOnlyContainsUserCerts = FALSE;
3952 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3953 U(point.DistPointName).FullName.cAltEntry = 0;
3955 LocalFree(buf);
3956 }
3957 ret = pCryptDecodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT,
3959 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
3960 if (ret)
3961 {
3963
3964 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3965 U(entry).pwszURL = (LPWSTR)url;
3966 U(point.DistPointName).FullName.cAltEntry = 1;
3967 U(point.DistPointName).FullName.rgAltEntry = &entry;
3969 LocalFree(buf);
3970 }
3971}
#define FALSE
Definition: types.h:117
static const BYTE badFlagsIDP[]
Definition: encode.c:3768
static void compareCRLIssuingDistPoints(const CRL_ISSUING_DIST_POINT *expected, const CRL_ISSUING_DIST_POINT *got)
Definition: encode.c:3900
static const BYTE emptyNameIDP[]
Definition: encode.c:3769
static const BYTE urlIDP[]
Definition: encode.c:3770
#define X509_ISSUING_DIST_POINT
Definition: wincrypt.h:3424

Referenced by START_TEST().

◆ test_decodeCRLToBeSigned()

static void test_decodeCRLToBeSigned ( DWORD  dwEncoding)
static

Definition at line 4682 of file encode.c.

4683{
4684 static const BYTE *corruptCRLs[] = { v1CRL, v2CRL };
4685 BOOL ret;
4686 BYTE *buf = NULL;
4687 DWORD size = 0, i;
4688
4689 for (i = 0; i < ARRAY_SIZE(corruptCRLs); i++)
4690 {
4691 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4692 corruptCRLs[i], corruptCRLs[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL,
4693 &buf, &size);
4695 GetLastError() == OSS_DATA_ERROR /* Win9x */),
4696 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
4697 GetLastError());
4698 }
4699 /* at a minimum, a CRL must contain an issuer: */
4700 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4702 &buf, &size);
4703 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4704 if (ret)
4705 {
4706 CRL_INFO *info = (CRL_INFO *)buf;
4707
4708 ok(size >= sizeof(CRL_INFO), "Wrong size %d\n", size);
4709 ok(info->cCRLEntry == 0, "Expected 0 CRL entries, got %d\n",
4710 info->cCRLEntry);
4711 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4712 "Wrong issuer size %d\n", info->Issuer.cbData);
4713 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4714 "Unexpected issuer\n");
4715 LocalFree(buf);
4716 }
4717 /* check decoding with an empty CRL entry */
4718 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4722 GetLastError() == OSS_DATA_ERROR /* Win9x */ ||
4723 GetLastError() == CRYPT_E_BAD_ENCODE /* Win8 */),
4724 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
4725 GetLastError());
4726 /* with a real CRL entry */
4727 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4730 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4731 if (ret)
4732 {
4733 CRL_INFO *info = (CRL_INFO *)buf;
4735
4736 ok(size >= sizeof(CRL_INFO), "Wrong size %d\n", size);
4737 ok(info->cCRLEntry == 1, "Expected 1 CRL entries, got %d\n",
4738 info->cCRLEntry);
4739 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4740 entry = info->rgCRLEntry;
4741 ok(entry->SerialNumber.cbData == 1,
4742 "Expected serial number size 1, got %d\n",
4743 entry->SerialNumber.cbData);
4744 ok(*entry->SerialNumber.pbData == *serialNum,
4745 "Expected serial number %d, got %d\n", *serialNum,
4746 *entry->SerialNumber.pbData);
4747 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4748 "Wrong issuer size %d\n", info->Issuer.cbData);
4749 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4750 "Unexpected issuer\n");
4751 LocalFree(buf);
4752 }
4753 /* a real CRL from verisign that has extensions */
4754 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4756 NULL, &buf, &size);
4757 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4758 if (ret)
4759 {
4760 CRL_INFO *info = (CRL_INFO *)buf;
4761
4762 ok(size >= sizeof(CRL_INFO), "Wrong size %d\n", size);
4763 ok(info->cCRLEntry == 3, "Expected 3 CRL entries, got %d\n",
4764 info->cCRLEntry);
4765 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4766 ok(info->cExtension == 2, "Expected 2 extensions, got %d\n",
4767 info->cExtension);
4768 LocalFree(buf);
4769 }
4770 /* another real CRL from verisign that has lots of entries */
4771 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4774 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4775 if (ret)
4776 {
4777 CRL_INFO *info = (CRL_INFO *)buf;
4778
4779 ok(size >= sizeof(CRL_INFO), "Got size %d\n", size);
4780 ok(info->cCRLEntry == 209, "Expected 209 CRL entries, got %d\n",
4781 info->cCRLEntry);
4782 ok(info->cExtension == 0, "Expected 0 extensions, got %d\n",
4783 info->cExtension);
4784 LocalFree(buf);
4785 }
4786 /* and finally, with an extension */
4787 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4789 NULL, &buf, &size);
4790 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4791 if (ret)
4792 {
4793 CRL_INFO *info = (CRL_INFO *)buf;
4795
4796 ok(size >= sizeof(CRL_INFO), "Wrong size %d\n", size);
4797 ok(info->cCRLEntry == 1, "Expected 1 CRL entries, got %d\n",
4798 info->cCRLEntry);
4799 ok(info->rgCRLEntry != NULL, "Expected a valid CRL entry array\n");
4800 entry = info->rgCRLEntry;
4801 ok(entry->SerialNumber.cbData == 1,
4802 "Expected serial number size 1, got %d\n",
4803 entry->SerialNumber.cbData);
4804 ok(*entry->SerialNumber.pbData == *serialNum,
4805 "Expected serial number %d, got %d\n", *serialNum,
4806 *entry->SerialNumber.pbData);
4807 ok(info->Issuer.cbData == sizeof(encodedCommonName),
4808 "Wrong issuer size %d\n", info->Issuer.cbData);
4809 ok(!memcmp(info->Issuer.pbData, encodedCommonName, info->Issuer.cbData),
4810 "Unexpected issuer\n");
4811 ok(info->cExtension == 1, "Expected 1 extensions, got %d\n",
4812 info->cExtension);
4813 LocalFree(buf);
4814 }
4815 ret = pCryptDecodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED,
4817 NULL, &buf, &size);
4818 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4819 if (ret)
4820 {
4821 CRL_INFO *info = (CRL_INFO *)buf;
4822
4823 ok(info->cExtension == 1, "Expected 1 extensions, got %d\n",
4824 info->cExtension);
4825 LocalFree(buf);
4826 }
4827}
static const BYTE v1CRL[]
Definition: encode.c:3973
static const BYTE v2CRLWithExt[]
Definition: encode.c:4010
static const BYTE v2CRL[]
Definition: encode.c:3976
static const BYTE verisignCRL[]
Definition: encode.c:4137
static const BYTE v1CRLWithExt[]
Definition: encode.c:4003
static const BYTE v1CRLWithIssuerAndEmptyEntry[]
Definition: encode.c:3984
static const BYTE verisignCRLWithLotsOfEntries[]
Definition: encode.c:4172
static const BYTE v1CRLWithIssuerAndEntry[]
Definition: encode.c:3990
static const BYTE v1CRLWithIssuer[]
Definition: encode.c:3979
Definition: wincrypt.h:487
#define X509_CERT_CRL_TO_BE_SIGNED
Definition: wincrypt.h:3367
#define CRYPT_E_BAD_ENCODE
Definition: winerror.h:3005

Referenced by START_TEST().

◆ test_decodeCTL()

static void test_decodeCTL ( DWORD  dwEncoding)
static

Definition at line 5782 of file encode.c.

5783{
5784 static char oid1[] = "1.2.3";
5785 static char oid2[] = "1.5.6";
5786 static BYTE nullData[] = { 5,0 };
5787 char *pOid1 = oid1;
5788 BOOL ret;
5789 BYTE *buf = NULL;
5790 DWORD size = 0;
5791 CTL_INFO info;
5792 SYSTEMTIME thisUpdate = { 2005, 6, 1, 6, 16, 10, 0, 0 };
5793 CTL_ENTRY ctlEntry[2];
5794 CRYPT_ATTRIBUTE attr1, attr2;
5795 CRYPT_ATTR_BLOB value1, value2;
5796
5797 memset(&info, 0, sizeof(info));
5798 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, emptyCTL, sizeof(emptyCTL),
5800 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5801 if (ret)
5802 {
5803 compareCTLInfo("empty CTL", &info, (CTL_INFO *)buf);
5804 LocalFree(buf);
5805 buf = NULL;
5806 }
5807 info.dwVersion = 1;
5808 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, emptyCTLWithVersion1,
5810 &size);
5811 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5812 if (ret)
5813 {
5814 compareCTLInfo("v1 CTL", &info, (CTL_INFO *)buf);
5815 LocalFree(buf);
5816 buf = NULL;
5817 }
5818 info.dwVersion = 0;
5819 info.SubjectUsage.cUsageIdentifier = 1;
5820 info.SubjectUsage.rgpszUsageIdentifier = &pOid1;
5821 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithUsageIdentifier,
5823 &buf, &size);
5824 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5825 if (ret)
5826 {
5827 compareCTLInfo("CTL with usage identifier", &info, (CTL_INFO *)buf);
5828 LocalFree(buf);
5829 buf = NULL;
5830 }
5831 info.SubjectUsage.cUsageIdentifier = 0;
5832 info.ListIdentifier.cbData = sizeof(serialNum);
5833 info.ListIdentifier.pbData = (LPBYTE)serialNum;
5834 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithListIdentifier,
5836 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5837 if (ret)
5838 {
5839 compareCTLInfo("CTL with list identifier", &info, (CTL_INFO *)buf);
5840 LocalFree(buf);
5841 buf = NULL;
5842 }
5843 info.ListIdentifier.cbData = 0;
5844 info.SequenceNumber.cbData = sizeof(serialNum);
5845 info.SequenceNumber.pbData = (LPBYTE)serialNum;
5846 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithSequenceNumber,
5848 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5849 if (ret)
5850 {
5851 compareCTLInfo("CTL with sequence number", &info, (CTL_INFO *)buf);
5852 LocalFree(buf);
5853 buf = NULL;
5854 }
5855 info.SequenceNumber.cbData = 0;
5856 SystemTimeToFileTime(&thisUpdate, &info.ThisUpdate);
5857 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithThisUpdate,
5859 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5860 if (ret)
5861 {
5862 compareCTLInfo("CTL with this update", &info, (CTL_INFO *)buf);
5863 LocalFree(buf);
5864 buf = NULL;
5865 }
5866 SystemTimeToFileTime(&thisUpdate, &info.NextUpdate);
5867 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithThisAndNextUpdate,
5869 &buf, &size);
5870 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5871 if (ret)
5872 {
5873 compareCTLInfo("CTL with this and next update", &info, (CTL_INFO *)buf);
5874 LocalFree(buf);
5875 buf = NULL;
5876 }
5877 info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0;
5878 info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0;
5879 info.SubjectAlgorithm.pszObjId = oid2;
5880 info.SubjectAlgorithm.Parameters.cbData = sizeof(nullData);
5881 info.SubjectAlgorithm.Parameters.pbData = nullData;
5882 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithAlgId,
5884 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5885 if (ret)
5886 {
5887 compareCTLInfo("CTL with algorithm identifier", &info, (CTL_INFO *)buf);
5888 LocalFree(buf);
5889 buf = NULL;
5890 }
5891 SetLastError(0xdeadbeef);
5892 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithBogusEntry,
5894 ok(!ret &&
5897 GetLastError() == OSS_MORE_INPUT), /* Win9x */
5898 "expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %08x\n",
5899 GetLastError());
5900 info.SubjectAlgorithm.Parameters.cbData = 0;
5901 info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0;
5902 info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0;
5903 info.SubjectAlgorithm.pszObjId = NULL;
5904 value1.cbData = sizeof(emptySequence);
5905 value1.pbData = (LPBYTE)emptySequence;
5906 attr1.pszObjId = oid1;
5907 attr1.cValue = 1;
5908 attr1.rgValue = &value1;
5909 ctlEntry[0].SubjectIdentifier.cbData = sizeof(serialNum);
5911 ctlEntry[0].cAttribute = 1;
5912 ctlEntry[0].rgAttribute = &attr1;
5913 info.cCTLEntry = 1;
5914 info.rgCTLEntry = ctlEntry;
5915 SetLastError(0xdeadbeef);
5916 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithOneEntry,
5918 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5919 if (ret)
5920 {
5921 compareCTLInfo("CTL with one entry", &info, (CTL_INFO *)buf);
5922 LocalFree(buf);
5923 buf = NULL;
5924 }
5925 value2.cbData = sizeof(encodedIPAddr);
5926 value2.pbData = (LPBYTE)encodedIPAddr;
5927 attr2.pszObjId = oid2;
5928 attr2.cValue = 1;
5929 attr2.rgValue = &value2;
5930 ctlEntry[1].SubjectIdentifier.cbData = sizeof(serialNum);
5932 ctlEntry[1].cAttribute = 1;
5933 ctlEntry[1].rgAttribute = &attr2;
5934 info.cCTLEntry = 2;
5935 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, ctlWithTwoEntries,
5937 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
5938 if (ret)
5939 {
5940 compareCTLInfo("CTL with two entries", &info, (CTL_INFO *)buf);
5941 LocalFree(buf);
5942 buf = NULL;
5943 }
5944 /* A signed CTL isn't decodable, even if the inner content is a CTL */
5945 SetLastError(0xdeadbeef);
5946 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL, signedCTL,
5949 GetLastError() == OSS_DATA_ERROR /* Win9x */),
5950 "expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x\n",
5951 GetLastError());
5952 SetLastError(0xdeadbeef);
5953 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CTL,
5957 GetLastError() == OSS_DATA_ERROR /* Win9x */),
5958 "expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x\n",
5959 GetLastError());
5960}
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
static const BYTE emptyCTL[]
Definition: encode.c:5407
static const BYTE ctlWithOneEntry[]
Definition: encode.c:5436
static const BYTE ctlWithUsageIdentifier[]
Definition: encode.c:5413
static const BYTE emptyCTLWithVersion1[]
Definition: encode.c:5410
static const BYTE ctlWithThisAndNextUpdate[]
Definition: encode.c:5425
static const BYTE ctlWithTwoEntries[]
Definition: encode.c:5440
static const BYTE signedCTL[]
Definition: encode.c:5746
static const BYTE signedCTLWithCTLInnerContent[]
Definition: encode.c:5761
static void compareCTLInfo(LPCSTR header, const CTL_INFO *expected, const CTL_INFO *got)
Definition: encode.c:5620
static const BYTE ctlWithListIdentifier[]
Definition: encode.c:5416
static const BYTE ctlWithThisUpdate[]
Definition: encode.c:5422
static const BYTE ctlWithSequenceNumber[]
Definition: encode.c:5419
static const BYTE ctlWithBogusEntry[]
Definition: encode.c:5432
static const BYTE ctlWithAlgId[]
Definition: encode.c:5429
#define memset(x, y, z)
Definition: compat.h:39
Definition: wincrypt.h:723
DWORD cAttribute
Definition: wincrypt.h:725
#define PKCS_CTL
Definition: wincrypt.h:3404
#define OSS_MORE_INPUT
Definition: winerror.h:3041

Referenced by START_TEST().

◆ test_decodeEnhancedKeyUsage()

static void test_decodeEnhancedKeyUsage ( DWORD  dwEncoding)
static

Definition at line 4868 of file encode.c.

4869{
4870 BOOL ret;
4871 LPBYTE buf = NULL;
4872 DWORD size = 0;
4873
4874 ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
4876 &buf, &size);
4877 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4878 if (ret)
4879 {
4881
4882 ok(size >= sizeof(CERT_ENHKEY_USAGE),
4883 "Wrong size %d\n", size);
4884 ok(usage->cUsageIdentifier == 0, "Expected 0 CRL entries, got %d\n",
4885 usage->cUsageIdentifier);
4886 LocalFree(buf);
4887 }
4888 ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
4890 &buf, &size);
4891 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4892 if (ret)
4893 {
4895 DWORD i;
4896
4897 ok(size >= sizeof(CERT_ENHKEY_USAGE),
4898 "Wrong size %d\n", size);
4899 ok(usage->cUsageIdentifier == ARRAY_SIZE(keyUsages),
4900 "Wrong CRL entries count %d\n", usage->cUsageIdentifier);
4901 for (i = 0; i < usage->cUsageIdentifier; i++)
4902 ok(!strcmp(usage->rgpszUsageIdentifier[i], keyUsages[i]),
4903 "Expected OID %s, got %s\n", keyUsages[i],
4904 usage->rgpszUsageIdentifier[i]);
4905 LocalFree(buf);
4906 }
4907 ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
4908 encodedUsage, sizeof(encodedUsage), 0, NULL, NULL, &size);
4909 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4911 if (buf)
4912 {
4913 ret = pCryptDecodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE,
4914 encodedUsage, sizeof(encodedUsage), 0, NULL, buf, &size);
4915 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
4917 }
4918}
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static const LPCSTR keyUsages[]
Definition: encode.c:4829
static const BYTE encodedUsage[]
Definition: encode.c:4831
#define X509_ENHANCED_KEY_USAGE
Definition: wincrypt.h:3403

Referenced by START_TEST().

◆ test_decodeEnumerated()

static void test_decodeEnumerated ( DWORD  dwEncoding)
static

Definition at line 409 of file encode.c.

410{
411 DWORD i, j;
412
413 for (i = 0; i < ARRAY_SIZE(enumeratedTypes); i++)
414 {
415 for (j = 0; j < ARRAY_SIZE(enums); j++)
416 {
417 BOOL ret;
418 DWORD bufSize = sizeof(int);
419 int val;
420
421 ret = pCryptDecodeObjectEx(dwEncoding, enumeratedTypes[i],
422 enums[j].encoded, enums[j].encoded[1] + 2, 0, NULL,
423 &val, &bufSize);
424 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
425 ok(bufSize == sizeof(int),
426 "Got unexpected size %d for enumerated\n", bufSize);
427 ok(val == enums[j].val, "Unexpected value %d, expected %d\n",
428 val, enums[j].val);
429 }
430 }
431}
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:365
static const LPCSTR enumeratedTypes[]
Definition: encode.c:373

Referenced by START_TEST().

◆ test_decodeExtensions()

static void test_decodeExtensions ( DWORD  dwEncoding)
static

Definition at line 2734 of file encode.c.

2735{
2736 DWORD i;
2737
2738 for (i = 0; i < ARRAY_SIZE(exts); i++)
2739 {
2740 BOOL ret;
2741 BYTE *buf = NULL;
2742 DWORD bufSize = 0;
2743
2744 ret = pCryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS,
2745 exts[i].encoded, exts[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2746 NULL, &buf, &bufSize);
2747 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2748 if (ret)
2749 {
2751 DWORD j;
2752
2753 ok(ext->cExtension == exts[i].exts.cExtension,
2754 "Expected %d extensions, see %d\n", exts[i].exts.cExtension,
2755 ext->cExtension);
2756 for (j = 0; j < min(ext->cExtension, exts[i].exts.cExtension); j++)
2757 {
2758 ok(!strcmp(ext->rgExtension[j].pszObjId,
2759 exts[i].exts.rgExtension[j].pszObjId),
2760 "Expected OID %s, got %s\n",
2761 exts[i].exts.rgExtension[j].pszObjId,
2762 ext->rgExtension[j].pszObjId);
2763 ok(!memcmp(ext->rgExtension[j].Value.pbData,
2764 exts[i].exts.rgExtension[j].Value.pbData,
2765 exts[i].exts.rgExtension[j].Value.cbData),
2766 "Unexpected value\n");
2767 }
2768 LocalFree(buf);
2769 }
2770 ret = pCryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS,
2771 exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, NULL, &bufSize);
2772 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2774 if (buf)
2775 {
2776 ret = pCryptDecodeObjectEx(dwEncoding, X509_EXTENSIONS,
2777 exts[i].encoded, exts[i].encoded[1] + 2, 0, NULL, buf, &bufSize);
2778 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2780 }
2781 }
2782}
static const WCHAR *const ext[]
Definition: module.c:53
static const struct encodedExtensions exts[]
Definition: encode.c:2703
#define X509_EXTENSIONS
Definition: wincrypt.h:3369

Referenced by START_TEST().

◆ test_decodeFiletime()

static void test_decodeFiletime ( DWORD  dwEncoding)
static

Definition at line 607 of file encode.c.

608{
609 static const struct encodedFiletime otherTimes[] = {
610 { { 1945, 6, 1, 6, 16, 10, 0, 0 }, bin23 },
611 { { 1945, 6, 1, 6, 16, 10, 0, 999 }, bin24 },
612 { { 1945, 6, 1, 6, 17, 10, 0, 0 }, bin25 },
613 { { 1945, 6, 1, 6, 15, 10, 0, 0 }, bin26 },
614 { { 1945, 6, 1, 6, 14, 55, 0, 0 }, bin27 },
615 { { 2145, 6, 1, 6, 16, 0, 0, 0 }, bin28 },
616 { { 2045, 6, 1, 6, 16, 10, 0, 0 }, bin29 },
617 { { 2045, 6, 1, 6, 16, 10, 0, 0 }, bin30 },
618 { { 2045, 6, 1, 6, 17, 10, 0, 0 }, bin31 },
619 { { 2045, 6, 1, 6, 15, 10, 0, 0 }, bin32 },
620 { { 2045, 6, 1, 6, 17, 10, 0, 0 }, bin33 },
621 { { 2045, 6, 1, 6, 15, 10, 0, 0 }, bin34 },
622 };
623 /* An oddball case that succeeds in Windows, but doesn't seem correct
624 { { 2145, 6, 1, 2, 11, 31, 0, 0 }, "\x18" "\x13" "21450606161000-9999" },
625 */
626 static const unsigned char *bogusTimes[] = {
627 /* oddly, this succeeds on Windows, with year 2765
628 "\x18" "\x0f" "21r50606161000Z",
629 */
630 bin35,
631 bin36,
632 bin37,
633 bin38,
634 };
635 DWORD i, size;
636 FILETIME ft1 = { 0 }, ft2 = { 0 };
637 BOOL ret;
638
639 /* Check bogus length with non-NULL buffer */
641 ok(ret, "SystemTimeToFileTime failed: %d\n", GetLastError());
642 size = 1;
643 ret = pCryptDecodeObjectEx(dwEncoding, X509_CHOICE_OF_TIME,
644 times[0].encodedTime, times[0].encodedTime[1] + 2, 0, NULL, &ft2, &size);
646 "Expected ERROR_MORE_DATA, got %d\n", GetLastError());
647 /* Normal tests */
648 for (i = 0; i < ARRAY_SIZE(times); i++)
649 {
651 testTimeDecoding(dwEncoding, PKCS_UTC_TIME, &times[i]);
653 }
654 for (i = 0; i < ARRAY_SIZE(otherTimes); i++)
655 {
656 testTimeDecoding(dwEncoding, X509_CHOICE_OF_TIME, &otherTimes[i]);
657 testTimeDecoding(dwEncoding, PKCS_UTC_TIME, &otherTimes[i]);
658 testTimeDecoding(dwEncoding, szOID_RSA_signingTime, &otherTimes[i]);
659 }
660 for (i = 0; i < ARRAY_SIZE(bogusTimes); i++)
661 {
662 size = sizeof(ft1);
663 ret = pCryptDecodeObjectEx(dwEncoding, X509_CHOICE_OF_TIME,
664 bogusTimes[i], bogusTimes[i][1] + 2, 0, NULL, &ft1, &size);
666 GetLastError() == OSS_DATA_ERROR /* Win9x */)) ||
667 broken(ret), /* Win9x and NT4 for bin38 */
668 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
669 GetLastError());
670 }
671}
#define ERROR_MORE_DATA
Definition: dderror.h:13
static const BYTE bin35[]
Definition: encode.c:598
static const BYTE bin33[]
Definition: encode.c:594
static const BYTE bin38[]
Definition: encode.c:604
static const BYTE bin27[]
Definition: encode.c:582
static const BYTE bin36[]
Definition: encode.c:600
static const BYTE bin32[]
Definition: encode.c:592
static const BYTE bin26[]
Definition: encode.c:580
static const BYTE bin30[]
Definition: encode.c:588
static const BYTE bin28[]
Definition: encode.c:584
static const BYTE bin31[]
Definition: encode.c:590
static const struct encodedFiletime times[]
Definition: encode.c:556
static void testTimeDecoding(DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
Definition: encode.c:521
static const BYTE bin23[]
Definition: encode.c:574
static const BYTE bin37[]
Definition: encode.c:602
static const BYTE bin24[]
Definition: encode.c:576
static const BYTE bin34[]
Definition: encode.c:596
static const BYTE bin25[]
Definition: encode.c:578
static const BYTE bin29[]
Definition: encode.c:586
SYSTEMTIME sysTime
Definition: encode.c:435
const BYTE * encodedTime
Definition: encode.c:436
#define PKCS_UTC_TIME
Definition: wincrypt.h:3382
#define X509_CHOICE_OF_TIME
Definition: wincrypt.h:3397
#define szOID_RSA_signingTime
Definition: wincrypt.h:3039

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 = pCryptDecodeObjectEx(3, X509_INTEGER, &ints[0].encoded,
219 ints[0].encoded[1] + 2, 0, NULL, NULL, NULL);
220 */
221 /* check bogus encoding */
222 ret = pCryptDecodeObjectEx(3, X509_INTEGER, (BYTE *)&ints[0].encoded,
223 ints[0].encoded[1] + 2, 0, NULL, NULL, &bufSize);
225 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
226 /* check with NULL integer buffer */
227 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER, NULL, 0, 0, NULL, NULL,
228 &bufSize);
230 GetLastError() == OSS_BAD_ARG /* Win9x */),
231 "Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n", GetLastError());
232 /* check with a valid, but too large, integer */
233 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER, bigInt, bigInt[1] + 2,
236 broken(ret) /* Win9x */,
237 "Expected CRYPT_E_ASN1_LARGE, got %d\n", GetLastError());
238 /* check with a DER-encoded string */
239 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER, testStr, testStr[1] + 2,
242 GetLastError() == OSS_PDU_MISMATCH /* Win9x */ ),
243 "Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x\n",
244 GetLastError());
245 for (i = 0; i < ARRAY_SIZE(ints); i++)
246 {
247 /* When the output buffer is NULL, this always succeeds */
248 SetLastError(0xdeadbeef);
249 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER,
250 ints[i].encoded, ints[i].encoded[1] + 2, 0, NULL, NULL,
251 &bufSize);
252 ok(ret && GetLastError() == NOERROR,
253 "Expected success and NOERROR, got %d\n", GetLastError());
254 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER,
255 ints[i].encoded, ints[i].encoded[1] + 2,
257 ok(ret, "CryptDecodeObjectEx failed: %d\n", GetLastError());
258 ok(bufSize == sizeof(int), "Wrong size %d\n", bufSize);
259 ok(buf != NULL, "Expected allocated buffer\n");
260 if (ret)
261 {
262 ok(!memcmp(buf, &ints[i].val, bufSize), "Expected %d, got %d\n",
263 ints[i].val, *(int *)buf);
264 LocalFree(buf);
265 }
266 }
267 for (i = 0; i < ARRAY_SIZE(bigInts); i++)
268 {
269 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER,
270 bigInts[i].encoded, bigInts[i].encoded[1] + 2, 0, NULL, NULL,
271 &bufSize);
272 ok(ret && GetLastError() == NOERROR,
273 "Expected success and NOERROR, got %d\n", GetLastError());
274 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER,
275 bigInts[i].encoded, bigInts[i].encoded[1] + 2,
277 ok(ret, "CryptDecodeObjectEx failed: %d\n", GetLastError());
278 ok(bufSize >= sizeof(CRYPT_INTEGER_BLOB), "Wrong size %d\n", bufSize);
279 ok(buf != NULL, "Expected allocated buffer\n");
280 if (ret)
281 {
283
284 ok(blob->cbData == strlen((const char*)bigInts[i].decoded),
285 "Expected len %d, got %d\n", lstrlenA((const char*)bigInts[i].decoded),
286 blob->cbData);
287 ok(!memcmp(blob->pbData, bigInts[i].decoded, blob->cbData),
288 "Unexpected value\n");
289 LocalFree(buf);
290 }
291 }
292 for (i = 0; i < ARRAY_SIZE(bigUInts); i++)
293 {
294 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_UINT,
295 bigUInts[i].encoded, bigUInts[i].encoded[1] + 2, 0, NULL, NULL,
296 &bufSize);
297 ok(ret && GetLastError() == NOERROR,
298 "Expected success and NOERROR, got %d\n", GetLastError());
299 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_UINT,
300 bigUInts[i].encoded, bigUInts[i].encoded[1] + 2,
302 ok(ret, "CryptDecodeObjectEx failed: %d\n", GetLastError());
303 ok(bufSize >= sizeof(CRYPT_INTEGER_BLOB), "Wrong size %d\n", bufSize);
304 ok(buf != NULL, "Expected allocated buffer\n");
305 if (ret)
306 {
308
309 ok(blob->cbData == strlen((const char*)bigUInts[i].val),
310 "Expected len %d, got %d\n", lstrlenA((const char*)bigUInts[i].val),
311 blob->cbData);
312 ok(!memcmp(blob->pbData, bigUInts[i].val, blob->cbData),
313 "Unexpected value\n");
314 LocalFree(buf);
315 }
316 }
317 /* Decode the value 1 with long-form length */
318 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, longForm,
319 sizeof(longForm), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
320 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
321 if (ret)
322 {
323 ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf);
324 LocalFree(buf);
325 }
326 /* check with extra bytes at the end */
327 ret = pCryptDecodeObjectEx(dwEncoding, X509_INTEGER, extraBytes,
328 sizeof(extraBytes), CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
329 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
330 if (ret)
331 {
332 ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf);
333 LocalFree(buf);
334 }
335 /* Try to decode some bogus large items */
336 /* The buffer size is smaller than the encoded length, so this should fail
337 * with CRYPT_E_ASN1_EOD if it's being decoded.
338 * Under XP it fails with CRYPT_E_ASN1_LARGE, which means there's a limit
339 * on the size decoded, but in ME it fails with CRYPT_E_ASN1_EOD or crashes.
340 * So this test unfortunately isn't useful.
341 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, tooBig,
342 0x7fffffff, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
343 ok(!ret && GetLastError() == CRYPT_E_ASN1_LARGE,
344 "Expected CRYPT_E_ASN1_LARGE, got %08x\n", GetLastError());
345 */
346 /* This will try to decode the buffer and overflow it, check that it's
347 * caught.
348 */
349 if (0)
350 {
351 /* a large buffer isn't guaranteed to crash, it depends on memory allocation order */
352 ret = pCryptDecodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, bigBogus,
353 0x01ffffff, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &bufSize);
355 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
356 }
357}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static const struct encodedInt ints[]
Definition: encode.c:48
static const struct encodedBigInt bigUInts[]
Definition: encode.c:84
static const struct encodedBigInt bigInts[]
Definition: encode.c:73
#define X509_MULTI_BYTE_UINT
Definition: wincrypt.h:3405
#define X509_MULTI_BYTE_INTEGER
Definition: wincrypt.h:3394
#define X509_INTEGER
Definition: wincrypt.h:3393
#define OSS_PDU_MISMATCH
Definition: winerror.h:3046
#define NOERROR
Definition: winerror.h:2354
#define CRYPT_E_ASN1_LARGE
Definition: winerror.h:3088

Referenced by START_TEST().

◆ test_decodeName()

static void test_decodeName ( DWORD  dwEncoding)
static

Definition at line 1068 of file encode.c.

1069{
1070 BYTE *buf = NULL;
1071 DWORD bufSize = 0;
1072 BOOL ret;
1073 CERT_RDN rdn;
1074 CERT_NAME_INFO info = { 1, &rdn };
1075
1076 /* test empty name */
1077 bufSize = 0;
1078 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME, emptySequence,
1079 emptySequence[1] + 2,
1081 &buf, &bufSize);
1082 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1083 /* Interestingly, in Windows, if cRDN is 0, rgRGN may not be NULL. My
1084 * decoder works the same way, so only test the count.
1085 */
1086 if (ret)
1087 {
1088 ok(bufSize == sizeof(CERT_NAME_INFO), "Wrong bufSize %d\n", bufSize);
1089 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1090 "Expected 0 RDNs in empty info, got %d\n",
1091 ((CERT_NAME_INFO *)buf)->cRDN);
1092 LocalFree(buf);
1093 }
1094 /* test empty name with indefinite-length encoding */
1095 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME, emptyIndefiniteSequence,
1097 &buf, &bufSize);
1098 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1099 if (ret)
1100 {
1101 ok(bufSize == sizeof(CERT_NAME_INFO), "Wrong bufSize %d\n", bufSize);
1102 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1103 "Expected 0 RDNs in empty info, got %d\n",
1104 ((CERT_NAME_INFO *)buf)->cRDN);
1105 LocalFree(buf);
1106 }
1107 /* test empty RDN */
1108 bufSize = 0;
1109 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME, emptyRDNs,
1110 emptyRDNs[1] + 2,
1112 &buf, &bufSize);
1113 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1114 if (ret)
1115 {
1117
1118 ok(bufSize == sizeof(CERT_NAME_INFO) + sizeof(CERT_RDN) &&
1119 info->cRDN == 1 && info->rgRDN && info->rgRDN[0].cRDNAttr == 0,
1120 "Got unexpected value for empty RDN\n");
1121 LocalFree(buf);
1122 }
1123 /* test two RDN attrs */
1124 bufSize = 0;
1125 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME, twoRDNs,
1126 twoRDNs[1] + 2,
1128 &buf, &bufSize);
1129 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1130 if (ret)
1131 {
1132 static CHAR oid_sur_name[] = szOID_SUR_NAME,
1133 oid_common_name[] = szOID_COMMON_NAME;
1134
1135 CERT_RDN_ATTR attrs[] = {
1136 { oid_sur_name, CERT_RDN_PRINTABLE_STRING, { sizeof(surName),
1137 (BYTE *)surName } },
1138 { oid_common_name, CERT_RDN_PRINTABLE_STRING, { sizeof(commonName),
1139 (BYTE *)commonName } },
1140 };
1141
1142 rdn.cRDNAttr = ARRAY_SIZE(attrs);
1143 rdn.rgRDNAttr = attrs;
1145 LocalFree(buf);
1146 }
1147 /* test that two RDN attrs with extra bytes succeeds */
1148 bufSize = 0;
1149 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME, twoRDNsExtraBytes,
1150 sizeof(twoRDNsExtraBytes), 0, NULL, NULL, &bufSize);
1151 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1152 /* And, a slightly more complicated name */
1153 buf = NULL;
1154 bufSize = 0;
1155 ret = pCryptDecodeObjectEx(X509_ASN_ENCODING, X509_NAME, encodedRDNAttrs,
1157 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1158 if (ret)
1159 {
1163 LocalFree(buf);
1164 }
1165}
static const char surName[]
Definition: encode.c:674
static const BYTE twoRDNsExtraBytes[]
Definition: encode.c:1063
static CERT_RDN_ATTR decodedRdnAttrs[]
Definition: encode.c:720
static const BYTE emptyIndefiniteSequence[]
Definition: encode.c:1062
static const char commonName[]
Definition: encode.c:673
static const BYTE encodedRDNAttrs[]
Definition: encode.c:731
static void compareNames(const CERT_NAME_INFO *expected, const CERT_NAME_INFO *got)
Definition: encode.c:1048
static const BYTE twoRDNs[]
Definition: encode.c:678
static const BYTE emptyRDNs[]
Definition: encode.c:677
#define X509_NAME
Definition: wincrypt.h:3372
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780
#define CRYPT_DECODE_SHARE_OID_STRING_FLAG
Definition: wincrypt.h:3452
#define szOID_SUR_NAME
Definition: wincrypt.h:3135
#define szOID_COMMON_NAME
Definition: wincrypt.h:3134
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_decodeNameConstraints()

static void test_decodeNameConstraints ( DWORD  dwEncoding)
static

Definition at line 7385 of file encode.c.

7386{
7387 BOOL ret;
7388 DWORD i;
7389 CERT_NAME_CONSTRAINTS_INFO *constraints;
7390
7391 U(DNSSubtree.Base).pwszURL = (LPWSTR)url;
7392 U(IPAddressSubtree.Base).IPAddress.cbData = sizeof(encodedIPAddr);
7393 U(IPAddressSubtree.Base).IPAddress.pbData = (LPBYTE)encodedIPAddr;
7394 U(IPAddressWithMinSubtree.Base).IPAddress.cbData = sizeof(encodedIPAddr);
7395 U(IPAddressWithMinSubtree.Base).IPAddress.pbData = (LPBYTE)encodedIPAddr;
7396 U(IPAddressWithMinMaxSubtree.Base).IPAddress.cbData = sizeof(encodedIPAddr);
7398 for (i = 0; i < ARRAY_SIZE(encodedNameConstraints); i++)
7399 {
7400 DWORD size;
7401
7402 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS,
7403 encodedNameConstraints[i].encoded.pbData,
7404 encodedNameConstraints[i].encoded.cbData,
7405 CRYPT_DECODE_ALLOC_FLAG, NULL, &constraints, &size);
7407 {
7408 skip("no X509_NAME_CONSTRAINTS decode support\n");
7409 return;
7410 }
7411 ok(ret, "%d: CryptDecodeObjectEx failed: %08x\n", i, GetLastError());
7412 if (ret)
7413 {
7414 DWORD j;
7415
7416 if (constraints->cPermittedSubtree !=
7417 encodedNameConstraints[i].constraints.cPermittedSubtree)
7418 fprintf(stderr, "%d: expected %u permitted, got %u\n", i,
7420 constraints->cPermittedSubtree);
7421 if (constraints->cPermittedSubtree ==
7422 encodedNameConstraints[i].constraints.cPermittedSubtree)
7423 {
7424 for (j = 0; j < constraints->cPermittedSubtree; j++)
7425 {
7427 &encodedNameConstraints[i].constraints.rgPermittedSubtree[j].Base);
7428 }
7429 }
7430 if (constraints->cExcludedSubtree !=
7431 encodedNameConstraints[i].constraints.cExcludedSubtree)
7432 fprintf(stderr, "%d: expected %u excluded, got %u\n", i,
7434 constraints->cExcludedSubtree);
7435 if (constraints->cExcludedSubtree ==
7436 encodedNameConstraints[i].constraints.cExcludedSubtree)
7437 {
7438 for (j = 0; j < constraints->cExcludedSubtree; j++)
7439 {
7441 &encodedNameConstraints[i].constraints.rgExcludedSubtree[j].Base);
7442 }
7443 }
7444 LocalFree(constraints);
7445 }
7446 }
7447}
#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:7362
static CERT_GENERAL_SUBTREE DNSSubtree
Definition: encode.c:7358
static CERT_GENERAL_SUBTREE IPAddressSubtree
Definition: encode.c:7360
static CERT_GENERAL_SUBTREE IPAddressWithMinMaxSubtree
Definition: encode.c:7364
static const struct EncodedNameConstraints encodedNameConstraints[]
Definition: encode.c:7367
CERT_ALT_NAME_ENTRY Base
Definition: wincrypt.h:571
PCERT_GENERAL_SUBTREE rgPermittedSubtree
Definition: wincrypt.h:579
PCERT_GENERAL_SUBTREE rgExcludedSubtree
Definition: wincrypt.h:581
#define X509_NAME_CONSTRAINTS
Definition: wincrypt.h:3425

Referenced by START_TEST().

◆ test_decodeNameValue()

static void test_decodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1366 of file encode.c.

1367{
1368 int i;
1369 BYTE *buf = NULL;
1370 DWORD bufSize = 0;
1371 BOOL ret;
1372
1373 for (i = 0; i < ARRAY_SIZE(nameValues); i++)
1374 {
1375 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME_VALUE,
1376 nameValues[i].encoded, nameValues[i].encoded[1] + 2,
1378 &buf, &bufSize);
1379 ok(ret, "Value type %d: CryptDecodeObjectEx failed: %08x\n",
1380 nameValues[i].value.dwValueType, GetLastError());
1381 if (ret)
1382 {
1384 (const CERT_NAME_VALUE *)buf);
1385 LocalFree(buf);
1386 }
1387 }
1388 ret = pCryptDecodeObjectEx(dwEncoding, X509_NAME_VALUE,
1389 embeddedNullNameValue.encoded, embeddedNullNameValue.encodedSize,
1391 &buf, &bufSize);
1392 /* Some Windows versions disallow name values with embedded NULLs, so
1393 * either success or failure is acceptable.
1394 */
1395 if (ret)
1396 {
1397 CERT_NAME_VALUE rdnEncodedValue = { CERT_RDN_ENCODED_BLOB,
1398 { sizeof(ia5EmbeddedNull), ia5EmbeddedNull } };
1399 CERT_NAME_VALUE embeddedNullValue = { CERT_RDN_IA5_STRING,
1400 { sizeof(embedded_null) - 1, (BYTE *)embedded_null } };
1401 const CERT_NAME_VALUE *got = (const CERT_NAME_VALUE *)buf,
1402 *expected = NULL;
1403
1404 /* Some Windows versions decode name values with embedded NULLs,
1405 * others leave them encoded, even with the same version of crypt32.
1406 * Accept either.
1407 */
1410 "Expected CERT_RDN_ENCODED_BLOB or CERT_RDN_IA5_STRING, got %d\n",
1411 got->dwValueType);
1413 expected = &rdnEncodedValue;
1414 else if (got->dwValueType == CERT_RDN_IA5_STRING)
1415 expected = &embeddedNullValue;
1416 if (expected)
1417 {
1418 ok(got->Value.cbData == expected->Value.cbData,
1419 "String type %d: unexpected data size, got %d, expected %d\n",
1420 got->dwValueType, got->Value.cbData, expected->Value.cbData);
1421 if (got->Value.cbData && got->Value.pbData)
1422 ok(!memcmp(got->Value.pbData, expected->Value.pbData,
1423 min(got->Value.cbData, expected->Value.cbData)),
1424 "String type %d: unexpected value\n", expected->dwValueType);
1425 }
1426 LocalFree(buf);
1427 }
1428}
static struct EncodedNameValue embeddedNullNameValue
Definition: encode.c:1310
static char embedded_null[]
Definition: encode.c:1269
static struct EncodedNameValue nameValues[]
Definition: encode.c:1273
static BYTE ia5EmbeddedNull[]
Definition: encode.c:1270
Definition: pdh_main.c:94
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
#define X509_NAME_VALUE
Definition: wincrypt.h:3370

Referenced by START_TEST().

◆ test_decodeOctets()

static void test_decodeOctets ( DWORD  dwEncoding)
static

Definition at line 2027 of file encode.c.

2028{
2029 DWORD i;
2030
2031 static const struct {
2032 const BYTE *encoded;
2033 UINT encoded_size;
2034 const BYTE *decoded;
2036 DWORD error;
2037 } tests[] = {
2038 {
2041 },{
2044 },{
2047 },{
2050 },{
2053 },{
2056 },{
2059 },{
2062 },{
2065 }
2066 };
2067
2068 for (i = 0; i < ARRAY_SIZE(tests); i++)
2069 {
2070 BYTE *buf = NULL;
2071 BOOL ret;
2072 DWORD bufSize = 0;
2073
2074 ret = pCryptDecodeObjectEx(dwEncoding, X509_OCTET_STRING,
2075 tests[i].encoded, tests[i].encoded_size,
2077 if (tests[i].error)
2078 {
2079 ok(!ret && GetLastError() == tests[i].error,
2080 "[%u] CryptDecodeObjectEx returned %x(%x)\n", i, ret, GetLastError());
2081 continue;
2082 }
2083 ok(ret, "[%u] CryptDecodeObjectEx failed: %08x\n", i, GetLastError());
2085 "[%u] Expected size >= %d, got %d\n", i,
2086 (int)sizeof(CRYPT_DATA_BLOB) + tests[i].decoded_size, bufSize);
2087 ok(buf != NULL, "Expected allocated buffer\n");
2088 if (ret)
2089 {
2091
2092 ok (blob->cbData == tests[i].decoded_size, "[%u] cbData = %u\n", i, blob->cbData);
2093 if (blob->cbData)
2094 ok(!memcmp(blob->pbData, tests[i].decoded, blob->cbData),
2095 "Unexpected value\n");
2096 LocalFree(buf);
2097 }
2098 }
2099}
_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:1969
static const unsigned char encoded_constructed_hi_octet[]
Definition: encode.c:2018
static const unsigned char encoded_constructed_hi_octet_invalid_end[]
Definition: encode.c:2024
static const unsigned char encoded_something_long_octet[]
Definition: encode.c:1967
static const unsigned char decoded_something_long_octet[]
Definition: encode.c:1965
static const unsigned char encoded_constructed_hi_octet2[]
Definition: encode.c:2020
static const unsigned char decoded_hi_octet[]
Definition: encode.c:1963
static const unsigned char encoded_constructed_hi_octet3[]
Definition: encode.c:2022
static const unsigned char encoded_hi_octet[]
Definition: encode.c:1964
unsigned int UINT
Definition: ndis.h:50
#define X509_OCTET_STRING
Definition: wincrypt.h:3391

Referenced by START_TEST().

◆ test_decodePKCSAttribute()

static void test_decodePKCSAttribute ( DWORD  dwEncoding)
static

Definition at line 6208 of file encode.c.

6209{
6210 BOOL ret;
6211 LPBYTE buf = NULL;
6212 DWORD size = 0;
6214
6215 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTE,
6218 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6219 if (ret)
6220 {
6222
6223 ok(!strcmp(attr->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
6224 attr->pszObjId);
6225 ok(attr->cValue == 0, "Expected no value, got %d\n", attr->cValue);
6226 LocalFree(buf);
6227 }
6228 SetLastError(0xdeadbeef);
6229 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTE,
6232 /* Native fails with CRYPT_E_ASN1_EOD, accept also CRYPT_E_ASN1_CORRUPT as
6233 * I doubt an app depends on that.
6234 */
6235 ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
6237 GetLastError() == OSS_MORE_INPUT /* Win9x */),
6238 "Expected CRYPT_E_ASN1_EOD, CRYPT_E_ASN1_CORRUPT, or OSS_MORE_INPUT, got %x\n",
6239 GetLastError());
6240 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTE,
6241 intPKCSAttr, sizeof(intPKCSAttr),
6243 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6244 if (ret)
6245 {
6247
6248 ok(!strcmp(attr->pszObjId, "1.2.3"), "Expected 1.2.3, got %s\n",
6249 attr->pszObjId);
6250 ok(attr->cValue == 1, "Expected 1 value, got %d\n", attr->cValue);
6251 ok(attr->rgValue[0].cbData == ints[0].encoded[1] + 2,
6252 "Unexpected size %d\n", attr->rgValue[0].cbData);
6253 ok(!memcmp(attr->rgValue[0].pbData, ints[0].encoded,
6254 attr->rgValue[0].cbData), "Unexpected value\n");
6255 LocalFree(buf);
6256 }
6257}
static const BYTE intPKCSAttr[]
Definition: encode.c:6146
static const BYTE emptyPKCSAttr[]
Definition: encode.c:6142
static const BYTE bogusPKCSAttr[]
Definition: encode.c:6144
Definition: cookie.c:202
#define PKCS_ATTRIBUTE
Definition: wincrypt.h:3387

Referenced by START_TEST().

◆ test_decodePKCSAttributes()

static void test_decodePKCSAttributes ( DWORD  dwEncoding)
static

Definition at line 6318 of file encode.c.

6319{
6320 BOOL ret;
6321 LPBYTE buf = NULL;
6322 DWORD size = 0;
6323 CRYPT_ATTRIBUTES *attributes;
6324
6325 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
6328 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6329 if (ret)
6330 {
6331 attributes = (CRYPT_ATTRIBUTES *)buf;
6332 ok(attributes->cAttr == 0, "Expected no attributes, got %d\n",
6333 attributes->cAttr);
6334 LocalFree(buf);
6335 }
6336 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
6339 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6340 if (ret)
6341 {
6342 attributes = (CRYPT_ATTRIBUTES *)buf;
6343 ok(attributes->cAttr == 1, "Expected 1 attribute, got %d\n",
6344 attributes->cAttr);
6345 ok(!strcmp(attributes->rgAttr[0].pszObjId, "1.2.3"),
6346 "Expected 1.2.3, got %s\n", attributes->rgAttr[0].pszObjId);
6347 ok(attributes->rgAttr[0].cValue == 0,
6348 "Expected no attributes, got %d\n", attributes->rgAttr[0].cValue);
6349 LocalFree(buf);
6350 }
6351 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
6354 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6355 if (ret)
6356 {
6357 attributes = (CRYPT_ATTRIBUTES *)buf;
6358 ok(attributes->cAttr == 2, "Expected 2 attributes, got %d\n",
6359 attributes->cAttr);
6360 ok(!strcmp(attributes->rgAttr[0].pszObjId, "1.2.3"),
6361 "Expected 1.2.3, got %s\n", attributes->rgAttr[0].pszObjId);
6362 ok(attributes->rgAttr[0].cValue == 0,
6363 "Expected no attributes, got %d\n", attributes->rgAttr[0].cValue);
6364 ok(!strcmp(attributes->rgAttr[1].pszObjId, "1.5.6"),
6365 "Expected 1.5.6, got %s\n", attributes->rgAttr[1].pszObjId);
6366 ok(attributes->rgAttr[1].cValue == 1,
6367 "Expected 1 attribute, got %d\n", attributes->rgAttr[1].cValue);
6368 ok(attributes->rgAttr[1].rgValue[0].cbData == ints[0].encoded[1] + 2,
6369 "Unexpected size %d\n", attributes->rgAttr[1].rgValue[0].cbData);
6370 ok(!memcmp(attributes->rgAttr[1].rgValue[0].pbData, ints[0].encoded,
6371 attributes->rgAttr[1].rgValue[0].cbData), "Unexpected value\n");
6372 LocalFree(buf);
6373 }
6374 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
6376 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6378 if (buf)
6379 {
6380 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_ATTRIBUTES,
6382 ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError());
6384 }
6385}
static const BYTE doublePKCSAttributes[]
Definition: encode.c:6262
static const BYTE emptyPKCSAttributes[]
Definition: encode.c:6259
static const BYTE singlePKCSAttributes[]
Definition: encode.c:6260
PCRYPT_ATTRIBUTE rgAttr
Definition: wincrypt.h:595
#define PKCS_ATTRIBUTES
Definition: wincrypt.h:3418

Referenced by START_TEST().

◆ test_decodePKCSContentInfo()

static void test_decodePKCSContentInfo ( DWORD  dwEncoding)
static

Definition at line 6082 of file encode.c.

6083{
6084 BOOL ret;
6085 LPBYTE buf = NULL;
6086 DWORD size = 0, i;
6088
6089 const struct {
6090 const BYTE *encoded;
6091 UINT encoded_size;
6092 const char *obj_id;
6093 const BYTE *content;
6094 UINT content_size;
6095 } tests[] = {
6097 "1.2.3", NULL, 0 },
6099 "1.2.3", NULL, 0 },
6101 "1.2.3", ints[0].encoded, ints[0].encoded[1] + 2 },
6103 "1.2.840.113549.1.7.2", NULL, 392 },
6104 { content_abcd, sizeof(content_abcd),
6105 "1.2.3", encoded_abcd, 6 },
6107 "1.2.3", content_constructed_abcd + 8, 10 }
6108 };
6109
6110 for (i = 0; i < ARRAY_SIZE(tests); i++)
6111 {
6112 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, tests[i].encoded,
6113 tests[i].encoded_size, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf, &size);
6114 ok(ret, "[%u] CryptDecodeObjectEx failed: %x\n", i, GetLastError());
6115 if (!ret) continue;
6116
6118
6119 ok(!strcmp(info->pszObjId, tests[i].obj_id), "[%u] Expected %s, got %s\n",
6120 i, tests[i].obj_id, info->pszObjId);
6121 ok(info->Content.cbData == tests[i].content_size,
6122 "[%u] Unexpected size %d expected %d\n", i, info->Content.cbData,
6123 tests[i].content_size);
6124 if (tests[i].content)
6125 ok(!memcmp(info->Content.pbData, tests[i].content, tests[i].content_size),
6126 "[%u] Unexpected value\n", i);
6127 LocalFree(buf);
6128 }
6129
6130 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
6133 /* Native fails with CRYPT_E_ASN1_EOD, accept also CRYPT_E_ASN1_CORRUPT as
6134 * I doubt an app depends on that.
6135 */
6136 ok((!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
6138 "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT, got %x\n",
6139 GetLastError());
6140}
content
Definition: atl_ax.c:994
static const BYTE indefiniteSignedPKCSContent[]
Definition: encode.c:6027
static const BYTE emptyPKCSContentInfo[]
Definition: encode.c:5962
static const BYTE emptyPKCSContentInfoExtraBytes[]
Definition: encode.c:5963
static const BYTE content_constructed_abcd[]
Definition: encode.c:6070
static const BYTE intPKCSContentInfo[]
Definition: encode.c:5967
static const BYTE bogusPKCSContentInfo[]
Definition: encode.c:5965
static const BYTE encoded_abcd[]
Definition: encode.c:6066
static const BYTE content_abcd[]
Definition: encode.c:6057
#define PKCS_CONTENT_INFO
Definition: wincrypt.h:3400

Referenced by START_TEST().

◆ test_decodePKCSSignerInfo()

static void test_decodePKCSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6760 of file encode.c.

6761{
6762 BOOL ret;
6763 LPBYTE buf = NULL;
6764 DWORD size = 0;
6766
6767 /* A PKCS signer can't be decoded without a serial number. */
6768 SetLastError(0xdeadbeef);
6769 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6773 GetLastError() == OSS_DATA_ERROR /* Win9x */),
6774 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %x\n",
6775 GetLastError());
6776 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6780 "CryptDecodeObjectEx failed: %x\n", GetLastError());
6781 if (ret)
6782 {
6784 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
6785 info->dwVersion);
6786 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6787 "Unexpected size %d\n", info->Issuer.cbData);
6788 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6789 info->Issuer.cbData), "Unexpected value\n");
6790 ok(info->SerialNumber.cbData == sizeof(serialNum),
6791 "Unexpected size %d\n", info->SerialNumber.cbData);
6792 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6793 "Unexpected value\n");
6794 LocalFree(buf);
6795 }
6796 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6799 if (ret)
6800 {
6802 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
6803 info->dwVersion);
6804 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6805 "Unexpected size %d\n", info->Issuer.cbData);
6806 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6807 info->Issuer.cbData), "Unexpected value\n");
6808 ok(info->SerialNumber.cbData == sizeof(serialNum),
6809 "Unexpected size %d\n", info->SerialNumber.cbData);
6810 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6811 "Unexpected value\n");
6812 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6813 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6814 LocalFree(buf);
6815 }
6816 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6819 NULL, &buf, &size);
6820 if (ret)
6821 {
6823 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
6824 info->dwVersion);
6825 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6826 "Unexpected size %d\n", info->Issuer.cbData);
6827 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6828 info->Issuer.cbData), "Unexpected value\n");
6829 ok(info->SerialNumber.cbData == sizeof(serialNum),
6830 "Unexpected size %d\n", info->SerialNumber.cbData);
6831 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6832 "Unexpected value\n");
6833 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6834 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6835 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, "1.5.6"),
6836 "Expected 1.5.6, got %s\n", info->HashEncryptionAlgorithm.pszObjId);
6837 LocalFree(buf);
6838 }
6839 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6842 if (ret)
6843 {
6845 ok(info->dwVersion == 0, "Expected version 0, got %d\n",
6846 info->dwVersion);
6847 ok(info->Issuer.cbData == sizeof(encodedCommonNameNoNull),
6848 "Unexpected size %d\n", info->Issuer.cbData);
6849 ok(!memcmp(info->Issuer.pbData, encodedCommonNameNoNull,
6850 info->Issuer.cbData), "Unexpected value\n");
6851 ok(info->SerialNumber.cbData == sizeof(serialNum),
6852 "Unexpected size %d\n", info->SerialNumber.cbData);
6853 ok(!memcmp(info->SerialNumber.pbData, serialNum, sizeof(serialNum)),
6854 "Unexpected value\n");
6855 ok(!strcmp(info->HashAlgorithm.pszObjId, "1.2.3"),
6856 "Expected 1.2.3, got %s\n", info->HashAlgorithm.pszObjId);
6857 ok(!strcmp(info->HashEncryptionAlgorithm.pszObjId, "1.5.6"),
6858 "Expected 1.5.6, got %s\n", info->HashEncryptionAlgorithm.pszObjId);
6859 ok(info->EncryptedHash.cbData == sizeof(hash), "Unexpected size %d\n",
6860 info->EncryptedHash.cbData);
6861 ok(!memcmp(info->EncryptedHash.pbData, hash, sizeof(hash)),
6862 "Unexpected value\n");
6863 LocalFree(buf);
6864 }
6865 ret = pCryptDecodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO,
6868 if (ret)
6869 {
6871 ok(info->AuthAttrs.cAttr == 1, "Expected 1 attribute, got %d\n",
6872 info->AuthAttrs.cAttr);
6873 ok(!strcmp(info->AuthAttrs.rgAttr[0].pszObjId, szOID_COMMON_NAME),
6874 "Expected %s, got %s\n", szOID_COMMON_NAME,
6875 info->AuthAttrs.rgAttr[0].pszObjId);
6876 ok(info->AuthAttrs.rgAttr[0].cValue == 1, "Expected 1 value, got %d\n",
6877 info->AuthAttrs.rgAttr[0].cValue);
6878 ok(info->AuthAttrs.rgAttr[0].rgValue[0].cbData ==
6879 sizeof(encodedCommonName), "Unexpected size %d\n",
6880 info->AuthAttrs.rgAttr[0].rgValue[0].cbData);
6881 ok(!memcmp(info->AuthAttrs.rgAttr[0].rgValue[0].pbData,
6882 encodedCommonName, sizeof(encodedCommonName)), "Unexpected value\n");
6883 LocalFree(buf);
6884 }
6885}
static const BYTE PKCSSignerWithAuthAttr[]
Definition: encode.c:6585
#define PKCS7_SIGNER_INFO
Definition: wincrypt.h:3436

Referenced by START_TEST().

◆ test_decodePKCSSMimeCapabilities()

static void test_decodePKCSSMimeCapabilities ( DWORD  dwEncoding)
static

Definition at line 6478 of file encode.c.

6479{
6480 static char oid1[] = "1.5.6", oid2[] = "1.2.3";
6481 BOOL ret;
6482 DWORD size = 0;
6483 CRYPT_SMIME_CAPABILITY capability[2];
6484 CRYPT_SMIME_CAPABILITIES capabilities, *ptr;
6485
6486 SetLastError(0xdeadbeef);
6487 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6490 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6491 if (ret)
6492 {
6493 capabilities.cCapability = 0;
6494 compareSMimeCapabilities("empty capabilities", &capabilities, ptr);
6495 LocalFree(ptr);
6496 }
6497 SetLastError(0xdeadbeef);
6498 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6500 &ptr, &size);
6501 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6502 if (ret)
6503 {
6504 capability[0].pszObjId = oid1;
6505 capability[0].Parameters.cbData = 0;
6506 capabilities.cCapability = 1;
6507 capabilities.rgCapability = capability;
6508 compareSMimeCapabilities("single capability", &capabilities, ptr);
6509 LocalFree(ptr);
6510 }
6511 SetLastError(0xdeadbeef);
6512 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6515 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6516 if (ret)
6517 {
6518 BYTE NULLparam[] = {0x05, 0x00};
6519 capability[0].pszObjId = oid1;
6520 capability[0].Parameters.cbData = 2;
6521 capability[0].Parameters.pbData = NULLparam;
6522 capabilities.cCapability = 1;
6523 capabilities.rgCapability = capability;
6524 compareSMimeCapabilities("single capability with NULL", &capabilities,
6525 ptr);
6526 LocalFree(ptr);
6527 }
6528 SetLastError(0xdeadbeef);
6529 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6531 &ptr, &size);
6532 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6533 if (ret)
6534 {
6535 capability[0].Parameters.cbData = 0;
6536 capability[1].pszObjId = oid2;
6537 capability[1].Parameters.cbData = 0;
6538 capabilities.cCapability = 2;
6539 compareSMimeCapabilities("two capabilities", &capabilities, ptr);
6540 LocalFree(ptr);
6541 }
6542 SetLastError(0xdeadbeef);
6543 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6544 twoCapabilities, sizeof(twoCapabilities), 0, NULL, NULL, &size);
6545 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6547 if (ptr)
6548 {
6549 SetLastError(0xdeadbeef);
6550 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6551 twoCapabilities, sizeof(twoCapabilities), 0, NULL, ptr, &size);
6552 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
6554 }
6555}
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:6451
static const BYTE singleCapabilitywithNULL[]
Definition: encode.c:6391
static const BYTE twoCapabilities[]
Definition: encode.c:6389
static const BYTE singleCapability[]
Definition: encode.c:6387
#define PKCS_SMIME_CAPABILITIES
Definition: wincrypt.h:3410

Referenced by START_TEST().

◆ test_decodePolicyQualifierUserNotice()

static void test_decodePolicyQualifierUserNotice ( DWORD  dwEncoding)
static

Definition at line 7516 of file encode.c.

7517{
7518 BOOL ret;
7520 DWORD size;
7521
7522 ret = pCryptDecodeObjectEx(dwEncoding,
7525 &notice, &size);
7527 {
7528 skip("no X509_PKIX_POLICY_QUALIFIER_USERNOTICE decode support\n");
7529 return;
7530 }
7531 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7532 if (ret)
7533 {
7534 ok(notice->pszDisplayText == NULL, "unexpected display text\n");
7535 ok(notice->pNoticeReference == NULL, "unexpected notice reference\n");
7537 }
7538 ret = pCryptDecodeObjectEx(dwEncoding,
7542 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7543 if (ret)
7544 {
7545 ok(!lstrcmpW(notice->pszDisplayText, noticeText),
7546 "unexpected display text\n");
7547 ok(notice->pNoticeReference == NULL, "unexpected notice reference\n");
7549 }
7550 ret = pCryptDecodeObjectEx(dwEncoding,
7554 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
7555 if (ret)
7556 {
7557 ok(!lstrcmpW(notice->pszDisplayText, noticeText),
7558 "unexpected display text\n");
7559 ok(notice->pNoticeReference != NULL, "expected a notice reference\n");
7560 if (notice->pNoticeReference)
7561 {
7562 ok(!strcmp(notice->pNoticeReference->pszOrganization, org),
7563 "unexpected organization %s\n",
7564 notice->pNoticeReference->pszOrganization);
7565 ok(notice->pNoticeReference->cNoticeNumbers == 2,
7566 "expected 2 notice numbers, got %d\n",
7567 notice->pNoticeReference->cNoticeNumbers);
7568 ok(notice->pNoticeReference->rgNoticeNumbers[0] == noticeNumbers[0],
7569 "unexpected notice number %d\n",
7570 notice->pNoticeReference->rgNoticeNumbers[0]);
7571 ok(notice->pNoticeReference->rgNoticeNumbers[1] == noticeNumbers[1],
7572 "unexpected notice number %d\n",
7573 notice->pNoticeReference->rgNoticeNumbers[1]);
7574 }
7576 }
7577}
static char org[]
Definition: encode.c:7456
static const BYTE noticeWithDisplayText[]
Definition: encode.c:7451
static int noticeNumbers[]
Definition: encode.c:7457
static WCHAR noticeText[]
Definition: encode.c:7449
notice
Definition: t1tokens.h:26
#define X509_PKIX_POLICY_QUALIFIER_USERNOTICE
Definition: wincrypt.h:3414

Referenced by START_TEST().

◆ test_decodePublicKeyInfo()

static void test_decodePublicKeyInfo ( DWORD  dwEncoding)
static

Definition at line 2897 of file encode.c.

2898{
2899 static const BYTE bogusPubKeyInfo[] = { 0x30, 0x22, 0x30, 0x0d, 0x06, 0x06,
2900 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
2901 0x11, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
2902 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
2903 DWORD i;
2904 BOOL ret;
2905 BYTE *buf = NULL;
2906 DWORD bufSize = 0;
2907
2908 for (i = 0; i < ARRAY_SIZE(pubKeys); i++)
2909 {
2910 /* The NULL form decodes to the decoded member */
2911 ret = pCryptDecodeObjectEx(dwEncoding, X509_PUBLIC_KEY_INFO,
2912 pubKeys[i].encoded, pubKeys[i].encoded[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2913 NULL, &buf, &bufSize);
2914 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2915 if (ret)
2916 {
2917 comparePublicKeyInfo(&pubKeys[i].decoded,
2919 LocalFree(buf);
2920 }
2921 /* The non-NULL form decodes to the original */
2922 ret = pCryptDecodeObjectEx(dwEncoding, X509_PUBLIC_KEY_INFO,
2923 pubKeys[i].encodedNoNull, pubKeys[i].encodedNoNull[1] + 2,
2925 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2926 if (ret)
2927 {
2929 LocalFree(buf);
2930 }
2931 }
2932 /* Test with bogus (not valid DER) parameters */
2933 ret = pCryptDecodeObjectEx(dwEncoding, X509_PUBLIC_KEY_INFO,
2934 bogusPubKeyInfo, bogusPubKeyInfo[1] + 2, CRYPT_DECODE_ALLOC_FLAG,
2935 NULL, &buf, &bufSize);
2937 GetLastError() == OSS_DATA_ERROR /* Win9x */),
2938 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2939 GetLastError());
2940}
static const struct encodedPublicKey pubKeys[]
Definition: encode.c:2828
static void comparePublicKeyInfo(const CERT_PUBLIC_KEY_INFO *expected, const CERT_PUBLIC_KEY_INFO *got)
Definition: encode.c:2875
#define X509_PUBLIC_KEY_INFO
Definition: wincrypt.h:3373

Referenced by START_TEST().

◆ test_decodeRsaPrivateKey()

static void test_decodeRsaPrivateKey ( DWORD  dwEncoding)
static

Definition at line 8248 of file encode.c.

8249{
8250 LPBYTE buf = NULL;
8251 DWORD bufSize = 0;
8252 BOOL ret;
8253
8254 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_RSA_PRIVATE_KEY,
8255 rsaPrivKeyDer, sizeof(rsaPrivKeyDer)-10,
8258 "Expected CRYPT_E_ASN1_EOD, got %08x\n",
8259 GetLastError());
8260
8261 buf = NULL;
8262 bufSize = 0;
8263 ret = pCryptDecodeObjectEx(dwEncoding, PKCS_RSA_PRIVATE_KEY,
8266 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
8267
8268 if (ret)
8269 {
8271 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(buf + sizeof(BLOBHEADER));
8272 static const int bitlen = 2048;
8273 BYTE *modulus = (BYTE*)(rsaPubKey + 1);
8274 BYTE *prime1 = modulus + bitlen/8;
8275 BYTE *prime2 = prime1 + bitlen/16;
8276 BYTE *exponent1 = prime2 + bitlen/16;
8277 BYTE *exponent2 = exponent1 + bitlen/16;
8278 BYTE *coefficient = exponent2 + bitlen/16;
8279 BYTE *privateExponent = coefficient + bitlen/16;
8280
8281 ok(bufSize >= sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) +
8282 (bitlen * 9 / 16),
8283 "Wrong size %d\n", bufSize);
8284
8285 ok(hdr->bType == PRIVATEKEYBLOB,
8286 "Expected type PRIVATEKEYBLOB (%d), got %d\n", PRIVATEKEYBLOB,
8287 hdr->bType);
8288 ok(hdr->bVersion == CUR_BLOB_VERSION,
8289 "Expected version CUR_BLOB_VERSION (%d), got %d\n",
8290 CUR_BLOB_VERSION, hdr->bVersion);
8291 ok(hdr->reserved == 0, "Expected reserved 0, got %d\n",
8292 hdr->reserved);
8293 ok(hdr->aiKeyAlg == CALG_RSA_KEYX,
8294 "Expected CALG_RSA_KEYX, got %08x\n", hdr->aiKeyAlg);
8295
8296 ok(rsaPubKey->magic == 0x32415352,
8297 "Expected magic 0x32415352, got 0x%x\n", rsaPubKey->magic);
8298 ok(rsaPubKey->bitlen == bitlen,
8299 "Expected bitlen %d, got %d\n", bitlen, rsaPubKey->bitlen);
8300 ok(rsaPubKey->pubexp == 65537,
8301 "Expected pubexp 65537, got %d\n", rsaPubKey->pubexp);
8302
8303 ok(!memcmp(modulus, rsaPrivKeyModulus, bitlen/8),
8304 "unexpected modulus\n");
8305 ok(!memcmp(prime1, rsaPrivKeyPrime1, bitlen/16),
8306 "unexpected prime1\n");
8307 ok(!memcmp(prime2, rsaPrivKeyPrime2, bitlen/16),
8308 "unexpected prime2\n");
8309 ok(!memcmp(exponent1, rsaPrivKeyExponent1, bitlen/16),
8310 "unexpected exponent1\n");
8311 ok(!memcmp(exponent2, rsaPrivKeyExponent2, bitlen/16),
8312 "unexpected exponent2\n");
8313 ok(!memcmp(coefficient, rsaPrivKeyCoefficient, bitlen/16),
8314 "unexpected coefficient\n");
8315 ok(!memcmp(privateExponent, rsaPrivKeyPrivateExponent, bitlen/8),
8316 "unexpected privateExponent\n");
8317
8318 LocalFree(buf);
8319 }
8320}
char hdr[14]
Definition: iptest.cpp:33
static const BYTE rsaPrivKeyDer[]
Definition: encode.c:8040
static const BYTE rsaPrivKeyPrime1[]
Definition: encode.c:8164
static const BYTE rsaPrivKeyModulus[]
Definition: encode.c:8141
static const BYTE rsaPrivKeyExponent1[]
Definition: encode.c:8188
static const BYTE rsaPrivKeyExponent2[]
Definition: encode.c:8200
static const BYTE rsaPrivKeyCoefficient[]
Definition: encode.c:8212
static const BYTE rsaPrivKeyPrivateExponent[]
Definition: encode.c:8224
static const BYTE rsaPrivKeyPrime2[]
Definition: encode.c:8176
DWORD pubexp
Definition: wincrypt.h:145
DWORD bitlen
Definition: wincrypt.h:144
DWORD magic
Definition: wincrypt.h:143
#define PRIVATEKEYBLOB
Definition: wincrypt.h:2241
#define CALG_RSA_KEYX
Definition: wincrypt.h:1824
#define PKCS_RSA_PRIVATE_KEY
Definition: wincrypt.h:3411
#define CUR_BLOB_VERSION
Definition: wincrypt.h:2247

Referenced by START_TEST().

◆ test_decodeRsaPublicKey()

static void test_decodeRsaPublicKey ( DWORD  dwEncoding)
static

Definition at line 2516 of file encode.c.

2517{
2518 DWORD i;
2519 LPBYTE buf = NULL;
2520 DWORD bufSize = 0;
2521 BOOL ret;
2522
2523 /* Try with a bad length */
2524 ret = pCryptDecodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2525 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1],
2527 ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
2528 GetLastError() == OSS_MORE_INPUT /* Win9x/NT4 */),
2529 "Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n",
2530 GetLastError());
2531 /* Try with a couple of RSA-related OIDs */
2532 ret = pCryptDecodeObjectEx(dwEncoding, szOID_RSA_RSA,
2533 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2,
2536 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
2537 ret = pCryptDecodeObjectEx(dwEncoding, szOID_RSA_SHA1RSA,
2538 rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2,
2541 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
2542 /* Now try success cases */
2543 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2544 {
2545 bufSize = 0;
2546 ret = pCryptDecodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2547 rsaPubKeys[i].encoded, rsaPubKeys[i].encoded[1] + 2,
2549 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2550 if (ret)
2551 {
2553 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(buf + sizeof(BLOBHEADER));
2554
2555 ok(bufSize >= sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) +
2556 rsaPubKeys[i].decodedModulusLen,
2557 "Wrong size %d\n", bufSize);
2558 ok(hdr->bType == PUBLICKEYBLOB,
2559 "Expected type PUBLICKEYBLOB (%d), got %d\n", PUBLICKEYBLOB,
2560 hdr->bType);
2561 ok(hdr->bVersion == CUR_BLOB_VERSION,
2562 "Expected version CUR_BLOB_VERSION (%d), got %d\n",
2563 CUR_BLOB_VERSION, hdr->bVersion);
2564 ok(hdr->reserved == 0, "Expected reserved 0, got %d\n",
2565 hdr->reserved);
2566 ok(hdr->aiKeyAlg == CALG_RSA_KEYX,
2567 "Expected CALG_RSA_KEYX, got %08x\n", hdr->aiKeyAlg);
2568 ok(rsaPubKey->magic == 0x31415352,
2569 "Expected magic RSA1, got %08x\n", rsaPubKey->magic);
2570 ok(rsaPubKey->bitlen == rsaPubKeys[i].decodedModulusLen * 8,
2571 "Wrong bit len %d\n", rsaPubKey->bitlen);
2572 ok(rsaPubKey->pubexp == 65537, "Expected pubexp 65537, got %d\n",
2573 rsaPubKey->pubexp);
2574 ok(!memcmp(buf + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY),
2575 rsaPubKeys[i].modulus, rsaPubKeys[i].decodedModulusLen),
2576 "Unexpected modulus\n");
2577 LocalFree(buf);
2578 }
2579 }
2580}
static const struct EncodedRSAPubKey rsaPubKeys[]
Definition: encode.c:2418
#define PUBLICKEYBLOB
Definition: wincrypt.h:2240
#define RSA_CSP_PUBLICKEYBLOB
Definition: wincrypt.h:3384
#define szOID_RSA_SHA1RSA
Definition: wincrypt.h:3022

Referenced by START_TEST().

◆ test_decodeSequenceOfAny()

static void test_decodeSequenceOfAny ( DWORD  dwEncoding)
static

Definition at line 2635 of file encode.c.

2636{
2637 BOOL ret;
2638 BYTE *buf = NULL;
2639 DWORD bufSize = 0;
2640
2641 ret = pCryptDecodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, intSequence,
2643 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2644 if (ret)
2645 {
2647 DWORD i;
2648
2649 ok(seq->cValue == ARRAY_SIZE(ints), "Wrong elements %d\n", seq->cValue);
2650 for (i = 0; i < min(seq->cValue, ARRAY_SIZE(ints)); i++)
2651 {
2652 ok(seq->rgValue[i].cbData == ints[i].encoded[1] + 2,
2653 "Expected %d bytes, got %d\n", ints[i].encoded[1] + 2,
2654 seq->rgValue[i].cbData);
2655 ok(!memcmp(seq->rgValue[i].pbData, ints[i].encoded,
2656 ints[i].encoded[1] + 2), "Unexpected value\n");
2657 }
2658 LocalFree(buf);
2659 }
2660 ret = pCryptDecodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, mixedSequence,
2662 &bufSize);
2663 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
2664 if (ret)
2665 {
2667
2668 ok(seq->cValue == ARRAY_SIZE(ints), "Wrong elements %d\n", seq->cValue);
2669 /* Just check the first element since it's all that changed */
2670 ok(seq->rgValue[0].cbData == times[0].encodedTime[1] + 2,
2671 "Expected %d bytes, got %d\n", times[0].encodedTime[1] + 2,
2672 seq->rgValue[0].cbData);
2673 ok(!memcmp(seq->rgValue[0].pbData, times[0].encodedTime,
2674 times[0].encodedTime[1] + 2), "Unexpected value\n");
2675 LocalFree(buf);
2676 }
2677}
static const BYTE intSequence[]
Definition: encode.c:2582
static const BYTE mixedSequence[]
Definition: encode.c:2586
PCRYPT_DER_BLOB rgValue
Definition: wincrypt.h:459
#define X509_SEQUENCE_OF_ANY
Definition: wincrypt.h:3401

Referenced by START_TEST().

◆ test_decodeUnicodeName()

static void test_decodeUnicodeName ( DWORD  dwEncoding)
static

Definition at line 1167 of file encode.c.

1168{
1169 BYTE *buf = NULL;
1170 DWORD bufSize = 0;
1171 BOOL ret;
1172 CERT_RDN rdn;
1173 CERT_NAME_INFO info = { 1, &rdn };
1174
1175 /* test empty name */
1176 bufSize = 0;
1177 ret = pCryptDecodeObjectEx(dwEncoding, X509_UNICODE_NAME, emptySequence,
1178 emptySequence[1] + 2,
1180 &buf, &bufSize);
1181 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1182 if (ret)
1183 {
1184 ok(bufSize == sizeof(CERT_NAME_INFO),
1185 "Got wrong bufSize %d\n", bufSize);
1186 ok(((CERT_NAME_INFO *)buf)->cRDN == 0,
1187 "Expected 0 RDNs in empty info, got %d\n",
1188 ((CERT_NAME_INFO *)buf)->cRDN);
1189 LocalFree(buf);
1190 }
1191 /* test empty RDN */
1192 bufSize = 0;
1193 ret = pCryptDecodeObjectEx(dwEncoding, X509_UNICODE_NAME, emptyRDNs,
1194 emptyRDNs[1] + 2,
1196 &buf, &bufSize);
1197 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1198 if (ret)
1199 {
1201
1202 ok(bufSize == sizeof(CERT_NAME_INFO) + sizeof(CERT_RDN) &&
1203 info->cRDN == 1 && info->rgRDN && info->rgRDN[0].cRDNAttr == 0,
1204 "Got unexpected value for empty RDN\n");
1205 LocalFree(buf);
1206 }
1207 /* test two RDN attrs */
1208 bufSize = 0;
1209 ret = pCryptDecodeObjectEx(dwEncoding, X509_UNICODE_NAME, twoRDNsNoNull,
1210 sizeof(twoRDNsNoNull),
1212 &buf, &bufSize);
1213 ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1214 if (ret)
1215 {
1216 static CHAR oid_sur_name[] = szOID_SUR_NAME,
1217 oid_common_name[] = szOID_COMMON_NAME;
1218
1219 CERT_RDN_ATTR attrs[] = {
1220 { oid_sur_name, CERT_RDN_PRINTABLE_STRING,
1221 { lstrlenW(surNameW) * sizeof(WCHAR), (BYTE *)surNameW } },
1222 { oid_common_name, CERT_RDN_PRINTABLE_STRING,
1223 { lstrlenW(commonNameW) * sizeof(WCHAR), (BYTE *)commonNameW } },
1224 };
1225
1226 rdn.cRDNAttr = ARRAY_SIZE(attrs);
1227 rdn.rgRDNAttr = attrs;
1229 LocalFree(buf);
1230 }
1231}
static const BYTE twoRDNsNoNull[]
Definition: encode.c:884
static WCHAR surNameW[]
Definition: encode.c:882
static WCHAR commonNameW[]
Definition: encode.c:881
#define X509_UNICODE_NAME
Definition: wincrypt.h:3385

Referenced by START_TEST().

◆ test_decodeUnicodeNameValue()

static void test_decodeUnicodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1932 of file encode.c.

1933{
1934 DWORD i;
1935
1936 for (i = 0; i < ARRAY_SIZE(unicodeResults); i++)
1937 {
1938 BYTE *buf = NULL;
1939 BOOL ret;
1940 DWORD size = 0;
1941
1942 ret = pCryptDecodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE,
1943 unicodeResults[i].encoded.pbData, unicodeResults[i].encoded.cbData,
1945 ok(ret || broken(GetLastError() == CRYPT_E_NOT_CHAR_STRING /* Win9x */),
1946 "CryptDecodeObjectEx failed: %08x\n", GetLastError());
1947 if (ret && buf)
1948 {
1950
1951 ok(value->dwValueType == unicodeResults[i].valueType,
1952 "Expected value type %d, got %d\n", unicodeResults[i].valueType,
1953 value->dwValueType);
1954 ok(!strncmpW((LPWSTR)value->Value.pbData, unicodeResults[i].str,
1955 value->Value.cbData / sizeof(WCHAR)),
1956 "Unexpected decoded value for index %d (value type %d)\n", i,
1957 unicodeResults[i].valueType);
1958 LocalFree(buf);
1959 }
1960 }
1961}
static struct UnicodeExpectedResult unicodeResults[]
Definition: encode.c:1799
#define strncmpW(s1, s2, n)
Definition: unicode.h:36
struct _CERT_NAME_VALUE * PCERT_NAME_VALUE
#define X509_UNICODE_NAME_VALUE
Definition: wincrypt.h:3389
#define CRYPT_E_NOT_CHAR_STRING
Definition: winerror.h:3028

Referenced by START_TEST().

◆ test_encodeAltName()

static void test_encodeAltName ( DWORD  dwEncoding)
static

Definition at line 1452 of file encode.c.

1453{
1454 CERT_ALT_NAME_INFO info = { 0 };
1455 CERT_ALT_NAME_ENTRY entry = { 0 };
1456 BYTE *buf = NULL;
1457 DWORD size = 0;
1458 BOOL ret;
1459 char oid[] = "1.2.3";
1460
1461 /* Test with empty info */
1462 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1464 if (ret)
1465 {
1466 ok(size == sizeof(emptySequence), "Wrong size %d\n", size);
1467 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
1468 LocalFree(buf);
1469 }
1470 /* Test with an empty entry */
1471 info.cAltEntry = 1;
1472 info.rgAltEntry = &entry;
1473 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1476 "Expected E_INVALIDARG, got %08x\n", GetLastError());
1477 /* Test with an empty pointer */
1478 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
1479 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1481 if (ret)
1482 {
1483 ok(size == sizeof(emptyURL), "Wrong size %d\n", size);
1484 ok(!memcmp(buf, emptyURL, size), "Unexpected value\n");
1485 LocalFree(buf);
1486 }
1487 /* Test with a real URL */
1488 U(entry).pwszURL = (LPWSTR)url;
1489 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1491 if (ret)
1492 {
1493 ok(size == sizeof(encodedURL), "Wrong size %d\n", size);
1494 ok(!memcmp(buf, encodedURL, size), "Unexpected value\n");
1495 LocalFree(buf);
1496 }
1497 /* Now with the URL containing an invalid IA5 char */
1498 U(entry).pwszURL = (LPWSTR)nihongoURL;
1499 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1502 "Expected CRYPT_E_INVALID_IA5_STRING, got %08x\n", GetLastError());
1503 /* The first invalid character is at index 7 */
1505 "Expected invalid char at index 7, got %d\n",
1507 /* Now with the URL missing a scheme */
1508 U(entry).pwszURL = (LPWSTR)dnsName;
1509 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1511 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
1512 if (ret)
1513 {
1514 /* This succeeds, but it shouldn't, so don't worry about conforming */
1515 LocalFree(buf);
1516 }
1517 /* Now with a DNS name */
1518 entry.dwAltNameChoice = CERT_ALT_NAME_DNS_NAME;
1519 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1521 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
1522 if (ret)
1523 {
1524 ok(size == sizeof(encodedDnsName), "Wrong size %d\n", size);
1525 ok(!memcmp(buf, encodedDnsName, size), "Unexpected value\n");
1526 LocalFree(buf);
1527 }
1528 /* Test with an IP address */
1529 entry.dwAltNameChoice = CERT_ALT_NAME_IP_ADDRESS;
1530 U(entry).IPAddress.cbData = sizeof(localhost);
1531 U(entry).IPAddress.pbData = (LPBYTE)localhost;
1532 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1534 if (ret)
1535 {
1536 ok(size == sizeof(encodedIPAddr), "Wrong size %d\n", size);
1537 ok(!memcmp(buf, encodedIPAddr, size), "Unexpected value\n");
1538 LocalFree(buf);
1539 }
1540 /* Test with OID */
1541 entry.dwAltNameChoice = CERT_ALT_NAME_REGISTERED_ID;
1542 U(entry).pszRegisteredID = oid;
1543 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1545 if (ret)
1546 {
1547 ok(size == sizeof(encodedOidName), "Wrong size %d\n", size);
1548 ok(!memcmp(buf, encodedOidName, size), "Unexpected value\n");
1549 LocalFree(buf);
1550 }
1551 /* Test with directory name */
1552 entry.dwAltNameChoice = CERT_ALT_NAME_DIRECTORY_NAME;
1553 U(entry).DirectoryName.cbData = sizeof(encodedCommonName);
1554 U(entry).DirectoryName.pbData = (LPBYTE)encodedCommonName;
1555 ret = pCryptEncodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, &info,
1557 if (ret)
1558 {
1559 ok(size == sizeof(encodedDirectoryName), "Wrong size %d\n", size);
1560 ok(!memcmp(buf, encodedDirectoryName, size), "Unexpected value\n");
1561 LocalFree(buf);
1562 }
1563}
#define E_INVALIDARG
Definition: ddrawi.h:101
static const WCHAR nihongoURL[]
Definition: encode.c:1437
#define GET_CERT_ALT_NAME_VALUE_ERR_INDEX(x)
Definition: wincrypt.h:367
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026

Referenced by START_TEST().

◆ test_encodeAuthorityInfoAccess()

static void test_encodeAuthorityInfoAccess ( DWORD  dwEncoding)
static

Definition at line 5230 of file encode.c.

5231{
5232 static char oid1[] = "1.2.3";
5233 static char oid2[] = "1.5.6";
5234 BOOL ret;
5235 BYTE *buf = NULL;
5236 DWORD size = 0;
5237 CERT_ACCESS_DESCRIPTION accessDescription[2];
5239
5240 memset(accessDescription, 0, sizeof(accessDescription));
5241 aia.cAccDescr = 0;
5242 aia.rgAccDescr = NULL;
5243 /* Having no access descriptions is allowed */
5244 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, &aia,
5246 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5247 if (ret)
5248 {
5249 ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
5250 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
5251 LocalFree(buf);
5252 buf = NULL;
5253 }
5254 /* It can't have an empty access method */
5255 aia.cAccDescr = 1;
5256 aia.rgAccDescr = accessDescription;
5257 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, &aia,
5259 ok(!ret && (GetLastError() == E_INVALIDARG ||
5260 GetLastError() == OSS_LIMITED /* Win9x */),
5261 "expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
5262 /* It can't have an empty location */
5263 accessDescription[0].pszAccessMethod = oid1;
5264 SetLastError(0xdeadbeef);
5265 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, &aia,
5268 "expected E_INVALIDARG, got %08x\n", GetLastError());
5269 accessDescription[0].AccessLocation.dwAltNameChoice = CERT_ALT_NAME_URL;
5270 U(accessDescription[0].AccessLocation).pwszURL = (LPWSTR)url;
5271 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, &aia,
5273 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5274 if (ret)
5275 {
5276 ok(size == sizeof(authorityInfoAccessWithUrl), "unexpected size %d\n",
5277 size);
5279 "unexpected value\n");
5280 LocalFree(buf);
5281 buf = NULL;
5282 }
5283 accessDescription[1].pszAccessMethod = oid2;
5284 accessDescription[1].AccessLocation.dwAltNameChoice =
5286 U(accessDescription[1].AccessLocation).IPAddress.cbData =
5287 sizeof(encodedIPAddr);
5288 U(accessDescription[1].AccessLocation).IPAddress.pbData =
5290 aia.cAccDescr = 2;
5291 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_INFO_ACCESS, &aia,
5293 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5294 if (ret)
5295 {
5297 "unexpected size %d\n", size);
5299 "unexpected value\n");
5300 LocalFree(buf);
5301 buf = NULL;
5302 }
5303}
#define OSS_LIMITED
Definition: winerror.h:3047

Referenced by START_TEST().

◆ test_encodeAuthorityKeyId()

static void test_encodeAuthorityKeyId ( DWORD  dwEncoding)
static

Definition at line 4928 of file encode.c.

4929{
4930 CERT_AUTHORITY_KEY_ID_INFO info = { { 0 } };
4931 BOOL ret;
4932 BYTE *buf = NULL;
4933 DWORD size = 0;
4934
4935 /* Test with empty id */
4936 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID, &info,
4938 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4939 if (ret)
4940 {
4941 ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
4942 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
4943 LocalFree(buf);
4944 }
4945 /* With just a key id */
4946 info.KeyId.cbData = sizeof(keyId);
4947 info.KeyId.pbData = keyId;
4948 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID, &info,
4950 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4951 if (ret)
4952 {
4953 ok(size == sizeof(authorityKeyIdWithId), "Unexpected size %d\n", size);
4954 ok(!memcmp(buf, authorityKeyIdWithId, size), "Unexpected value\n");
4955 LocalFree(buf);
4956 }
4957 /* With just an issuer */
4958 info.KeyId.cbData = 0;
4959 info.CertIssuer.cbData = sizeof(encodedCommonName);
4960 info.CertIssuer.pbData = (BYTE *)encodedCommonName;
4961 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID, &info,
4963 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4964 if (ret)
4965 {
4966 ok(size == sizeof(authorityKeyIdWithIssuer), "Unexpected size %d\n",
4967 size);
4968 ok(!memcmp(buf, authorityKeyIdWithIssuer, size), "Unexpected value\n");
4969 LocalFree(buf);
4970 }
4971 /* With just a serial number */
4972 info.CertIssuer.cbData = 0;
4973 info.CertSerialNumber.cbData = sizeof(serialNum);
4974 info.CertSerialNumber.pbData = (BYTE *)serialNum;
4975 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID, &info,
4977 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4978 if (ret)
4979 {
4980 ok(size == sizeof(authorityKeyIdWithSerial), "Unexpected size %d\n",
4981 size);
4982 ok(!memcmp(buf, authorityKeyIdWithSerial, size), "Unexpected value\n");
4983 LocalFree(buf);
4984 }
4985}

Referenced by START_TEST().

◆ test_encodeAuthorityKeyId2()

static void test_encodeAuthorityKeyId2 ( DWORD  dwEncoding)
static

Definition at line 5067 of file encode.c.

5068{
5070 CERT_ALT_NAME_ENTRY entry = { 0 };
5071 BOOL ret;
5072 BYTE *buf = NULL;
5073 DWORD size = 0;
5074
5075 /* Test with empty id */
5076 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2, &info,
5078 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5079 if (ret)
5080 {
5081 ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
5082 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
5083 LocalFree(buf);
5084 }
5085 /* With just a key id */
5086 info.KeyId.cbData = sizeof(keyId);
5087 info.KeyId.pbData = keyId;
5088 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2, &info,
5090 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5091 if (ret)
5092 {
5093 ok(size == sizeof(authorityKeyIdWithId), "Unexpected size %d\n",
5094 size);
5095 ok(!memcmp(buf, authorityKeyIdWithId, size), "Unexpected value\n");
5096 LocalFree(buf);
5097 }
5098 /* With a bogus issuer name */
5099 info.KeyId.cbData = 0;
5100 info.AuthorityCertIssuer.cAltEntry = 1;
5101 info.AuthorityCertIssuer.rgAltEntry = &entry;
5102 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2, &info,
5105 "Expected E_INVALIDARG, got %08x\n", GetLastError());
5106 /* With an issuer name */
5107 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
5108 U(entry).pwszURL = (LPWSTR)url;
5109 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2, &info,
5111 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5112 if (ret)
5113 {
5114 ok(size == sizeof(authorityKeyIdWithIssuerUrl), "Unexpected size %d\n",
5115 size);
5117 "Unexpected value\n");
5118 LocalFree(buf);
5119 }
5120 /* With just a serial number */
5121 info.AuthorityCertIssuer.cAltEntry = 0;
5122 info.AuthorityCertSerialNumber.cbData = sizeof(serialNum);
5123 info.AuthorityCertSerialNumber.pbData = (BYTE *)serialNum;
5124 ret = pCryptEncodeObjectEx(dwEncoding, X509_AUTHORITY_KEY_ID2, &info,
5126 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
5127 if (ret)
5128 {
5129 ok(size == sizeof(authorityKeyIdWithSerial), "Unexpected size %d\n",
5130 size);
5131 ok(!memcmp(buf, authorityKeyIdWithSerial, size), "Unexpected value\n");
5132 LocalFree(buf);
5133 }
5134}

Referenced by START_TEST().

◆ test_encodeBasicConstraints()

static void test_encodeBasicConstraints ( DWORD  dwEncoding)
static

Definition at line 2242 of file encode.c.

2243{
2244 DWORD i, bufSize = 0;
2246 CERT_NAME_BLOB nameBlob = { sizeof(encodedDomainName),
2248 BOOL ret;
2249 BYTE *buf = NULL;
2250
2251 /* First test with the simpler info2 */
2252 for (i = 0; i < ARRAY_SIZE(constraints2); i++)
2253 {
2254 ret = pCryptEncodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS2,
2256 &bufSize);
2257 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2258 if (ret)
2259 {
2260 ok(bufSize == constraints2[i].encoded[1] + 2,
2261 "Expected %d bytes, got %d\n", constraints2[i].encoded[1] + 2,
2262 bufSize);
2263 ok(!memcmp(buf, constraints2[i].encoded,
2264 constraints2[i].encoded[1] + 2), "Unexpected value\n");
2265 LocalFree(buf);
2266 }
2267 }
2268 /* Now test with more complex basic constraints */
2269 info.SubjectType.cbData = 0;
2270 info.fPathLenConstraint = FALSE;
2271 info.cSubtreesConstraint = 0;
2272 ret = pCryptEncodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS, &info,
2274 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
2275 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2276 if (ret)
2277 {
2278 ok(bufSize == sizeof(emptyConstraint), "Wrong size %d\n", bufSize);
2280 "Unexpected value\n");
2281 LocalFree(buf);
2282 }
2283 /* None of the certs I examined had any subtree constraint, but I test one
2284 * anyway just in case.
2285 */
2286 info.cSubtreesConstraint = 1;
2287 info.rgSubtreesConstraint = &nameBlob;
2288 ret = pCryptEncodeObjectEx(dwEncoding, X509_BASIC_CONSTRAINTS, &info,
2290 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
2291 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2292 if (ret)
2293 {
2294 ok(bufSize == sizeof(constraintWithDomainName), "Wrong size %d\n", bufSize);
2296 sizeof(constraintWithDomainName)), "Unexpected value\n");
2297 LocalFree(buf);
2298 }
2299 /* FIXME: test encoding with subject type. */
2300}
#define OSS_BAD_PTR
Definition: winerror.h:3048

Referenced by START_TEST().

◆ test_encodeBits()

static void test_encodeBits ( DWORD  dwEncoding)
static

Definition at line 2126 of file encode.c.

2127{
2128 DWORD i;
2129
2130 for (i = 0; i < ARRAY_SIZE(bits); i++)
2131 {
2133 BOOL ret;
2134 BYTE *buf = NULL;
2135 DWORD bufSize = 0;
2136
2137 blob.cbData = sizeof(bytesToEncode);
2138 blob.pbData = (BYTE *)bytesToEncode;
2139 blob.cUnusedBits = bits[i].cUnusedBits;
2140 ret = pCryptEncodeObjectEx(dwEncoding, X509_BITS, &blob,
2142 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2143 if (ret)
2144 {
2145 ok(bufSize == bits[i].encoded[1] + 2,
2146 "%d: Got unexpected size %d, expected %d\n", i, bufSize,
2147 bits[i].encoded[1] + 2);
2148 ok(!memcmp(buf, bits[i].encoded, bits[i].encoded[1] + 2),
2149 "%d: Unexpected value\n", i);
2150 LocalFree(buf);
2151 }
2152 }
2153}
static const BYTE bytesToEncode[]
Definition: encode.c:2101

Referenced by START_TEST().

◆ test_encodeCert()

static void test_encodeCert ( DWORD  dwEncoding)
static

Definition at line 3440 of file encode.c.

3441{
3442 /* Note the SignatureAlgorithm must match that in the encoded cert. Note
3443 * also that bigCert is a NULL-terminated string, so don't count its
3444 * last byte (otherwise the signed cert won't decode.)
3445 */
3446 CERT_SIGNED_CONTENT_INFO info = { { sizeof(bigCert), (BYTE *)bigCert },
3447 { NULL, { 0, NULL } }, { sizeof(hash), (BYTE *)hash, 0 } };
3448 BOOL ret;
3449 BYTE *buf = NULL;
3450 DWORD bufSize = 0;
3451
3452 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT, &info,
3454 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3455 if (ret)
3456 {
3457 ok(bufSize == sizeof(signedBigCert), "Wrong size %d\n", bufSize);
3458 ok(!memcmp(buf, signedBigCert, bufSize), "Unexpected cert\n");
3459 LocalFree(buf);
3460 }
3461}
static const BYTE hash[]
Definition: encode.c:3365

Referenced by START_TEST().

◆ test_encodeCertPolicies()

static void test_encodeCertPolicies ( DWORD  dwEncoding)
static

Definition at line 7594 of file encode.c.

7595{
7596 BOOL ret;
7600 LPBYTE buf;
7601 DWORD size;
7602
7603 memset(&info, 0, sizeof(info));
7604 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
7606 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7607 if (ret)
7608 {
7609 ok(sizeof(emptySequence) == size, "unexpected size %d\n", size);
7610 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
7611 LocalFree(buf);
7612 }
7613 memset(policy, 0, sizeof(policy));
7614 info.cPolicyInfo = 1;
7615 info.rgPolicyInfo = policy;
7616 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
7618 ok(!ret && (GetLastError() == E_INVALIDARG ||
7619 GetLastError() == OSS_LIMITED /* Win9x/NT4 */),
7620 "expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
7621 policy[0].pszPolicyIdentifier = oid_any_policy;
7622 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
7624 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7625 if (ret)
7626 {
7627 ok(sizeof(policiesWithAnyPolicy) == size, "unexpected size %d\n", size);
7628 ok(!memcmp(buf, policiesWithAnyPolicy, size), "unexpected value\n");
7629 LocalFree(buf);
7630 }
7631 policy[1].pszPolicyIdentifier = oid1;
7632 memset(&qualifier, 0, sizeof(qualifier));
7633 qualifier.pszPolicyQualifierId = oid_user_notice;
7634 qualifier.Qualifier.cbData = sizeof(noticeWithReference);
7635 qualifier.Qualifier.pbData = noticeWithReference;
7636 policy[1].cPolicyQualifier = 1;
7637 policy[1].rgPolicyQualifier = &qualifier;
7638 info.cPolicyInfo = 2;
7639 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
7641 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7642 if (ret)
7643 {
7644 ok(sizeof(twoPolicies) == size, "unexpected size %d\n", size);
7645 ok(!memcmp(buf, twoPolicies, size), "unexpected value\n");
7646 LocalFree(buf);
7647 }
7648}
WDF_INTERRUPT_POLICY policy
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:79

Referenced by START_TEST().

◆ test_encodeCertPolicyConstraints()

static void test_encodeCertPolicyConstraints ( DWORD  dwEncoding)
static

Definition at line 7892 of file encode.c.

7893{
7895 LPBYTE buf;
7896 DWORD size;
7897 BOOL ret;
7898
7899 /* Even though RFC 5280 explicitly states CAs must not issue empty
7900 * policy constraints (section 4.2.1.11), the API doesn't prevent it.
7901 */
7902 ret = pCryptEncodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS, &info,
7905 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7907 {
7908 win_skip("no policy constraints support\n");
7909 return;
7910 }
7911 if (ret)
7912 {
7913 ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
7915 "unexpected value\n");
7916 LocalFree(buf);
7917 }
7918 /* If fRequireExplicitPolicy is set but dwRequireExplicitPolicySkipCerts
7919 * is not, then a skip of 0 is encoded.
7920 */
7921 info.fRequireExplicitPolicy = TRUE;
7922 ret = pCryptEncodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS, &info,
7924 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7925 if (ret)
7926 {
7928 "unexpected size %d\n", size);
7930 sizeof(policyConstraintsWithRequireExplicit)), "unexpected value\n");
7931 LocalFree(buf);
7932 }
7933 /* With inhibit policy mapping */
7934 info.fRequireExplicitPolicy = FALSE;
7935 info.dwRequireExplicitPolicySkipCerts = 0;
7936 info.fInhibitPolicyMapping = TRUE;
7937 info.dwInhibitPolicyMappingSkipCerts = 1;
7938 ret = pCryptEncodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS, &info,
7940 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7941 if (ret)
7942 {
7944 "unexpected size %d\n", size);
7946 sizeof(policyConstraintsWithInhibitMapping)), "unexpected value\n");
7947 LocalFree(buf);
7948 }
7949 /* And with both */
7950 info.fRequireExplicitPolicy = TRUE;
7951 info.dwRequireExplicitPolicySkipCerts = 1;
7952 ret = pCryptEncodeObjectEx(dwEncoding, X509_POLICY_CONSTRAINTS, &info,
7954 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7955 if (ret)
7956 {
7957 ok(size == sizeof(policyConstraintsWithBoth), "unexpected size %d\n",
7958 size);
7960 sizeof(policyConstraintsWithBoth)), "unexpected value\n");
7961 LocalFree(buf);
7962 }
7963}

Referenced by START_TEST().

◆ test_encodeCertPolicyMappings()

static void test_encodeCertPolicyMappings ( DWORD  dwEncoding)
static

Definition at line 7736 of file encode.c.

7737{
7738 static char oid2[] = "2.3.4";
7739 static char oid3[] = "1.3.4";
7740 static char oid4[] = "2.5.6";
7741 BOOL ret;
7744 LPBYTE buf;
7745 DWORD size, i;
7746
7747 /* Each of the mapping OIDs is equivalent, so check with all of them */
7748 for (i = 0; i < ARRAY_SIZE(mappingOids); i++)
7749 {
7750 memset(&info, 0, sizeof(info));
7751 ret = pCryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7754 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7756 {
7757 win_skip("no policy mappings support\n");
7758 return;
7759 }
7760 if (ret)
7761 {
7762 ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
7764 "unexpected value\n");
7765 LocalFree(buf);
7766 }
7767 mapping[0].pszIssuerDomainPolicy = NULL;
7768 mapping[0].pszSubjectDomainPolicy = NULL;
7769 info.cPolicyMapping = 1;
7770 info.rgPolicyMapping = mapping;
7771 SetLastError(0xdeadbeef);
7772 ret = pCryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7775 "expected E_INVALIDARG, got %08x\n", GetLastError());
7776 mapping[0].pszIssuerDomainPolicy = oid1;
7777 mapping[0].pszSubjectDomainPolicy = oid2;
7778 ret = pCryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7780 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7781 if (ret)
7782 {
7784 "unexpected size %d\n", size);
7786 "unexpected value\n");
7787 LocalFree(buf);
7788 }
7789 mapping[1].pszIssuerDomainPolicy = oid3;
7790 mapping[1].pszSubjectDomainPolicy = oid4;
7791 info.cPolicyMapping = 2;
7792 ret = pCryptEncodeObjectEx(dwEncoding, mappingOids[i], &info,
7794 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7795 if (ret)
7796 {
7798 "unexpected size %d\n", size);
7800 "unexpected value\n");
7801 LocalFree(buf);
7802 }
7803 }
7804}
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 3051 of file encode.c.

3052{
3053 BOOL ret;
3054 BYTE *buf = NULL;
3055 DWORD size = 0;
3056 CERT_INFO info = { 0 };
3057 static char oid_rsa_rsa[] = szOID_RSA_RSA;
3058 static char oid_subject_key_identifier[] = szOID_SUBJECT_KEY_IDENTIFIER;
3060
3061 if (0)
3062 {
3063 /* Test with NULL pvStructInfo (crashes on win9x) */
3064 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, NULL,
3067 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
3068 }
3069 /* Test with a V1 cert */
3070 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3072 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
3073 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3074 if (ret)
3075 {
3076 ok(size == v1Cert[1] + 2, "Expected size %d, got %d\n",
3077 v1Cert[1] + 2, size);
3078 ok(!memcmp(buf, v1Cert, size), "Got unexpected value\n");
3079 LocalFree(buf);
3080 }
3081 /* Test v2 cert */
3082 info.dwVersion = CERT_V2;
3083 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3085 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
3086 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3087 if (ret)
3088 {
3089 ok(size == sizeof(v2Cert), "Wrong size %d\n", size);
3090 ok(!memcmp(buf, v2Cert, size), "Got unexpected value\n");
3091 LocalFree(buf);
3092 }
3093 /* Test v3 cert */
3094 info.dwVersion = CERT_V3;
3095 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3097 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
3098 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3099 if (ret)
3100 {
3101 ok(size == sizeof(v3Cert), "Wrong size %d\n", size);
3102 ok(!memcmp(buf, v3Cert, size), "Got unexpected value\n");
3103 LocalFree(buf);
3104 }
3105 /* A v4 cert? */
3106 info.dwVersion = 3; /* Not a typo, CERT_V3 is 2 */
3107 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3109 if (ret)
3110 {
3111 ok(size == sizeof(v4Cert), "Wrong size %d\n", size);
3112 ok(!memcmp(buf, v4Cert, size), "Unexpected value\n");
3113 LocalFree(buf);
3114 }
3115 /* see if a V1 cert can have basic constraints set (RFC3280 says no, but
3116 * API doesn't prevent it)
3117 */
3118 info.dwVersion = CERT_V1;
3119 info.cExtension = 1;
3120 info.rgExtension = &criticalExt;
3121 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3123 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
3124 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3125 if (ret)
3126 {
3127 ok(size == sizeof(v1CertWithConstraints), "Wrong size %d\n", size);
3128 ok(!memcmp(buf, v1CertWithConstraints, size), "Got unexpected value\n");
3129 LocalFree(buf);
3130 }
3131 /* test v1 cert with a serial number */
3132 info.SerialNumber.cbData = sizeof(serialNum);
3133 info.SerialNumber.pbData = (BYTE *)serialNum;
3134 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3136 if (ret)
3137 {
3138 ok(size == sizeof(v1CertWithSerial), "Wrong size %d\n", size);
3139 ok(!memcmp(buf, v1CertWithSerial, size), "Got unexpected value\n");
3140 LocalFree(buf);
3141 }
3142 /* Test v1 cert with an issuer name, serial number, and issuer unique id */
3143 info.dwVersion = CERT_V1;
3144 info.cExtension = 0;
3145 info.IssuerUniqueId.cbData = sizeof(serialNum);
3146 info.IssuerUniqueId.pbData = (BYTE *)serialNum;
3147 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3149 ok(ret || broken(GetLastError() == OSS_BAD_PTR /* Win98 */),
3150 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3151 if (ret)
3152 {
3153 ok(size == sizeof(v1CertWithIssuerUniqueId), "Wrong size %d\n", size);
3155 "Got unexpected value\n");
3156 LocalFree(buf);
3157 }
3158 /* Test v1 cert with an issuer name, a subject name, and a serial number */
3159 info.IssuerUniqueId.cbData = 0;
3160 info.IssuerUniqueId.pbData = NULL;
3161 info.cExtension = 1;
3162 info.rgExtension = &criticalExt;
3163 info.Issuer.cbData = sizeof(encodedCommonName);
3164 info.Issuer.pbData = (BYTE *)encodedCommonName;
3165 info.Subject.cbData = sizeof(encodedCommonName);
3166 info.Subject.pbData = (BYTE *)encodedCommonName;
3167 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3169 if (ret)
3170 {
3171 ok(size == sizeof(bigCert), "Wrong size %d\n", size);
3172 ok(!memcmp(buf, bigCert, size), "Got unexpected value\n");
3173 LocalFree(buf);
3174 }
3175 /* Add a public key */
3176 info.SubjectPublicKeyInfo.Algorithm.pszObjId = oid_rsa_rsa;
3177 info.SubjectPublicKeyInfo.PublicKey.cbData = sizeof(aKey);
3178 info.SubjectPublicKeyInfo.PublicKey.pbData = (LPBYTE)aKey;
3179 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3181 if (ret)
3182 {
3183 ok(size == sizeof(v1CertWithPubKey) ||
3184 size == sizeof(v1CertWithPubKeyNoNull), "Wrong size %d\n", size);
3185 if (size == sizeof(v1CertWithPubKey))
3186 ok(!memcmp(buf, v1CertWithPubKey, size), "Got unexpected value\n");
3187 else if (size == sizeof(v1CertWithPubKeyNoNull))
3189 "Got unexpected value\n");
3190 LocalFree(buf);
3191 }
3192 /* Again add an issuer unique id */
3193 info.IssuerUniqueId.cbData = sizeof(serialNum);
3194 info.IssuerUniqueId.pbData = (BYTE *)serialNum;
3195 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3197 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3198 if (ret)
3199 {
3202 "Wrong size %d\n", size);
3205 size), "unexpected value\n");
3206 else if (size ==
3208 ok(!memcmp(buf,
3210 "unexpected value\n");
3211 LocalFree(buf);
3212 }
3213 /* Remove the public key, and add a subject key identifier extension */
3214 info.IssuerUniqueId.cbData = 0;
3215 info.IssuerUniqueId.pbData = NULL;
3216 info.SubjectPublicKeyInfo.Algorithm.pszObjId = NULL;
3217 info.SubjectPublicKeyInfo.PublicKey.cbData = 0;
3218 info.SubjectPublicKeyInfo.PublicKey.pbData = NULL;
3219 ext.pszObjId = oid_subject_key_identifier;
3220 ext.fCritical = FALSE;
3221 ext.Value.cbData = sizeof(octetCommonNameValue);
3222 ext.Value.pbData = octetCommonNameValue;
3223 info.cExtension = 1;
3224 info.rgExtension = &ext;
3225 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, &info,
3227 if (ret)
3228 {
3229 ok(size == sizeof(v1CertWithSubjectKeyId), "Wrong size %d\n", size);
3230 ok(!memcmp(buf, v1CertWithSubjectKeyId, size), "Unexpected value\n");
3231 LocalFree(buf);
3232 }
3233}
static const BYTE v1CertWithPubKeyNoNull[]
Definition: encode.c:2998
static CERT_EXTENSION criticalExt
Definition: encode.c:2688
static const BYTE v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull[]
Definition: encode.c:3036
static BYTE octetCommonNameValue[]
Definition: encode.c:1246
#define CERT_V3
Definition: wincrypt.h:2658
#define szOID_SUBJECT_KEY_IDENTIFIER
Definition: wincrypt.h:3184
#define CERT_V2
Definition: wincrypt.h:2657

Referenced by START_TEST().

◆ test_encodeCMSSignerInfo()

static void test_encodeCMSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6891 of file encode.c.

6892{
6893 BOOL ret;
6894 LPBYTE buf = NULL;
6895 DWORD size = 0;
6896 CMSG_CMS_SIGNER_INFO info = { 0 };
6897 static char oid1[] = "1.2.3", oid2[] = "1.5.6";
6898
6899 SetLastError(0xdeadbeef);
6900 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6902 ok(!ret, "Expected failure, got %d\n", ret);
6904 {
6905 skip("no CMS_SIGNER_INFO encode support\n");
6906 return;
6907 }
6909 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6910 info.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
6911 SetLastError(0xdeadbeef);
6912 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6914 ok(!ret, "Expected failure, got %d\n", ret);
6916 {
6917 skip("no CMS_SIGNER_INFO encode support\n");
6918 return;
6919 }
6921 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6922 /* To be encoded, a signer must have a valid cert ID, where a valid ID may
6923 * be a key id or an issuer serial number with at least the issuer set, and
6924 * the encoding must include PKCS_7_ASN_ENCODING.
6925 * (That isn't enough to be decoded, see decoding tests.)
6926 */
6927 U(info.SignerId).IssuerSerialNumber.Issuer.cbData =
6929 U(info.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonNameNoNull;
6930 SetLastError(0xdeadbeef);
6931 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6933 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6935 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6936 else
6937 {
6938 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6939 if (ret)
6940 {
6941 ok(size == sizeof(minimalPKCSSigner), "Unexpected size %d\n", size);
6942 ok(!memcmp(buf, minimalPKCSSigner, size), "Unexpected value\n");
6943 LocalFree(buf);
6944 }
6945 }
6946 U(info.SignerId).IssuerSerialNumber.SerialNumber.cbData = sizeof(serialNum);
6947 U(info.SignerId).IssuerSerialNumber.SerialNumber.pbData = (BYTE *)serialNum;
6948 SetLastError(0xdeadbeef);
6949 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6951 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6953 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6954 else
6955 {
6956 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6957 if (ret)
6958 {
6959 ok(size == sizeof(PKCSSignerWithSerial), "Unexpected size %d\n",
6960 size);
6961 ok(!memcmp(buf, PKCSSignerWithSerial, size), "Unexpected value\n");
6962 LocalFree(buf);
6963 }
6964 }
6965 info.SignerId.dwIdChoice = CERT_ID_KEY_IDENTIFIER;
6966 U(info.SignerId).KeyId.cbData = sizeof(serialNum);
6967 U(info.SignerId).KeyId.pbData = (BYTE *)serialNum;
6968 SetLastError(0xdeadbeef);
6969 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6971 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6973 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6974 else
6975 {
6976 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6977 if (ret)
6978 {
6979 ok(size == sizeof(CMSSignerWithKeyId), "Unexpected size %d\n",
6980 size);
6981 ok(!memcmp(buf, CMSSignerWithKeyId, size), "Unexpected value\n");
6982 LocalFree(buf);
6983 }
6984 }
6985 /* While a CERT_ID can have a hash type, that's not allowed in CMS, where
6986 * only the IssuerAndSerialNumber and SubjectKeyIdentifier types are allowed
6987 * (see RFC 3852, section 5.3.)
6988 */
6989 info.SignerId.dwIdChoice = CERT_ID_SHA1_HASH;
6990 U(info.SignerId).HashId.cbData = sizeof(hash);
6991 U(info.SignerId).HashId.pbData = (BYTE *)hash;
6992 SetLastError(0xdeadbeef);
6993 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
6996 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6997 /* Now with a hash algo */
6998 info.SignerId.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
6999 U(info.SignerId).IssuerSerialNumber.Issuer.cbData =
7001 U(info.SignerId).IssuerSerialNumber.Issuer.pbData = encodedCommonNameNoNull;
7002 info.HashAlgorithm.pszObjId = oid1;
7003 SetLastError(0xdeadbeef);
7004 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
7006 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
7008 "Expected E_INVALIDARG, got %08x\n", GetLastError());
7009 else
7010 {
7011 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
7012 if (ret)
7013 {
7014 ok(size == sizeof(PKCSSignerWithHashAlgo), "Unexpected size %d\n",
7015 size);
7017 "Unexpected value\n");
7018 LocalFree(buf);
7019 }
7020 }
7021 info.HashEncryptionAlgorithm.pszObjId = oid2;
7022 SetLastError(0xdeadbeef);
7023 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
7025 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
7027 "Expected E_INVALIDARG, got %08x\n", GetLastError());
7028 else
7029 {
7030 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
7031 if (ret)
7032 {
7034 "Unexpected size %d\n", size);
7036 "Unexpected value\n");
7037 LocalFree(buf);
7038 }
7039 }
7040 info.EncryptedHash.cbData = sizeof(hash);
7041 info.EncryptedHash.pbData = (BYTE *)hash;
7042 SetLastError(0xdeadbeef);
7043 ret = pCryptEncodeObjectEx(dwEncoding, CMS_SIGNER_INFO, &info,
7045 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
7047 "Expected E_INVALIDARG, got %08x\n", GetLastError());
7048 else
7049 {
7050 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
7051 if (ret)
7052 {
7053 ok(size == sizeof(PKCSSignerWithHash), "Unexpected size %d\n",
7054 size);
7055 ok(!memcmp(buf, PKCSSignerWithHash, size), "Unexpected value\n");
7056 LocalFree(buf);
7057 }
7058 }
7059}
#define CERT_ID_SHA1_HASH
Definition: wincrypt.h:3675

Referenced by START_TEST().

◆ test_encodeCRLDistPoints()

static void test_encodeCRLDistPoints ( DWORD  dwEncoding)
static

Definition at line 3552 of file encode.c.

3553{
3554 CRL_DIST_POINTS_INFO info = { 0 };
3555 CRL_DIST_POINT point = { { 0 } };
3556 CERT_ALT_NAME_ENTRY entry = { 0 };
3557 BOOL ret;
3558 BYTE *buf = NULL;
3559 DWORD size = 0;
3560
3561 /* Test with an empty info */
3562 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3565 "Expected E_INVALIDARG, got %08x\n", GetLastError());
3566 /* Test with one empty dist point */
3567 info.cDistPoint = 1;
3568 info.rgDistPoint = &point;
3569 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3571 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3572 if (ret)
3573 {
3574 ok(size == sizeof(emptyDistPoint), "Wrong size %d\n", size);
3575 ok(!memcmp(buf, emptyDistPoint, size), "Unexpected value\n");
3576 LocalFree(buf);
3577 }
3578 /* A dist point with an invalid name */
3579 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3580 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3581 U(entry).pwszURL = (LPWSTR)nihongoURL;
3582 U(point.DistPointName).FullName.cAltEntry = 1;
3583 U(point.DistPointName).FullName.rgAltEntry = &entry;
3584 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3587 "Expected CRYPT_E_INVALID_IA5_STRING, got %08x\n", GetLastError());
3588 /* The first invalid character is at index 7 */
3590 "Expected invalid char at index 7, got %d\n",
3592 /* A dist point with (just) a valid name */
3593 U(entry).pwszURL = (LPWSTR)url;
3594 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3596 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3597 if (ret)
3598 {
3599 ok(size == sizeof(distPointWithUrl), "Wrong size %d\n", size);
3600 ok(!memcmp(buf, distPointWithUrl, size), "Unexpected value\n");
3601 LocalFree(buf);
3602 }
3603 /* A dist point with (just) reason flags */
3604 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_NO_NAME;
3605 point.ReasonFlags.cbData = sizeof(crlReason);
3606 point.ReasonFlags.pbData = (LPBYTE)&crlReason;
3607 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3609 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3610 if (ret)
3611 {
3612 ok(size == sizeof(distPointWithReason), "Wrong size %d\n", size);
3613 ok(!memcmp(buf, distPointWithReason, size), "Unexpected value\n");
3614 LocalFree(buf);
3615 }
3616 /* A dist point with just an issuer */
3617 point.ReasonFlags.cbData = 0;
3618 point.CRLIssuer.cAltEntry = 1;
3619 point.CRLIssuer.rgAltEntry = &entry;
3620 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3622 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3623 if (ret)
3624 {
3625 ok(size == sizeof(distPointWithIssuer), "Wrong size %d\n", size);
3626 ok(!memcmp(buf, distPointWithIssuer, size), "Unexpected value\n");
3627 LocalFree(buf);
3628 }
3629 /* A dist point with both a name and an issuer */
3630 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3631 ret = pCryptEncodeObjectEx(dwEncoding, X509_CRL_DIST_POINTS, &info,
3633 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3634 if (ret)
3635 {
3637 "Wrong size %d\n", size);
3638 ok(!memcmp(buf, distPointWithUrlAndIssuer, size), "Unexpected value\n");
3639 LocalFree(buf);
3640 }
3641}
static const BYTE distPointWithIssuer[]
Definition: encode.c:3541

Referenced by START_TEST().

◆ test_encodeCRLIssuingDistPoint()

static void test_encodeCRLIssuingDistPoint ( DWORD  dwEncoding)
static

Definition at line 3774 of file encode.c.

3775{
3776 BOOL ret;
3777 BYTE *buf = NULL;
3778 DWORD size = 0;
3779 CRL_ISSUING_DIST_POINT point = { { 0 } };
3781
3782 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, NULL,
3785 {
3786 skip("no X509_ISSUING_DIST_POINT encode support\n");
3787 return;
3788 }
3790 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
3791 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, &point,
3793 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3794 if (ret)
3795 {
3796 ok(size == sizeof(emptySequence), "Unexpected size %d\n", size);
3797 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
3798 LocalFree(buf);
3799 }
3800 /* nonsensical flags */
3801 point.fOnlyContainsUserCerts = TRUE;
3802 point.fOnlyContainsCACerts = TRUE;
3803 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, &point,
3805 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3806 if (ret)
3807 {
3808 ok(size == sizeof(badFlagsIDP), "Unexpected size %d\n", size);
3809 ok(!memcmp(buf, badFlagsIDP, size), "Unexpected value\n");
3810 LocalFree(buf);
3811 }
3812 /* unimplemented name type */
3813 point.fOnlyContainsCACerts = point.fOnlyContainsUserCerts = FALSE;
3814 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_ISSUER_RDN_NAME;
3815 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, &point,
3818 "Expected E_INVALIDARG, got %08x\n", GetLastError());
3819 /* empty name */
3820 point.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME;
3821 U(point.DistPointName).FullName.cAltEntry = 0;
3822 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, &point,
3824 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3825 if (ret)
3826 {
3827 ok(size == sizeof(emptyNameIDP), "Unexpected size %d\n", size);
3828 ok(!memcmp(buf, emptyNameIDP, size), "Unexpected value\n");
3829 LocalFree(buf);
3830 }
3831 /* name with URL entry */
3832 entry.dwAltNameChoice = CERT_ALT_NAME_URL;
3833 U(entry).pwszURL = (LPWSTR)url;
3834 U(point.DistPointName).FullName.cAltEntry = 1;
3835 U(point.DistPointName).FullName.rgAltEntry = &entry;
3836 ret = pCryptEncodeObjectEx(dwEncoding, X509_ISSUING_DIST_POINT, &point,
3838 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
3839 if (ret)
3840 {
3841 ok(size == sizeof(urlIDP), "Unexpected size %d\n", size);
3842 ok(!memcmp(buf, urlIDP, size), "Unexpected value\n");
3843 LocalFree(buf);
3844 }
3845}
#define CRL_DIST_POINT_ISSUER_RDN_NAME
Definition: wincrypt.h:515

Referenced by START_TEST().

◆ test_encodeCRLToBeSigned()

static void test_encodeCRLToBeSigned ( DWORD  dwEncoding)
static

Definition at line 4018 of file encode.c.

4019{
4020 BOOL ret;
4021 BYTE *buf = NULL;
4022 DWORD size = 0;
4023 CRL_INFO info = { 0 };
4024 CRL_ENTRY entry = { { 0 }, { 0 }, 0, 0 };
4025
4026 /* Test with a V1 CRL */
4027 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4029 ok(ret || broken(GetLastError() == OSS_DATA_ERROR /* Win9x */),
4030 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4031 if (ret)
4032 {
4033 ok(size == sizeof(v1CRL), "Wrong size %d\n", size);
4034 ok(!memcmp(buf, v1CRL, size), "Got unexpected value\n");
4035 LocalFree(buf);
4036 }
4037 /* Test v2 CRL */
4038 info.dwVersion = CRL_V2;
4039 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4041 ok(ret || broken(GetLastError() == OSS_DATA_ERROR /* Win9x */),
4042 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4043 if (ret)
4044 {
4045 ok(size == v2CRL[1] + 2, "Expected size %d, got %d\n",
4046 v2CRL[1] + 2, size);
4047 ok(!memcmp(buf, v2CRL, size), "Got unexpected value\n");
4048 LocalFree(buf);
4049 }
4050 /* v1 CRL with a name */
4051 info.dwVersion = CRL_V1;
4052 info.Issuer.cbData = sizeof(encodedCommonName);
4053 info.Issuer.pbData = (BYTE *)encodedCommonName;
4054 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4056 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4057 if (ret)
4058 {
4059 ok(size == sizeof(v1CRLWithIssuer), "Wrong size %d\n", size);
4060 ok(!memcmp(buf, v1CRLWithIssuer, size), "Got unexpected value\n");
4061 LocalFree(buf);
4062 }
4063 if (0)
4064 {
4065 /* v1 CRL with a name and a NULL entry pointer (crashes on win9x) */
4066 info.cCRLEntry = 1;
4067 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4070 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
4071 }
4072 /* now set an empty entry */
4073 info.cCRLEntry = 1;
4074 info.rgCRLEntry = &entry;
4075 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4077 if (ret)
4078 {
4080 "Wrong size %d\n", size);
4082 "Got unexpected value\n");
4083 LocalFree(buf);
4084 }
4085 /* an entry with a serial number */
4086 entry.SerialNumber.cbData = sizeof(serialNum);
4087 entry.SerialNumber.pbData = (BYTE *)serialNum;
4088 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4090 if (ret)
4091 {
4092 ok(size == sizeof(v1CRLWithIssuerAndEntry),
4093 "Wrong size %d\n", size);
4095 "Got unexpected value\n");
4096 LocalFree(buf);
4097 }
4098 /* an entry with an extension */
4099 entry.cExtension = 1;
4100 entry.rgExtension = &criticalExt;
4101 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4103 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4104 if (ret)
4105 {
4106 ok(size == sizeof(v1CRLWithEntryExt), "Wrong size %d\n", size);
4107 ok(!memcmp(buf, v1CRLWithEntryExt, size), "Got unexpected value\n");
4108 LocalFree(buf);
4109 }
4110 /* a CRL with an extension */
4111 entry.cExtension = 0;
4112 info.cExtension = 1;
4113 info.rgExtension = &criticalExt;
4114 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4116 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4117 if (ret)
4118 {
4119 ok(size == sizeof(v1CRLWithExt), "Wrong size %d\n", size);
4120 ok(!memcmp(buf, v1CRLWithExt, size), "Got unexpected value\n");
4121 LocalFree(buf);
4122 }
4123 /* a v2 CRL with an extension, this time non-critical */
4124 info.dwVersion = CRL_V2;
4125 info.rgExtension = &nonCriticalExt;
4126 ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_CRL_TO_BE_SIGNED, &info,
4128 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4129 if (ret)
4130 {
4131 ok(size == sizeof(v2CRLWithExt), "Wrong size %d\n", size);
4132 ok(!memcmp(buf, v2CRLWithExt, size), "Got unexpected value\n");
4133 LocalFree(buf);
4134 }
4135}
static CERT_EXTENSION nonCriticalExt
Definition: encode.c:2690
static const BYTE v1CRLWithEntryExt[]
Definition: encode.c:3996
#define CRL_V2
Definition: wincrypt.h:2679
#define CRL_V1
Definition: wincrypt.h:2678

Referenced by START_TEST().

◆ test_encodeCTL()

static void test_encodeCTL ( DWORD  dwEncoding)
static

Definition at line 5447 of file encode.c.

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

Referenced by START_TEST().

◆ test_encodeEnhancedKeyUsage()

static void test_encodeEnhancedKeyUsage ( DWORD  dwEncoding)
static

Definition at line 4836 of file encode.c.

4837{
4838 BOOL ret;
4839 BYTE *buf = NULL;
4840 DWORD size = 0;
4842
4843 /* Test with empty usage */
4844 usage.cUsageIdentifier = 0;
4845 ret = pCryptEncodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE, &usage,
4847 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4848 if (ret)
4849 {
4850 ok(size == sizeof(emptySequence), "Wrong size %d\n", size);
4851 ok(!memcmp(buf, emptySequence, size), "Got unexpected value\n");
4852 LocalFree(buf);
4853 }
4854 /* Test with a few usages */
4855 usage.cUsageIdentifier = ARRAY_SIZE(keyUsages);
4856 usage.rgpszUsageIdentifier = (LPSTR *)keyUsages;
4857 ret = pCryptEncodeObjectEx(dwEncoding, X509_ENHANCED_KEY_USAGE, &usage,
4859 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
4860 if (ret)
4861 {
4862 ok(size == sizeof(encodedUsage), "Wrong size %d\n", size);
4863 ok(!memcmp(buf, encodedUsage, size), "Got unexpected value\n");
4864 LocalFree(buf);
4865 }
4866}
char * LPSTR
Definition: xmlstorage.h:182

Referenced by START_TEST().

◆ test_encodeEnumerated()

static void test_encodeEnumerated ( DWORD  dwEncoding)
static

Definition at line 376 of file encode.c.

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

Referenced by START_TEST().

◆ test_encodeExtensions()

static void test_encodeExtensions ( DWORD  dwEncoding)
static

Definition at line 2710 of file encode.c.

2711{
2712 DWORD i;
2713
2714 for (i = 0; i < ARRAY_SIZE(exts); i++)
2715 {
2716 BOOL ret;
2717 BYTE *buf = NULL;
2718 DWORD bufSize = 0;
2719
2720 ret = pCryptEncodeObjectEx(dwEncoding, X509_EXTENSIONS, &exts[i].exts,
2722 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2723 if (ret)
2724 {
2725 ok(bufSize == exts[i].encoded[1] + 2,
2726 "Expected %d bytes, got %d\n", exts[i].encoded[1] + 2, bufSize);
2727 ok(!memcmp(buf, exts[i].encoded, exts[i].encoded[1] + 2),
2728 "Unexpected value\n");
2729 LocalFree(buf);
2730 }
2731 }
2732}

Referenced by START_TEST().

◆ test_encodeFiletime()

static void test_encodeFiletime ( DWORD  dwEncoding)
static

Definition at line 562 of file encode.c.

563{
564 DWORD i;
565
566 for (i = 0; i < ARRAY_SIZE(times); i++)
567 {
569 testTimeEncoding(dwEncoding, PKCS_UTC_TIME, &times[i]);
571 }
572}
static void testTimeEncoding(DWORD dwEncoding, LPCSTR structType, const struct encodedFiletime *time)
Definition: encode.c:439

Referenced by START_TEST().

◆ test_encodeInt()

static void test_encodeInt ( DWORD  dwEncoding)
static

Definition at line 89 of file encode.c.

90{
91 DWORD bufSize = 0;
92 int i;
93 BOOL ret;
95 BYTE *buf = NULL;
96
97 /* CryptEncodeObjectEx with NULL bufSize crashes..
98 ret = pCryptEncodeObjectEx(3, X509_INTEGER, &ints[0].val, 0, NULL, NULL,
99 NULL);
100 */
101 /* check bogus encoding */
102 ret = pCryptEncodeObjectEx(0, X509_INTEGER, &ints[0].val, 0, NULL, NULL,
103 &bufSize);
105 "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
106 if (0)
107 {
108 /* check with NULL integer buffer. Windows XP incorrectly returns an
109 * NTSTATUS (crashes on win9x).
110 */
111 ret = pCryptEncodeObjectEx(dwEncoding, X509_INTEGER, NULL, 0, NULL, NULL,
112 &bufSize);
114 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
115 }
116 for (i = 0; i < ARRAY_SIZE(ints); i++)
117 {
118 /* encode as normal integer */
119 ret = pCryptEncodeObjectEx(dwEncoding, X509_INTEGER, &ints[i].val, 0,
120 NULL, NULL, &bufSize);
121 ok(ret, "Expected success, got %d\n", GetLastError());
122 ret = pCryptEncodeObjectEx(dwEncoding, X509_INTEGER, &ints[i].val,
124 ok(ret, "CryptEncodeObjectEx failed: %d\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;
138 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, &blob,
139 0, NULL, NULL, &bufSize);
140 ok(ret, "Expected success, got %d\n", GetLastError());
141 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, &blob,
143 ok(ret, "CryptEncodeObjectEx failed: %d\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;
162 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, &blob,
163 0, NULL, NULL, &bufSize);
164 ok(ret, "Expected success, got %d\n", GetLastError());
165 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_INTEGER, &blob,
167 ok(ret, "CryptEncodeObjectEx failed: %d\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;
185 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_UINT, &blob,
186 0, NULL, NULL, &bufSize);
187 ok(ret, "Expected success, got %d\n", GetLastError());
188 ret = pCryptEncodeObjectEx(dwEncoding, X509_MULTI_BYTE_UINT, &blob,
190 ok(ret, "CryptEncodeObjectEx failed: %d\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 744 of file encode.c.

745{
746 CERT_RDN_ATTR attrs[2];
747 CERT_RDN rdn;
749 static CHAR oid_common_name[] = szOID_COMMON_NAME,
750 oid_sur_name[] = szOID_SUR_NAME;
751 BYTE *buf = NULL;
752 DWORD size = 0;
753 BOOL ret;
754
755 if (0)
756 {
757 /* Test with NULL pvStructInfo (crashes on win9x) */
758 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, NULL,
761 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
762 }
763 /* Test with empty CERT_NAME_INFO */
764 info.cRDN = 0;
765 info.rgRDN = NULL;
766 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
768 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
769 if (ret)
770 {
772 "Got unexpected encoding for empty name\n");
773 LocalFree(buf);
774 }
775 if (0)
776 {
777 /* Test with bogus CERT_RDN (crashes on win9x) */
778 info.cRDN = 1;
779 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
782 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
783 }
784 /* Test with empty CERT_RDN */
785 rdn.cRDNAttr = 0;
786 rdn.rgRDNAttr = NULL;
787 info.cRDN = 1;
788 info.rgRDN = &rdn;
789 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
791 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
792 if (ret)
793 {
794 ok(!memcmp(buf, emptyRDNs, sizeof(emptyRDNs)),
795 "Got unexpected encoding for empty RDN array\n");
796 LocalFree(buf);
797 }
798 if (0)
799 {
800 /* Test with bogus attr array (crashes on win9x) */
801 rdn.cRDNAttr = 1;
802 rdn.rgRDNAttr = NULL;
803 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
806 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
807 }
808 /* oddly, a bogus OID is accepted by Windows XP; not testing.
809 attrs[0].pszObjId = "bogus";
810 attrs[0].dwValueType = CERT_RDN_PRINTABLE_STRING;
811 attrs[0].Value.cbData = sizeof(commonName);
812 attrs[0].Value.pbData = commonName;
813 rdn.cRDNAttr = 1;
814 rdn.rgRDNAttr = attrs;
815 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
816 CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
817 ok(!ret, "Expected failure, got success\n");
818 */
819 /* Check with two CERT_RDN_ATTRs. Note DER encoding forces the order of
820 * the encoded attributes to be swapped.
821 */
822 attrs[0].pszObjId = oid_common_name;
824 attrs[0].Value.cbData = sizeof(commonName);
825 attrs[0].Value.pbData = (BYTE *)commonName;
826 attrs[1].pszObjId = oid_sur_name;
828 attrs[1].Value.cbData = sizeof(surName);
829 attrs[1].Value.pbData = (BYTE *)surName;
830 rdn.cRDNAttr = 2;
831 rdn.rgRDNAttr = attrs;
832 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
834 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
835 if (ret)
836 {
837 ok(!memcmp(buf, twoRDNs, sizeof(twoRDNs)),
838 "Got unexpected encoding for two RDN array\n");
839 LocalFree(buf);
840 }
841 /* A name can be "encoded" with previously encoded RDN attrs. */
843 attrs[0].Value.pbData = (LPBYTE)twoRDNs;
844 attrs[0].Value.cbData = sizeof(twoRDNs);
845 rdn.cRDNAttr = 1;
846 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
848 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
849 if (ret)
850 {
851 ok(size == sizeof(encodedTwoRDNs), "Unexpected size %d\n", size);
853 "Unexpected value for re-encoded two RDN array\n");
854 LocalFree(buf);
855 }
856 /* CERT_RDN_ANY_TYPE is too vague for X509_NAMEs, check the return */
857 rdn.cRDNAttr = 1;
859 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME, &info,
862 "Expected E_INVALIDARG, got %08x\n", GetLastError());
863 /* Test a more complex name */
865 rdn.rgRDNAttr = rdnAttrs;
866 info.cRDN = 1;
867 info.rgRDN = &rdn;
868 buf = NULL;
869 size = 0;
870 ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, X509_NAME, &info,
872 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
873 if (ret)
874 {
875 ok(size == sizeof(encodedRDNAttrs), "Wrong size %d\n", size);
876 ok(!memcmp(buf, encodedRDNAttrs, size), "Unexpected value\n");
877 LocalFree(buf);
878 }
879}
static const BYTE encodedTwoRDNs[]
Definition: encode.c:682
static CERT_RDN_ATTR rdnAttrs[]
Definition: encode.c:713
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2776

Referenced by START_TEST().

◆ test_encodeNameConstraints()

static void test_encodeNameConstraints ( DWORD  dwEncoding)
static

Definition at line 7241 of file encode.c.

7242{
7243 BOOL ret;
7244 CERT_NAME_CONSTRAINTS_INFO constraints = { 0 };
7245 CERT_GENERAL_SUBTREE permitted = { { 0 } };
7246 CERT_GENERAL_SUBTREE excluded = { { 0 } };
7247 LPBYTE buf;
7248 DWORD size;
7249
7250 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7253 {
7254 skip("no X509_NAME_CONSTRAINTS encode support\n");
7255 return;
7256 }
7257 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7258 if (ret)
7259 {
7260 ok(size == sizeof(emptySequence), "Unexpected size\n");
7261 ok(!memcmp(buf, emptySequence, size), "Unexpected value\n");
7262 LocalFree(buf);
7263 }
7264 constraints.cPermittedSubtree = 1;
7265 constraints.rgPermittedSubtree = &permitted;
7266 SetLastError(0xdeadbeef);
7267 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7270 "Expected E_INVALIDARG, got %08x\n", GetLastError());
7272 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7274 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7275 if (ret)
7276 {
7277 ok(size == sizeof(emptyDNSPermittedConstraints), "Unexpected size\n");
7279 "Unexpected value\n");
7280 LocalFree(buf);
7281 }
7282 constraints.cPermittedSubtree = 0;
7283 constraints.cExcludedSubtree = 1;
7284 constraints.rgExcludedSubtree = &excluded;
7286 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7288 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7289 if (ret)
7290 {
7291 ok(size == sizeof(emptyDNSExcludedConstraints), "Unexpected size\n");
7293 "Unexpected value\n");
7294 LocalFree(buf);
7295 }
7296 U(excluded.Base).pwszURL = (LPWSTR)url;
7297 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7299 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7300 if (ret)
7301 {
7302 ok(size == sizeof(DNSExcludedConstraints), "Unexpected size\n");
7304 "Unexpected value\n");
7305 LocalFree(buf);
7306 }
7308 U(permitted.Base).IPAddress.cbData = sizeof(encodedIPAddr);
7309 U(permitted.Base).IPAddress.pbData = (LPBYTE)encodedIPAddr;
7310 constraints.cPermittedSubtree = 1;
7311 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7313 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7314 if (ret)
7315 {
7317 "Unexpected size\n");
7319 "Unexpected value\n");
7320 LocalFree(buf);
7321 }
7322 permitted.dwMinimum = 5;
7323 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7325 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7326 if (ret)
7327 {
7329 "Unexpected size\n");
7331 "Unexpected value\n");
7332 LocalFree(buf);
7333 }
7334 permitted.fMaximum = TRUE;
7335 permitted.dwMaximum = 3;
7336 SetLastError(0xdeadbeef);
7337 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_CONSTRAINTS, &constraints,
7339 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7340 if (ret)
7341 {
7343 "Unexpected size\n");
7345 "Unexpected value\n");
7346 LocalFree(buf);
7347 }
7348}
static BYTE emptyDNSPermittedConstraints[]
Definition: encode.c:7221
static BYTE emptyDNSExcludedConstraints[]
Definition: encode.c:7223
static BYTE DNSExcludedConstraints[]
Definition: encode.c:7225
static BYTE permittedAndExcludedWithMinMaxConstraints[]
Definition: encode.c:7236
static BYTE permittedAndExcludedConstraints[]
Definition: encode.c:7228
static BYTE permittedAndExcludedWithMinConstraints[]
Definition: encode.c:7232

Referenced by START_TEST().

◆ test_encodeNameValue()

static void test_encodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1314 of file encode.c.

1315{
1316 BYTE *buf = NULL;
1317 DWORD size = 0, i;
1318 BOOL ret;
1319 CERT_NAME_VALUE value = { 0, { 0, NULL } };
1320
1321 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1322 value.Value.pbData = printableCommonNameValue;
1323 value.Value.cbData = sizeof(printableCommonNameValue);
1324 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_VALUE, &value,
1326 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
1327 if (ret)
1328 {
1329 ok(size == sizeof(printableCommonNameValue), "Unexpected size %d\n",
1330 size);
1332 "Unexpected encoding\n");
1333 LocalFree(buf);
1334 }
1335 for (i = 0; i < ARRAY_SIZE(nameValues); i++)
1336 {
1337 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_VALUE,
1339 ok(ret || broken(GetLastError() == OSS_PDU_MISMATCH) /* NT4/Win9x */,
1340 "Type %d: CryptEncodeObjectEx failed: %08x\n",
1341 nameValues[i].value.dwValueType, GetLastError());
1342 if (ret)
1343 {
1344 ok(size == nameValues[i].encodedSize,
1345 "Expected size %d, got %d\n", nameValues[i].encodedSize, size);
1346 ok(!memcmp(buf, nameValues[i].encoded, size),
1347 "Got unexpected encoding\n");
1348 LocalFree(buf);
1349 }
1350 }
1351 ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_VALUE,
1353 ok(ret || broken(GetLastError() == OSS_PDU_MISMATCH) /* NT4/Win9x */,
1354 "Type %d: CryptEncodeObjectEx failed: %08x\n",
1355 embeddedNullNameValue.value.dwValueType, GetLastError());
1356 if (ret)
1357 {
1358 ok(size == embeddedNullNameValue.encodedSize,
1359 "Expected size %d, got %d\n", embeddedNullNameValue.encodedSize, size);
1361 "Got unexpected encoding\n");
1362 LocalFree(buf);
1363 }
1364}
static BYTE printableCommonNameValue[]
Definition: encode.c:1250

Referenced by START_TEST().

◆ test_encodeOctets()

static void test_encodeOctets ( DWORD  dwEncoding)
static

Definition at line 1971 of file encode.c.

1972{
1974 DWORD i;
1975
1976 static const struct {
1977 const BYTE *decoded;
1979 const BYTE *encoded;
1980 UINT encoded_size;
1981 } tests[] = {
1982 {
1985 },{
1988 },{
1991 }
1992 };
1993
1994 for (i = 0; i < ARRAY_SIZE(tests); i++)
1995 {
1996 BYTE *buf = NULL;
1997 BOOL ret;
1998 DWORD bufSize = 0;
1999
2000 blob.cbData = tests[i].decoded_size;
2001 blob.pbData = (BYTE*)tests[i].decoded;
2002 ret = pCryptEncodeObjectEx(dwEncoding, X509_OCTET_STRING, &blob,
2004 ok(ret, "CryptEncodeObjectEx failed: %d\n", GetLastError());
2005 if (ret)
2006 {
2007 ok(bufSize == tests[i].encoded_size, "[%u] buf size %u expected %u\n",
2008 i, bufSize, tests[i].encoded_size);
2009 ok(buf[0] == 4, "Got unexpected type %d for octet string (expected 4)\n", buf[0]);
2010 ok(buf[1] == tests[i].decoded_size, "[%u] Got length %d, expected %d\n",
2011 i, buf[1], tests[i].decoded_size);
2012 ok(!memcmp(buf, tests[i].encoded, tests[i].encoded_size), "[%u] Got unexpected value\n", i);
2013 LocalFree(buf);
2014 }
2015 }
2016}

Referenced by START_TEST().

◆ test_encodePKCSAttribute()

static void test_encodePKCSAttribute ( DWORD  dwEncoding)
static

Definition at line 6149 of file encode.c.

6150{
6151 CRYPT_ATTRIBUTE attr = { 0 };
6152 BOOL ret;
6153 LPBYTE buf = NULL;
6154 DWORD size = 0;
6156 char oid[] = "1.2.3";
6157
6158 if (0)
6159 {
6160 /* Crashes on win9x */
6161 SetLastError(0xdeadbeef);
6162 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTE, NULL,
6165 "Expected STATUS_ACCESS_VIOLATION, got %x\n", GetLastError());
6166 }
6167 SetLastError(0xdeadbeef);
6168 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTE, &attr,
6170 ok(!ret && (GetLastError() == E_INVALIDARG ||
6171 GetLastError() == OSS_LIMITED /* Win9x */),
6172 "Expected E_INVALIDARG or OSS_LIMITED, got %x\n", GetLastError());
6173 attr.pszObjId = oid;
6174 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTE, &attr,
6176 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6177 if (ret)
6178 {
6179 ok(size == sizeof(emptyPKCSAttr), "Unexpected size %d\n", size);
6180 ok(!memcmp(buf, emptyPKCSAttr, size), "Unexpected value\n");
6181 LocalFree(buf);
6182 }
6183 blob.cbData = sizeof(bogusDER);
6184 blob.pbData = bogusDER;
6185 attr.cValue = 1;
6186 attr.rgValue = &blob;
6187 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTE, &attr,
6189 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6190 if (ret)
6191 {
6192 ok(size == sizeof(bogusPKCSAttr), "Unexpected size %d\n", size);
6193 ok(!memcmp(buf, bogusPKCSAttr, size), "Unexpected value\n");
6194 LocalFree(buf);
6195 }
6196 blob.pbData = (BYTE *)ints[0].encoded;
6197 blob.cbData = ints[0].encoded[1] + 2;
6198 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTE, &attr,
6200 if (ret)
6201 {
6202 ok(size == sizeof(intPKCSAttr), "Unexpected size %d\n", size);
6203 ok(!memcmp(buf, intPKCSAttr, size), "Unexpected value\n");
6204 LocalFree(buf);
6205 }
6206}
static BYTE bogusDER[]
Definition: encode.c:5969

Referenced by START_TEST().

◆ test_encodePKCSAttributes()

static void test_encodePKCSAttributes ( DWORD  dwEncoding)
static

Definition at line 6265 of file encode.c.

6266{
6267 CRYPT_ATTRIBUTES attributes = { 0 };
6268 CRYPT_ATTRIBUTE attr[2] = { { 0 } };
6270 BOOL ret;
6271 LPBYTE buf = NULL;
6272 DWORD size = 0;
6273 char oid1[] = "1.2.3", oid2[] = "1.5.6";
6274
6275 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6277 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6278 if (ret)
6279 {
6280 ok(size == sizeof(emptyPKCSAttributes), "Unexpected size %d\n", size);
6281 ok(!memcmp(buf, emptyPKCSAttributes, size), "Unexpected value\n");
6282 LocalFree(buf);
6283 }
6284 attributes.cAttr = 1;
6285 attributes.rgAttr = attr;
6286 SetLastError(0xdeadbeef);
6287 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6289 ok(!ret && (GetLastError() == E_INVALIDARG ||
6290 GetLastError() == OSS_LIMITED /* Win9x */),
6291 "Expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
6292 attr[0].pszObjId = oid1;
6293 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6295 if (ret)
6296 {
6297 ok(size == sizeof(singlePKCSAttributes), "Unexpected size %d\n", size);
6298 ok(!memcmp(buf, singlePKCSAttributes, size), "Unexpected value\n");
6299 LocalFree(buf);
6300 }
6301 attr[1].pszObjId = oid2;
6302 attr[1].cValue = 1;
6303 attr[1].rgValue = &blob;
6304 blob.pbData = (BYTE *)ints[0].encoded;
6305 blob.cbData = ints[0].encoded[1] + 2;
6306 attributes.cAttr = 2;
6307 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_ATTRIBUTES, &attributes,
6309 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6310 if (ret)
6311 {
6312 ok(size == sizeof(doublePKCSAttributes), "Unexpected size %d\n", size);
6313 ok(!memcmp(buf, doublePKCSAttributes, size), "Unexpected value\n");
6314 LocalFree(buf);
6315 }
6316}

Referenced by START_TEST().

◆ test_encodePKCSContentInfo()

static void test_encodePKCSContentInfo ( DWORD  dwEncoding)
static

Definition at line 5971 of file encode.c.

5972{
5973 BOOL ret;
5974 BYTE *buf = NULL;
5975 DWORD size = 0;
5976 CRYPT_CONTENT_INFO info = { 0 };
5977 char oid1[] = "1.2.3";
5978
5979 if (0)
5980 {
5981 /* Crashes on win9x */
5982 SetLastError(0xdeadbeef);
5983 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, NULL,
5986 "Expected STATUS_ACCESS_VIOLATION, got %x\n", GetLastError());
5987 }
5988 SetLastError(0xdeadbeef);
5989 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, &info,
5991 ok(!ret && (GetLastError() == E_INVALIDARG ||
5992 GetLastError() == OSS_LIMITED /* Win9x */),
5993 "Expected E_INVALIDARG or OSS_LIMITED, got %x\n", GetLastError());
5994 info.pszObjId = oid1;
5995 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, &info,
5997 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
5998 if (ret)
5999 {
6000 ok(size == sizeof(emptyPKCSContentInfo), "Unexpected size %d\n", size);
6001 ok(!memcmp(buf, emptyPKCSContentInfo, size), "Unexpected value\n");
6002 LocalFree(buf);
6003 }
6004 info.Content.pbData = bogusDER;
6005 info.Content.cbData = sizeof(bogusDER);
6006 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, &info,
6008 ok(ret, "CryptEncodeObjectEx failed; %x\n", GetLastError());
6009 if (ret)
6010 {
6011 ok(size == sizeof(bogusPKCSContentInfo), "Unexpected size %d\n", size);
6012 ok(!memcmp(buf, bogusPKCSContentInfo, size), "Unexpected value\n");
6013 LocalFree(buf);
6014 }
6015 info.Content.pbData = (BYTE *)ints[0].encoded;
6016 info.Content.cbData = ints[0].encoded[1] + 2;
6017 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, &info,
6019 if (ret)
6020 {
6021 ok(size == sizeof(intPKCSContentInfo), "Unexpected size %d\n", size);
6022 ok(!memcmp(buf, intPKCSContentInfo, size), "Unexpected value\n");
6023 LocalFree(buf);
6024 }
6025}

Referenced by START_TEST().

◆ test_encodePKCSSignerInfo()

static void test_encodePKCSSignerInfo ( DWORD  dwEncoding)
static

Definition at line 6594 of file encode.c.

6595{
6596 static char oid1[] = "1.2.3", oid2[] = "1.5.6";
6597 BOOL ret;
6598 LPBYTE buf = NULL;
6599 DWORD size = 0;
6600 CMSG_SIGNER_INFO info = { 0 };
6601 char oid_common_name[] = szOID_COMMON_NAME;
6604 CRYPT_ATTRIBUTE attr = { oid_common_name, 1, &commonName };
6605
6606 SetLastError(0xdeadbeef);
6607 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6610 {
6611 skip("no PKCS7_SIGNER_INFO encode support\n");
6612 return;
6613 }
6614 ok(!ret && (GetLastError() == E_INVALIDARG ||
6615 GetLastError() == OSS_LIMITED /* Win9x */),
6616 "Expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
6617 /* To be encoded, a signer must have an issuer at least, and the encoding
6618 * must include PKCS_7_ASN_ENCODING. (That isn't enough to be decoded,
6619 * see decoding tests.)
6620 */
6621 info.Issuer.cbData = sizeof(encodedCommonNameNoNull);
6622 info.Issuer.pbData = encodedCommonNameNoNull;
6623 SetLastError(0xdeadbeef);
6624 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6626 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6628 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6629 else
6630 {
6631 ok(ret || broken(GetLastError() == OSS_LIMITED /* Win9x */),
6632 "CryptEncodeObjectEx failed: %x\n", GetLastError());
6633 if (ret)
6634 {
6635 ok(size == sizeof(minimalPKCSSigner), "Unexpected size %d\n", size);
6636 if (size == sizeof(minimalPKCSSigner))
6637 ok(!memcmp(buf, minimalPKCSSigner, size), "Unexpected value\n");
6638 else
6639 ok(0, "Unexpected value\n");
6640 LocalFree(buf);
6641 }
6642 }
6643 info.SerialNumber.cbData = sizeof(serialNum);
6644 info.SerialNumber.pbData = (BYTE *)serialNum;
6645 SetLastError(0xdeadbeef);
6646 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6648 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6650 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6651 else
6652 {
6653 ok(ret || broken(GetLastError() == OSS_LIMITED /* Win9x */),
6654 "CryptEncodeObjectEx failed: %x\n", GetLastError());
6655 if (ret)
6656 {
6657 ok(size == sizeof(PKCSSignerWithSerial), "Unexpected size %d\n",
6658 size);
6659 if (size == sizeof(PKCSSignerWithSerial))
6661 "Unexpected value\n");
6662 else
6663 ok(0, "Unexpected value\n");
6664 LocalFree(buf);
6665 }
6666 }
6667 info.HashAlgorithm.pszObjId = oid1;
6668 SetLastError(0xdeadbeef);
6669 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6671 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6673 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6674 else
6675 {
6676 ok(ret || broken(GetLastError() == OSS_LIMITED /* Win9x */),
6677 "CryptEncodeObjectEx failed: %x\n", GetLastError());
6678 if (ret)
6679 {
6680 ok(size == sizeof(PKCSSignerWithHashAlgo), "Unexpected size %d\n",
6681 size);
6682 if (size == sizeof(PKCSSignerWithHashAlgo))
6684 "Unexpected value\n");
6685 else
6686 ok(0, "Unexpected value\n");
6687 LocalFree(buf);
6688 }
6689 }
6690 info.HashEncryptionAlgorithm.pszObjId = oid2;
6691 SetLastError(0xdeadbeef);
6692 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6694 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6696 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6697 else
6698 {
6699 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6700 if (ret)
6701 {
6703 "Unexpected size %d\n", size);
6706 "Unexpected value\n");
6707 else
6708 ok(0, "Unexpected value\n");
6709 LocalFree(buf);
6710 }
6711 }
6712 info.EncryptedHash.cbData = sizeof(hash);
6713 info.EncryptedHash.pbData = (BYTE *)hash;
6714 SetLastError(0xdeadbeef);
6715 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6717 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6719 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6720 else
6721 {
6722 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6723 if (ret)
6724 {
6725 ok(size == sizeof(PKCSSignerWithHash), "Unexpected size %d\n",
6726 size);
6727 if (size == sizeof(PKCSSignerWithHash))
6729 "Unexpected value\n");
6730 else
6731 ok(0, "Unexpected value\n");
6732 LocalFree(buf);
6733 }
6734 }
6735 info.AuthAttrs.cAttr = 1;
6736 info.AuthAttrs.rgAttr = &attr;
6737 SetLastError(0xdeadbeef);
6738 ret = pCryptEncodeObjectEx(dwEncoding, PKCS7_SIGNER_INFO, &info,
6740 if (!(dwEncoding & PKCS_7_ASN_ENCODING))
6742 "Expected E_INVALIDARG, got %08x\n", GetLastError());
6743 else
6744 {
6745 ok(ret, "CryptEncodeObjectEx failed: %x\n", GetLastError());
6746 if (ret)
6747 {
6748 ok(size == sizeof(PKCSSignerWithAuthAttr), "Unexpected size %d\n",
6749 size);
6750 if (size == sizeof(PKCSSignerWithAuthAttr))
6752 "Unexpected value\n");
6753 else
6754 ok(0, "Unexpected value\n");
6755 LocalFree(buf);
6756 }
6757 }
6758}

Referenced by START_TEST().

◆ test_encodePKCSSMimeCapabilities()

static void test_encodePKCSSMimeCapabilities ( DWORD  dwEncoding)
static

Definition at line 6394 of file encode.c.

6395{
6396 static char oid1[] = "1.5.6", oid2[] = "1.2.3";
6397 BOOL ret;
6398 LPBYTE buf = NULL;
6399 DWORD size = 0;
6400 CRYPT_SMIME_CAPABILITY capability[2];
6401 CRYPT_SMIME_CAPABILITIES capabilities;
6402
6403 /* An empty capabilities is allowed */
6404 capabilities.cCapability = 0;
6405 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6406 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6407 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
6408 if (ret)
6409 {
6410 ok(size == sizeof(emptySequence), "unexpected size %d\n", size);
6411 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
6412 LocalFree(buf);
6413 }
6414 /* A non-empty capabilities with an empty capability (lacking an OID) is
6415 * not allowed
6416 */
6417 capability[0].pszObjId = NULL;
6418 capability[0].Parameters.cbData = 0;
6419 capabilities.cCapability = 1;
6420 capabilities.rgCapability = capability;
6421 SetLastError(0xdeadbeef);
6422 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6423 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6424 ok(!ret && (GetLastError() == E_INVALIDARG ||
6425 GetLastError() == OSS_LIMITED /* Win9x */),
6426 "Expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
6427 capability[0].pszObjId = oid1;
6428 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6429 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6430 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
6431 if (ret)
6432 {
6433 ok(size == sizeof(singleCapability), "unexpected size %d\n", size);
6434 ok(!memcmp(buf, singleCapability, size), "unexpected value\n");
6435 LocalFree(buf);
6436 }
6437 capability[1].pszObjId = oid2;
6438 capability[1].Parameters.cbData = 0;
6439 capabilities.cCapability = 2;
6440 ret = pCryptEncodeObjectEx(dwEncoding, PKCS_SMIME_CAPABILITIES,
6441 &capabilities, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
6442 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
6443 if (ret)
6444 {
6445 ok(size == sizeof(twoCapabilities), "unexpected size %d\n", size);
6446 ok(!memcmp(buf, twoCapabilities, size), "unexpected value\n");
6447 LocalFree(buf);
6448 }
6449}

Referenced by START_TEST().

◆ test_encodePolicyQualifierUserNotice()

static void test_encodePolicyQualifierUserNotice ( DWORD  dwEncoding)
static

Definition at line 7465 of file encode.c.

7466{
7467 BOOL ret;
7468 LPBYTE buf;
7469 DWORD size;
7472
7473 memset(&notice, 0, sizeof(notice));
7474 ret = pCryptEncodeObjectEx(dwEncoding,
7476 NULL, &buf, &size);
7478 {
7479 skip("no X509_PKIX_POLICY_QUALIFIER_USERNOTICE encode support\n");
7480 return;
7481 }
7482 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7483 if (ret)
7484 {
7485 ok(sizeof(emptySequence) == size, "unexpected size %d\n", size);
7486 ok(!memcmp(buf, emptySequence, size), "unexpected value\n");
7487 LocalFree(buf);
7488 }
7489 notice.pszDisplayText = noticeText;
7490 ret = pCryptEncodeObjectEx(dwEncoding,
7492 NULL, &buf, &size);
7493 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7494 if (ret)
7495 {
7496 ok(sizeof(noticeWithDisplayText) == size, "unexpected size %d\n", size);
7497 ok(!memcmp(buf, noticeWithDisplayText, size), "unexpected value\n");
7498 LocalFree(buf);
7499 }
7500 reference.pszOrganization = org;
7501 reference.cNoticeNumbers = 2;
7502 reference.rgNoticeNumbers = noticeNumbers;
7503 notice.pNoticeReference = &reference;
7504 ret = pCryptEncodeObjectEx(dwEncoding,
7506 NULL, &buf, &size);
7507 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
7508 if (ret)
7509 {
7510 ok(sizeof(noticeWithReference) == size, "unexpected size %d\n", size);
7511 ok(!memcmp(buf, noticeWithReference, size), "unexpected value\n");
7512 LocalFree(buf);
7513 }
7514}
GLint reference
Definition: glext.h:11729

Referenced by START_TEST().

◆ test_encodePublicKeyInfo()

static void test_encodePublicKeyInfo ( DWORD  dwEncoding)
static

Definition at line 2848 of file encode.c.

2849{
2850 DWORD i;
2851
2852 for (i = 0; i < ARRAY_SIZE(pubKeys); i++)
2853 {
2854 BOOL ret;
2855 BYTE *buf = NULL;
2856 DWORD bufSize = 0;
2857
2858 ret = pCryptEncodeObjectEx(dwEncoding, X509_PUBLIC_KEY_INFO,
2860 &bufSize);
2861 ok(ret || GetLastError() == OSS_BAD_PTR /* Win9x */,
2862 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2863 if (ret)
2864 {
2865 ok(bufSize == pubKeys[i].encoded[1] + 2,
2866 "Expected %d bytes, got %d\n", pubKeys[i].encoded[1] + 2, bufSize);
2867 if (bufSize == pubKeys[i].encoded[1] + 2)
2868 ok(!memcmp(buf, pubKeys[i].encoded, pubKeys[i].encoded[1] + 2),
2869 "Unexpected value\n");
2870 LocalFree(buf);
2871 }
2872 }
2873}

Referenced by START_TEST().

◆ test_encodeRsaPublicKey()

static void test_encodeRsaPublicKey ( DWORD  dwEncoding)
static

Definition at line 2425 of file encode.c.

2426{
2427 BYTE toEncode[sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + sizeof(modulus1)];
2428 BLOBHEADER *hdr = (BLOBHEADER *)toEncode;
2429 RSAPUBKEY *rsaPubKey = (RSAPUBKEY *)(toEncode + sizeof(BLOBHEADER));
2430 BOOL ret;
2431 BYTE *buf = NULL;
2432 DWORD bufSize = 0, i;
2433
2434 /* Try with a bogus blob type */
2435 hdr->bType = 2;
2436 hdr->bVersion = CUR_BLOB_VERSION;
2437 hdr->reserved = 0;
2438 hdr->aiKeyAlg = CALG_RSA_KEYX;
2439 rsaPubKey->magic = 0x31415352;
2440 rsaPubKey->bitlen = sizeof(modulus1) * 8;
2441 rsaPubKey->pubexp = 65537;
2442 memcpy(toEncode + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY), modulus1,
2443 sizeof(modulus1));
2444
2445 ret = pCryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2446 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2448 "Expected E_INVALIDARG, got %08x\n", GetLastError());
2449 /* Now with a bogus reserved field */
2450 hdr->bType = PUBLICKEYBLOB;
2451 hdr->reserved = 1;
2452 ret = pCryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2453 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2454 if (ret)
2455 {
2456 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2457 "Expected size %d, got %d\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2458 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2459 LocalFree(buf);
2460 }
2461 /* Now with a bogus blob version */
2462 hdr->reserved = 0;
2463 hdr->bVersion = 0;
2464 ret = pCryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2465 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2466 if (ret)
2467 {
2468 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2469 "Expected size %d, got %d\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2470 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2471 LocalFree(buf);
2472 }
2473 /* And with a bogus alg ID */
2474 hdr->bVersion = CUR_BLOB_VERSION;
2475 hdr->aiKeyAlg = CALG_DES;
2476 ret = pCryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2477 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2478 if (ret)
2479 {
2480 ok(bufSize == rsaPubKeys[0].encoded[1] + 2,
2481 "Expected size %d, got %d\n", rsaPubKeys[0].encoded[1] + 2, bufSize);
2482 ok(!memcmp(buf, rsaPubKeys[0].encoded, bufSize), "Unexpected value\n");
2483 LocalFree(buf);
2484 }
2485 /* Check a couple of RSA-related OIDs */
2486 hdr->aiKeyAlg = CALG_RSA_KEYX;
2487 ret = pCryptEncodeObjectEx(dwEncoding, szOID_RSA_RSA,
2488 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2490 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
2491 ret = pCryptEncodeObjectEx(dwEncoding, szOID_RSA_SHA1RSA,
2492 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2494 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
2495 /* Finally, all valid */
2496 hdr->aiKeyAlg = CALG_RSA_KEYX;
2497 for (i = 0; i < ARRAY_SIZE(rsaPubKeys); i++)
2498 {
2499 memcpy(toEncode + sizeof(BLOBHEADER) + sizeof(RSAPUBKEY),
2500 rsaPubKeys[i].modulus, rsaPubKeys[i].modulusLen);
2501 ret = pCryptEncodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
2502 toEncode, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &bufSize);
2503 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2504 if (ret)
2505 {
2506 ok(bufSize == rsaPubKeys[i].encoded[1] + 2,
2507 "Expected size %d, got %d\n", rsaPubKeys[i].encoded[1] + 2,
2508 bufSize);
2509 ok(!memcmp(buf, rsaPubKeys[i].encoded, bufSize),
2510 "Unexpected value\n");
2511 LocalFree(buf);
2512 }
2513 }
2514}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const BYTE modulus1[]
Definition: encode.c:2401
struct _PUBLICKEYSTRUC BLOBHEADER
#define CALG_DES
Definition: wincrypt.h:1828

Referenced by START_TEST().

◆ test_encodeSequenceOfAny()

static void test_encodeSequenceOfAny ( DWORD  dwEncoding)
static

Definition at line 2591 of file encode.c.

2592{
2595 DWORD i;
2596 BOOL ret;
2597 BYTE *buf = NULL;
2598 DWORD bufSize = 0;
2599
2600 /* Encode a homogeneous sequence */
2601 for (i = 0; i < ARRAY_SIZE(ints); i++)
2602 {
2603 blobs[i].cbData = ints[i].encoded[1] + 2;
2604 blobs[i].pbData = (BYTE *)ints[i].encoded;
2605 }
2606 seq.cValue = ARRAY_SIZE(ints);
2607 seq.rgValue = blobs;
2608
2609 ret = pCryptEncodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, &seq,
2611 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2612 if (ret)
2613 {
2614 ok(bufSize == sizeof(intSequence), "Wrong size %d\n", bufSize);
2615 ok(!memcmp(buf, intSequence, intSequence[1] + 2), "Unexpected value\n");
2616 LocalFree(buf);
2617 }
2618 /* Change the type of the first element in the sequence, and give it
2619 * another go
2620 */
2621 blobs[0].cbData = times[0].encodedTime[1] + 2;
2622 blobs[0].pbData = (BYTE *)times[0].encodedTime;
2623 ret = pCryptEncodeObjectEx(dwEncoding, X509_SEQUENCE_OF_ANY, &seq,
2625 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
2626 if (ret)
2627 {
2628 ok(bufSize == sizeof(mixedSequence), "Wrong size %d\n", bufSize);
2630 "Unexpected value\n");
2631 LocalFree(buf);
2632 }
2633}

Referenced by START_TEST().

◆ test_encodeUnicodeName()

static void test_encodeUnicodeName ( DWORD  dwEncoding)
static

Definition at line 894 of file encode.c.

895{
896 CERT_RDN_ATTR attrs[2];
897 CERT_RDN rdn;
899 static CHAR oid_common_name[] = szOID_COMMON_NAME,
900 oid_sur_name[] = szOID_SUR_NAME;
901 BYTE *buf = NULL;
902 DWORD size = 0;
903 BOOL ret;
904
905 if (0)
906 {
907 /* Test with NULL pvStructInfo (crashes on win9x) */
908 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, NULL,
911 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
912 }
913 /* Test with empty CERT_NAME_INFO */
914 info.cRDN = 0;
915 info.rgRDN = NULL;
916 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, &info,
918 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
919 if (ret)
920 {
922 "Got unexpected encoding for empty name\n");
923 LocalFree(buf);
924 }
925 /* Check with one CERT_RDN_ATTR, that has an invalid character for the
926 * encoding (the NULL).
927 */
928 attrs[0].pszObjId = oid_common_name;
930 attrs[0].Value.cbData = sizeof(commonNameW);
931 attrs[0].Value.pbData = (BYTE *)commonNameW;
932 rdn.cRDNAttr = 1;
933 rdn.rgRDNAttr = attrs;
934 info.cRDN = 1;
935 info.rgRDN = &rdn;
936 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, &info,
939 "Expected CRYPT_E_INVALID_PRINTABLE_STRING, got %08x\n", GetLastError());
940 ok(size == 9, "Unexpected error index %08x\n", size);
941 /* Check with two NULL-terminated CERT_RDN_ATTRs. Note DER encoding
942 * forces the order of the encoded attributes to be swapped.
943 */
944 attrs[0].pszObjId = oid_common_name;
946 attrs[0].Value.cbData = 0;
947 attrs[0].Value.pbData = (BYTE *)commonNameW;
948 attrs[1].pszObjId = oid_sur_name;
950 attrs[1].Value.cbData = 0;
951 attrs[1].Value.pbData = (BYTE *)surNameW;
952 rdn.cRDNAttr = 2;
953 rdn.rgRDNAttr = attrs;
954 info.cRDN = 1;
955 info.rgRDN = &rdn;
956 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, &info,
958 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
959 if (ret)
960 {
962 "Got unexpected encoding for two RDN array\n");
963 LocalFree(buf);
964 }
965 /* A name can be "encoded" with previously encoded RDN attrs. */
967 attrs[0].Value.pbData = (LPBYTE)twoRDNs;
968 attrs[0].Value.cbData = sizeof(twoRDNs);
969 rdn.cRDNAttr = 1;
970 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, &info,
972 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
973 if (ret)
974 {
975 ok(size == sizeof(encodedTwoRDNs), "Unexpected size %d\n", size);
977 "Unexpected value for re-encoded two RDN array\n");
978 LocalFree(buf);
979 }
980 /* Unicode names infer the type for CERT_RDN_ANY_TYPE */
981 rdn.cRDNAttr = 1;
983 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME, &info,
985 todo_wine ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
986 if (ret)
987 {
988 ok(size == sizeof(anyType), "Unexpected size %d\n", size);
989 ok(!memcmp(buf, anyType, size), "Unexpected value\n");
990 LocalFree(buf);
991 }
992}
static const BYTE anyType[]
Definition: encode.c:888
#define todo_wine
Definition: custom.c:79
#define CRYPT_E_INVALID_PRINTABLE_STRING
Definition: winerror.h:3025

Referenced by START_TEST().

◆ test_encodeUnicodeNameValue()

static void test_encodeUnicodeNameValue ( DWORD  dwEncoding)
static

Definition at line 1820 of file encode.c.

1821{
1822 BYTE *buf = NULL;
1823 DWORD size = 0, i;
1824 BOOL ret;
1826
1827 if (0)
1828 {
1829 /* Crashes on win9x */
1830 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, NULL,
1833 "Expected STATUS_ACCESS_VIOLATION, got %08x\n", GetLastError());
1834 }
1835 /* Have to have a string of some sort */
1836 value.dwValueType = 0; /* aka CERT_RDN_ANY_TYPE */
1837 value.Value.pbData = NULL;
1838 value.Value.cbData = 0;
1839 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1842 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n", GetLastError());
1843 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1844 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1847 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n", GetLastError());
1848 value.dwValueType = CERT_RDN_ANY_TYPE;
1849 value.Value.pbData = (LPBYTE)oneW;
1850 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1853 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n", GetLastError());
1854 value.Value.cbData = sizeof(oneW);
1855 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1858 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n", GetLastError());
1859 /* An encoded string with specified length isn't good enough either */
1860 value.dwValueType = CERT_RDN_ENCODED_BLOB;
1861 value.Value.pbData = oneUniversal;
1862 value.Value.cbData = sizeof(oneUniversal);
1863 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1866 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n", GetLastError());
1867 /* More failure checking */
1868 value.Value.cbData = 0;
1869 for (i = 0; i < ARRAY_SIZE(unicodeErrors); i++)
1870 {
1871 value.Value.pbData = (LPBYTE)unicodeErrors[i].str;
1872 value.dwValueType = unicodeErrors[i].valueType;
1873 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1876 "Value type %d: expected %08x, got %08x\n", value.dwValueType,
1877 unicodeErrors[i].error, GetLastError());
1878 ok(size == unicodeErrors[i].errorIndex,
1879 "Expected error index %d, got %d\n", unicodeErrors[i].errorIndex,
1880 size);
1881 }
1882 /* cbData can be zero if the string is NULL-terminated */
1883 value.Value.cbData = 0;
1884 for (i = 0; i < ARRAY_SIZE(unicodeResults); i++)
1885 {
1886 value.Value.pbData = (LPBYTE)unicodeResults[i].str;
1887 value.dwValueType = unicodeResults[i].valueType;
1888 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1890 ok(ret || broken(GetLastError() == OSS_PDU_MISMATCH /* Win9x */),
1891 "CryptEncodeObjectEx failed: %08x\n", GetLastError());
1892 if (ret)
1893 {
1894 ok(size == unicodeResults[i].encoded.cbData,
1895 "Value type %d: expected size %d, got %d\n",
1896 value.dwValueType, unicodeResults[i].encoded.cbData, size);
1897 ok(!memcmp(unicodeResults[i].encoded.pbData, buf, size),
1898 "Value type %d: unexpected value\n", value.dwValueType);
1899 LocalFree(buf);
1900 }
1901 }
1902 /* These "encode," but they do so by truncating each unicode character
1903 * rather than properly encoding it. Kept separate from the proper results,
1904 * because the encoded forms won't decode to their original strings.
1905 */
1906 for (i = 0; i < ARRAY_SIZE(unicodeWeirdness); i++)
1907 {
1908 value.Value.pbData = (LPBYTE)unicodeWeirdness[i].str;
1909 value.dwValueType = unicodeWeirdness[i].valueType;
1910 ret = pCryptEncodeObjectEx(dwEncoding, X509_UNICODE_NAME_VALUE, &value,
1912 ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
1913 if (ret)
1914 {
1915 ok(size == unicodeWeirdness[i].encoded.cbData,
1916 "Value type %d: expected size %d, got %d\n",
1917 value.dwValueType, unicodeWeirdness[i].encoded.cbData, size);
1918 ok(!memcmp(unicodeWeirdness[i].encoded.pbData, buf, size),
1919 "Value type %d: unexpected value\n", value.dwValueType);
1920 LocalFree(buf);
1921 }
1922 }
1923}
static struct UnicodeExpectedError unicodeErrors[]
Definition: encode.c:1763
static BYTE oneUniversal[]
Definition: encode.c:1786
static const WCHAR oneW[]
Definition: encode.c:1759
static struct UnicodeExpectedResult unicodeWeirdness[]
Definition: encode.c:1815
const WCHAR * str

Referenced by START_TEST().

◆ testExportPublicKey()

static void testExportPublicKey ( HCRYPTPROV  csp,
PCERT_PUBLIC_KEY_INFO pInfo 
)
static

Definition at line 8323 of file encode.c.

8324{
8325 BOOL ret;
8326 DWORD size = 0;
8327 HCRYPTKEY key;
8328
8329 /* This crashes
8330 ret = CryptExportPublicKeyInfoEx(0, 0, 0, NULL, 0, NULL, NULL, NULL);
8331 */
8332 ret = CryptExportPublicKeyInfoEx(0, 0, 0, NULL, 0, NULL, NULL, &size);
8334 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
8336 &size);
8338 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
8340 NULL, &size);
8342 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
8344 0, NULL, NULL, &size);
8346 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
8347 /* Test with no key */
8349 0, NULL, NULL, &size);
8350 ok(!ret && GetLastError() == NTE_NO_KEY, "Expected NTE_NO_KEY, got %08x\n",
8351 GetLastError());
8352 ret = CryptGenKey(csp, AT_SIGNATURE, 0, &key);
8353 ok(ret, "CryptGenKey failed: %08x\n", GetLastError());
8354 if (ret)
8355 {
8357 NULL, 0, NULL, NULL, &size);
8358 ok(ret, "CryptExportPublicKeyInfoEx failed: %08x\n", GetLastError());
8359 *pInfo = HeapAlloc(GetProcessHeap(), 0, size);
8360 if (*pInfo)
8361 {
8363 X509_ASN_ENCODING, NULL, 0, NULL, *pInfo, &size);
8364 ok(ret, "CryptExportPublicKeyInfoEx failed: %08x\n",
8365 GetLastError());
8366 if (ret)
8367 {
8368 /* By default (we passed NULL as the OID) the OID is
8369 * szOID_RSA_RSA.
8370 */
8371 ok(!strcmp((*pInfo)->Algorithm.pszObjId, szOID_RSA_RSA),
8372 "Expected %s, got %s\n", szOID_RSA_RSA,
8373 (*pInfo)->Algorithm.pszObjId);
8374 }
8375 }
8376 }
8378}
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:2036
ULONG_PTR HCRYPTKEY
Definition: wincrypt.h:49
#define NTE_NO_KEY
Definition: winerror.h:2881

Referenced by testPortPublicKeyInfo().

◆ testImportPublicKey()

static void testImportPublicKey ( HCRYPTPROV  csp,
PCERT_PUBLIC_KEY_INFO  info 
)
static

Definition at line 8406 of file encode.c.

8407{
8408 BOOL ret;
8409 HCRYPTKEY key;
8411 DWORD dwSize;
8412 ALG_ID ai;
8413
8414 /* These crash
8415 ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, NULL);
8416 ret = CryptImportPublicKeyInfoEx(0, 0, NULL, 0, 0, NULL, &key);
8417 ret = CryptImportPublicKeyInfoEx(0, 0, info, 0, 0, NULL, NULL);
8418 ret = CryptImportPublicKeyInfoEx(csp, X509_ASN_ENCODING, info, 0, 0, NULL,
8419 NULL);
8420 */
8421 ret = CryptImportPublicKeyInfoEx(0, 0, info, 0, 0, NULL, &key);
8423 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
8424 ret = CryptImportPublicKeyInfoEx(csp, 0, info, 0, 0, NULL, &key);
8426 "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
8428 &key);
8430 "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
8431
8432 /* Export key with standard algorithm (CALG_RSA_KEYX) */
8434 &key);
8435 ok(ret, "CryptImportPublicKeyInfoEx failed: %08x\n", GetLastError());
8436
8437 dwSize = sizeof(ai);
8439 ok(ret, "CryptGetKeyParam failed: %08x\n", GetLastError());
8440 if(ret)
8441 {
8442 ok(dwSize == sizeof(ai), "CryptGetKeyParam returned size %d\n",dwSize);
8443 ok(ai == CALG_RSA_KEYX, "Default ALG_ID is %04x (expected CALG_RSA_KEYX)\n", ai);
8444 }
8445
8447
8448 /* Repeat with forced algorithm */
8450 &key);
8451 ok(ret, "CryptImportPublicKeyInfoEx failed: %08x\n", GetLastError());
8452
8453 dwSize = sizeof(ai);
8455 ok(ret, "CryptGetKeyParam failed: %08x\n", GetLastError());
8456 if(ret)
8457 {
8458 ok(dwSize == sizeof(ai), "CryptGetKeyParam returned size %d\n",dwSize);
8459 ok(ai == CALG_RSA_SIGN, "ALG_ID is %04x (expected CALG_RSA_SIGN)\n", ai);
8460 }
8461
8463
8464 /* Test importing a public key from a certificate context */
8466 sizeof(expiredCert));
8467 ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
8468 GetLastError());
8469 if (context)
8470 {
8472 context->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId),
8473 "Expected %s, got %s\n", szOID_RSA_RSA,
8474 context->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId);
8476 &context->pCertInfo->SubjectPublicKeyInfo, 0, 0, NULL, &key);
8477 ok(ret, "CryptImportPublicKeyInfoEx failed: %08x\n", GetLastError());
8480 }
8481}
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:8380
Definition: http.c:7252
#define CALG_RSA_SIGN
Definition: wincrypt.h:1816
#define KP_ALGID
Definition: wincrypt.h:2134
unsigned int ALG_ID
Definition: wincrypt.h:45

Referenced by testPortPublicKeyInfo().

◆ testPortPublicKeyInfo()

static void testPortPublicKeyInfo ( void  )
static

Definition at line 8485 of file encode.c.

8486{
8487 HCRYPTPROV csp;
8488 BOOL ret;
8490
8491 /* Just in case a previous run failed, delete this thing */
8496 ok(ret,"CryptAcquireContextA failed\n");
8497
8500
8502 CryptReleaseContext(csp, 0);
8505 ok(ret,"CryptAcquireContextA failed\n");
8506}
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:8483
static void testExportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO *pInfo)
Definition: encode.c:8323
static void testImportPublicKey(HCRYPTPROV csp, PCERT_PUBLIC_KEY_INFO info)
Definition: encode.c:8406
#define MS_DEF_PROV_A
Definition: wincrypt.h:1860
#define CRYPT_NEWKEYSET
Definition: wincrypt.h:2070
#define PROV_RSA_FULL
Definition: wincrypt.h:2039
ULONG_PTR HCRYPTPROV
Definition: wincrypt.h:46
#define CRYPT_DELETEKEYSET
Definition: wincrypt.h:2071

Referenced by START_TEST().

◆ testTimeDecoding()

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

Definition at line 521 of file encode.c.

523{
524 FILETIME ft = { 0 };
525 DWORD size = sizeof(ft);
526 BOOL ret;
527
528 ret = pCryptDecodeObjectEx(dwEncoding, structType, time->encodedTime,
529 time->encodedTime[1] + 2, 0, NULL, &ft, &size);
530 /* years other than 1950-2050 are not allowed for encodings other than
531 * X509_CHOICE_OF_TIME.
532 */
533 if (structType == X509_CHOICE_OF_TIME ||
534 (time->sysTime.wYear >= 1950 && time->sysTime.wYear <= 2050))
535 {
537 "CryptDecodeObjectEx failed: %d (0x%08x)\n", GetLastError(),
538 GetLastError());
539 if (ret)
540 compareTime(&time->sysTime, &ft);
541 }
542 else
544 GetLastError() == OSS_PDU_MISMATCH /* Win9x */ ),
545 "Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x\n",
546 GetLastError());
547}
__u16 time
Definition: mkdosfs.c:8
static void compareTime(const SYSTEMTIME *expected, const FILETIME *got)
Definition: encode.c:498

Referenced by test_decodeFiletime().

◆ testTimeEncoding()

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

Definition at line 439 of file encode.c.

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

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 2797 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 888 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 700 of file encode.c.

Referenced by test_CertGetNameStringA().

◆ 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 5222 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 5225 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 4921 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 4923 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 5063 of file encode.c.

Referenced by test_decodeAuthorityKeyId2(), and test_encodeAuthorityKeyId2().

◆ authorityKeyIdWithSerial

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

◆ aW

const WCHAR aW[] = { 'a',0 }
static

Definition at line 1760 of file encode.c.

◆ badFlagsIDP

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

Definition at line 3768 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 2976 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:65
static const BYTE bin13[]
Definition: encode.c:71
static const BYTE bin11[]
Definition: encode.c:69
static const BYTE bin10[]
Definition: encode.c:67
static const BYTE bin12[]
Definition: encode.c:70
static const BYTE bin9[]
Definition: encode.c:66

Definition at line 73 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:79
static const BYTE bin14[]
Definition: encode.c:78
static const BYTE bin17[]
Definition: encode.c:81
static const BYTE bin16[]
Definition: encode.c:80

Definition at line 84 of file encode.c.

Referenced by test_decodeInt(), and test_encodeInt().

◆ bin1

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

Definition at line 40 of file encode.c.

◆ bin10

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

Definition at line 67 of file encode.c.

◆ bin11

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

Definition at line 69 of file encode.c.

◆ bin12

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

Definition at line 70 of file encode.c.

◆ bin13

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

Definition at line 71 of file encode.c.

◆ bin14

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

Definition at line 78 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 79 of file encode.c.

◆ bin16

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

Definition at line 80 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 81 of file encode.c.

◆ bin18

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

Definition at line 359 of file encode.c.

◆ bin19

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

Definition at line 360 of file encode.c.

◆ bin2

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

Definition at line 41 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 549 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 551 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 553 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 574 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 576 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 578 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 580 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 582 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 584 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 586 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin3

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

Definition at line 42 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 588 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 590 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 592 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 594 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 596 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 598 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 600 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin37

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

Definition at line 602 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 604 of file encode.c.

Referenced by test_decodeFiletime().

◆ bin4

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

Definition at line 43 of file encode.c.

◆ bin42

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

Definition at line 1243 of file encode.c.

◆ bin43

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

Definition at line 1244 of file encode.c.

◆ bin44

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

Definition at line 1245 of file encode.c.

◆ bin5

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

Definition at line 44 of file encode.c.

◆ bin52

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

Definition at line 2111 of file encode.c.

◆ bin53

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

Definition at line 2112 of file encode.c.

◆ bin54

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

Definition at line 2113 of file encode.c.

◆ bin55

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

Definition at line 2114 of file encode.c.

◆ bin56

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

Definition at line 2115 of file encode.c.

◆ bin57

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

Definition at line 2116 of file encode.c.

◆ bin59

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

Definition at line 2214 of file encode.c.

◆ bin6

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

Definition at line 45 of file encode.c.

◆ bin60

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

Definition at line 2215 of file encode.c.

◆ bin61

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

Definition at line 2216 of file encode.c.

◆ bin62

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

Definition at line 2217 of file encode.c.

◆ bin63

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

Definition at line 2302 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 2801 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 2803 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 2805 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 2807 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 2809 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 2812 of file encode.c.

◆ bin7

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

Definition at line 46 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 2815 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 2819 of file encode.c.

◆ bin72

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

Definition at line 2823 of file encode.c.

◆ bin8

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

Definition at line 65 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 66 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:2112
static const unsigned char bin57[]
Definition: encode.c:2116
static const unsigned char bin52[]
Definition: encode.c:2111
static const unsigned char bin56[]
Definition: encode.c:2115
static const unsigned char bin54[]
Definition: encode.c:2113
static const unsigned char bin55[]
Definition: encode.c:2114

Definition at line 2118 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 1264 of file encode.c.

◆ bogusDER

BYTE bogusDER[] = { 1 }
static

Definition at line 5969 of file encode.c.

Referenced by test_encodePKCSAttribute(), and test_encodePKCSContentInfo().

◆ bogusIA5

const char bogusIA5[] = "\x80"
static

Definition at line 1240 of file encode.c.

◆ bogusNumeric

const char bogusNumeric[] = "A"
static

Definition at line 1242 of file encode.c.

◆ bogusPKCSAttr

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

Definition at line 6144 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 5965 of file encode.c.

Referenced by test_decodePKCSContentInfo(), and test_encodePKCSContentInfo().

◆ bogusPrintable

const char bogusPrintable[] = "~"
static

Definition at line 1241 of file encode.c.

◆ bytesToEncode

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

Definition at line 2101 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 6887 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 694 of file encode.c.

◆ commonName

const char commonName[] = "Juan Lang"
static

◆ commonNameW

WCHAR commonNameW[] = { 'J','u','a','n',' ','L','a','n','g',0 }
static

Definition at line 881 of file encode.c.

Referenced by test_decodeUnicodeName(), and test_encodeUnicodeName().

◆ 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:2214
static const unsigned char bin61[]
Definition: encode.c:2216
static const unsigned char bin60[]
Definition: encode.c:2215
static const unsigned char bin62[]
Definition: encode.c:2217

Definition at line 2218 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 2236 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 6057 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 6070 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 2685 of file encode.c.

◆ criticalExt

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

Definition at line 2688 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:2813
#define CRL_REASON_KEY_COMPROMISE
Definition: wincrypt.h:2811

Definition at line 3549 of file encode.c.

Referenced by test_decodeCRLDistPoints(), and test_encodeCRLDistPoints().

◆ cspName

const char cspName[] = "WineCryptTemp"
static

Definition at line 8483 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 5429 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 5432 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 5416 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 5436 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 5419 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 5425 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 5422 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 5440 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 5413 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 1963 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 1965 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:696
static const BYTE minnesota[]
Definition: encode.c:690
static const BYTE codeweavers[]
Definition: encode.c:694
static const BYTE us[]
Definition: encode.c:689
static const BYTE localhostAttr[]
Definition: encode.c:698
static const BYTE aric[]
Definition: encode.c:700
#define RDNA(arr)
Definition: encode.c:703
#define RDNIA5(arr)
Definition: encode.c:704
static const BYTE minneapolis[]
Definition: encode.c:692

Definition at line 720 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 3541 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 3539 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 3536 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 3544 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 7225 of file encode.c.

Referenced by test_encodeNameConstraints().

◆ dnsName

const WCHAR dnsName[] = { 'w','i','n','e','h','q','.','o','r','g',0 }
static

Definition at line 1439 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 7358 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 6262 of file encode.c.

Referenced by test_decodePKCSAttributes(), and test_encodePKCSAttributes().

◆ DWORD

Definition at line 31 of file encode.c.

◆ embedded_null

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

Definition at line 1269 of file encode.c.

Referenced by test_decodeNameValue().

◆ embeddedNullNameValue

struct EncodedNameValue embeddedNullNameValue
static
Initial value:

Definition at line 1310 of file encode.c.

Referenced by test_decodeNameValue(), and test_encodeNameValue().

◆ emptyConstraint

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

Definition at line 2231 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 5407 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 5410 of file encode.c.

Referenced by test_decodeCTL(), and test_encodeCTL().

◆ emptyDistPoint

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

Definition at line 3535 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 7223 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 7221 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 7356 of file encode.c.

◆ emptyIndefiniteSequence

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

Definition at line 1062 of file encode.c.

Referenced by test_decodeName().

◆ emptyNameIDP

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

Definition at line 3769 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 6142 of file encode.c.

Referenced by test_decodePKCSAttribute(), and test_encodePKCSAttribute().

◆ emptyPKCSAttributes

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

Definition at line 6259 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 5962 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 5963 of file encode.c.

Referenced by test_decodePKCSContentInfo().

◆ emptyRDNs

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

Definition at line 677 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 1430 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 1431 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 6066 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 2018 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 2020 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 2022 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 2024 of file encode.c.

Referenced by test_decodeOctets().

◆ encoded_empty_octet

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

Definition at line 1969 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 1964 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 1967 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 6557 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 1448 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 1440 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 2232 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 1447 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 731 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 682 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 1434 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 4831 of file encode.c.

Referenced by test_decodeEnhancedKeyUsage(), and test_encodeEnhancedKeyUsage().

◆ enumeratedTypes

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

Definition at line 373 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:360
static const BYTE bin18[]
Definition: encode.c:359

Definition at line 365 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 8380 of file encode.c.

Referenced by testImportPublicKey().

◆ ext0

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

Definition at line 2696 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 2697 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 2699 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 2701 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:2697
static const BYTE ext2[]
Definition: encode.c:2699
static CERT_EXTENSION extWithShortOid
Definition: encode.c:2693
static const BYTE ext0[]
Definition: encode.c:2696
static const BYTE ext3[]
Definition: encode.c:2701

Definition at line 2703 of file encode.c.

Referenced by add_ext_holes(), CRYPT_AsnDecodeExtensions(), CRYPT_AsnEncodeExtensions(), main(), 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:2692

Definition at line 2693 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 1262 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 1258 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 3365 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 1256 of file encode.c.

◆ ia5EmbeddedNull

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

Definition at line 1270 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 6027 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 6146 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 5967 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:45
static const BYTE bin4[]
Definition: encode.c:43
static const BYTE bin5[]
Definition: encode.c:44
static const BYTE bin7[]
Definition: encode.c:46
static const BYTE bin1[]
Definition: encode.c:40
static const BYTE bin2[]
Definition: encode.c:41
static const BYTE bin3[]
Definition: encode.c:42

Definition at line 48 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 2582 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 7360 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 7364 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 7362 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:3295
#define szOID_PKIX_KP_CODE_SIGNING
Definition: wincrypt.h:3296

Definition at line 4829 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 698 of file encode.c.

◆ LPCSTR

Definition at line 31 of file encode.c.

◆ mappingOids

const LPCSTR mappingOids[]
static
Initial value:
#define X509_POLICY_MAPPINGS
Definition: wincrypt.h:3426
#define szOID_POLICY_MAPPINGS
Definition: wincrypt.h:3199
#define szOID_LEGACY_POLICY_MAPPINGS
Definition: wincrypt.h:3179

Definition at line 7733 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 6560 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 692 of file encode.c.

◆ minnesota

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

Definition at line 690 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 2586 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,0x01,0x00,0x01 }
static

Definition at line 2405 of file encode.c.

◆ mod2_encoded

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

Definition at line 2406 of file encode.c.

◆ mod3_encoded

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

Definition at line 2407 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,0x01,0x00,0x01 }
static

Definition at line 2408 of file encode.c.

◆ modulus1

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

Definition at line 2401 of file encode.c.

Referenced by test_encodeRsaPublicKey().

◆ modulus2

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

Definition at line 2402 of file encode.c.

◆ modulus3

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

Definition at line 2403 of file encode.c.

◆ modulus4

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

Definition at line 2404 of file encode.c.

◆ nameValues

struct EncodedNameValue nameValues[]
static

Definition at line 1273 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 1794 of file encode.c.

◆ nihongoGeneral

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

Definition at line 1792 of file encode.c.

◆ nihongoT61

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

Definition at line 1790 of file encode.c.

◆ nihongoURL

const WCHAR nihongoURL[]
static
Initial value:
= { 'h','t','t','p',':','/','/',0x226f,
0x575b, 0 }

Definition at line 1437 of file encode.c.

Referenced by test_encodeAltName(), and test_encodeCRLDistPoints().

◆ nihongoUTF8

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

Definition at line 1796 of file encode.c.

◆ noncrit_ext_data

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

Definition at line 2686 of file encode.c.

◆ nonCriticalExt

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

Definition at line 2690 of file encode.c.

Referenced by test_encodeCRLToBeSigned().

◆ noticeNumbers

int noticeNumbers[] = { 2,3 }
static

◆ noticeText

WCHAR noticeText[]
static
Initial value:
= { 'T','h','i','s',' ','i','s',' ','a',' ',
'n','o','t','i','c','e',0 }

Definition at line 7449 of file encode.c.

Referenced by CRYPT_FormatUserNotice(), test_decodePolicyQualifierUserNotice(), and test_encodePolicyQualifierUserNotice().

◆ 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 7451 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 7458 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 1248 of file encode.c.

◆ octetCommonNameValue

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

Definition at line 1246 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 7579 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 712 of file encode.c.

◆ oid_basic_constraints2

CHAR oid_basic_constraints2[] = szOID_BASIC_CONSTRAINTS2
static

Definition at line 2687 of file encode.c.

◆ oid_bogus

CHAR oid_bogus[] = "1.2.3"
static

Definition at line 2825 of file encode.c.

◆ oid_codeweavers

CHAR oid_codeweavers[] = "2.5.4.10"
static

Definition at line 709 of file encode.c.

◆ oid_localhostAttr

CHAR oid_localhostAttr[] = "2.5.4.3"
static

Definition at line 711 of file encode.c.

◆ oid_minneapolis

CHAR oid_minneapolis[] = "2.5.4.7"
static

Definition at line 708 of file encode.c.

◆ oid_minnesota

CHAR oid_minnesota[] = "2.5.4.8"
static

Definition at line 707 of file encode.c.

◆ oid_rsa

CHAR oid_rsa[] = szOID_RSA
static

Definition at line 2826 of file encode.c.

◆ oid_short

CHAR oid_short[] = "1.1"
static

Definition at line 2692 of file encode.c.

◆ oid_us

CHAR oid_us[] = "2.5.4.6"
static

Definition at line 706 of file encode.c.

◆ oid_user_notice

char oid_user_notice[] = "1.3.6.1.5.5.7.2.2"
static

Definition at line 7584 of file encode.c.

Referenced by test_decodeCertPolicies(), and test_encodeCertPolicies().

◆ oid_wine

CHAR oid_wine[] = "2.5.4.11"
static

Definition at line 710 of file encode.c.

◆ oneBMP

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

Definition at line 1788 of file encode.c.

◆ oneGeneral

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

Definition at line 1787 of file encode.c.

◆ oneGraphic

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

Definition at line 1784 of file encode.c.

◆ oneIA5

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

Definition at line 1783 of file encode.c.

◆ oneNumeric

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

Definition at line 1779 of file encode.c.

◆ onePrintable

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

Definition at line 1780 of file encode.c.

◆ oneTeletex

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

Definition at line 1781 of file encode.c.

◆ oneUniversal

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

Definition at line 1786 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ oneUTF8

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

Definition at line 1789 of file encode.c.

◆ oneVideotex

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

Definition at line 1782 of file encode.c.

◆ oneVisible

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

Definition at line 1785 of file encode.c.

◆ oneW

const WCHAR oneW[] = { '1',0 }
static

Definition at line 1759 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ org

◆ params

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

Definition at line 2799 of file encode.c.

◆ PCRYPT_DECODE_PARA

Definition at line 31 of file encode.c.

◆ PCRYPT_ENCODE_PARA

Definition at line 32 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 7228 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 7232 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 7236 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 6585 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 6579 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 6569 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 6574 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 6564 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 7580 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 7889 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 7887 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 7885 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 7728 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 7730 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 1250 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:2803
static const unsigned char bin68[]
Definition: encode.c:2809
static const unsigned char bin71[]
Definition: encode.c:2819
static CHAR oid_bogus[]
Definition: encode.c:2825
static const unsigned char bin69[]
Definition: encode.c:2812
static const BYTE params[]
Definition: encode.c:2799
static CHAR oid_rsa[]
Definition: encode.c:2826
static const unsigned char bin64[]
Definition: encode.c:2801
static unsigned char bin72[]
Definition: encode.c:2823
static const unsigned char bin66[]
Definition: encode.c:2805
static const unsigned char bin67[]
Definition: encode.c:2807
static const unsigned char bin70[]
Definition: encode.c:2815

Definition at line 2828 of file encode.c.

Referenced by test_decodePublicKeyInfo(), and test_encodePublicKeyInfo().

◆ quoteW

const WCHAR quoteW[] = { '"', 0 }
static

Definition at line 1761 of file encode.c.

◆ rdnAttrs

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

Definition at line 713 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 8212 of file encode.c.

Referenced by test_decodeRsaPrivateKey().

◆ rsaPrivKeyDer

const BYTE rsaPrivKeyDer[]
static

Definition at line 8040 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 8188 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 8200 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 8141 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 8164 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 8176 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 8224 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:2406
static const BYTE mod4_encoded[]
Definition: encode.c:2408
static const BYTE modulus4[]
Definition: encode.c:2404
static const BYTE mod3_encoded[]
Definition: encode.c:2407
static const BYTE modulus2[]
Definition: encode.c:2402
static const BYTE modulus3[]
Definition: encode.c:2403
static const BYTE mod1_encoded[]
Definition: encode.c:2405

Definition at line 2418 of file encode.c.

Referenced by test_decodeRsaPublicKey(), and test_encodeRsaPublicKey().

◆ serialNum

◆ signedBigCert

const BYTE signedBigCert[]
static

Definition at line 3368 of file encode.c.

Referenced by test_decodeCert(), and test_encodeCert().

◆ signedBigCertWithIndefiniteSeq

const BYTE signedBigCertWithIndefiniteSeq[]
static

Definition at line 3403 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 5746 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 5761 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 6387 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 6391 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 6260 of file encode.c.

Referenced by test_decodePKCSAttributes(), and test_encodePKCSAttributes().

◆ surName

const char surName[] = "Lang"
static

Definition at line 674 of file encode.c.

Referenced by test_decodeName(), and test_encodeName().

◆ surNameW

WCHAR surNameW[] = { 'L','a','n','g',0 }
static

Definition at line 882 of file encode.c.

Referenced by test_decodeUnicodeName(), and test_encodeUnicodeName().

◆ t61CommonNameValue

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

Definition at line 1252 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:551
static const BYTE bin22[]
Definition: encode.c:553
static const BYTE bin20[]
Definition: encode.c:549

Definition at line 556 of file encode.c.

Referenced by deflate_fast(), fill_window(), generate_random(), 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 6389 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 7585 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 678 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 1063 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 884 of file encode.c.

Referenced by test_decodeUnicodeName(), and test_encodeUnicodeName().

◆ unicodeErrors

struct UnicodeExpectedError unicodeErrors[]
static
Initial value:

Definition at line 1763 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ unicodeResults

struct UnicodeExpectedResult unicodeResults[]
static
Initial value:
= {
{ CERT_RDN_IA5_STRING, oneW, { sizeof(oneIA5), oneIA5 } },
{ CERT_RDN_BMP_STRING, oneW, { sizeof(oneBMP), oneBMP } },
}
static BYTE oneGraphic[]
Definition: encode.c:1784
static BYTE nihongoUTF8[]
Definition: encode.c:1796
static BYTE onePrintable[]
Definition: encode.c:1780
static BYTE oneUTF8[]
Definition: encode.c:1789
static BYTE oneTeletex[]
Definition: encode.c:1781
static BYTE oneIA5[]
Definition: encode.c:1783
static BYTE oneBMP[]
Definition: encode.c:1788
static BYTE oneGeneral[]
Definition: encode.c:1787
static BYTE oneVideotex[]
Definition: encode.c:1782
static BYTE oneNumeric[]
Definition: encode.c:1779
static BYTE nihongoBMP[]
Definition: encode.c:1794
static BYTE oneVisible[]
Definition: encode.c:1785
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2788
#define CERT_RDN_UNIVERSAL_STRING
Definition: wincrypt.h:2789
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2786
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2783
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2781
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2785

Definition at line 1799 of file encode.c.

Referenced by test_decodeUnicodeNameValue(), and test_encodeUnicodeNameValue().

◆ unicodeWeirdness

struct UnicodeExpectedResult unicodeWeirdness[]
static
Initial value:
= {
}
static BYTE nihongoT61[]
Definition: encode.c:1790
static BYTE nihongoGeneral[]
Definition: encode.c:1792

Definition at line 1815 of file encode.c.

Referenced by test_encodeUnicodeNameValue().

◆ url

const WCHAR url[]
static
Initial value:
= { 'h','t','t','p',':','/','/','w','i','n','e',
'h','q','.','o','r','g',0 }

Definition at line 1432 of file encode.c.

Referenced by _open_simple_request(), _protocol_start(), _test_current_url(), _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(), 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_from_outside(), parseError_get_url(), ParseURLFromOutsideSourceA(), ParseURLFromOutsideSourceW(), 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(), 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_doc_load_from_path(), 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_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_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_entry_free(), url_forward_slash(), 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(), URLDownloadToCacheFileA(), UrlFixupW(), 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 3770 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 1267 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 2942 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 2962 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 3019 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 2986 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 2998 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 2969 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 3024 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 3036 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 3009 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 3973 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 3996 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 4003 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 3979 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 3984 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 3990 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 2947 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 3976 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 4010 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 2952 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 2957 of file encode.c.

Referenced by test_decodeCertToBeSigned(), and test_encodeCertToBeSigned().

◆ verisignCRL

const BYTE verisignCRL[]
static

Definition at line 4137 of file encode.c.

Referenced by test_decodeCRLToBeSigned().

◆ verisignCRLWithLotsOfEntries

const BYTE verisignCRLWithLotsOfEntries[]
static

Definition at line 4172 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 1254 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 1260 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 696 of file encode.c.

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