ReactOS  0.4.14-dev-57-g333b8f1
str.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winuser.h"
#include "wincrypt.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "crypt32_private.h"
Include dependency graph for str.c:

Go to the source code of this file.

Classes

struct  KeynameKeeper
 
struct  X500TokenW
 

Macros

#define NONAMELESSUNION
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (crypt)
 
DWORD WINAPI CertRDNValueToStrA (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPSTR psz, DWORD csz)
 
DWORD WINAPI CertRDNValueToStrW (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
 
static BOOL is_quotable_char (char c)
 
static DWORD quote_rdn_value_to_str_a (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPSTR psz, DWORD csz)
 
static DWORD quote_rdn_value_to_str_w (DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
 
static DWORD CRYPT_AddPrefixA (LPCSTR prefix, LPSTR psz, DWORD csz)
 
DWORD WINAPI CertNameToStrA (DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPSTR psz, DWORD csz)
 
static DWORD CRYPT_AddPrefixAToW (LPCSTR prefix, LPWSTR psz, DWORD csz)
 
static DWORD CRYPT_AddPrefixW (LPCWSTR prefix, LPWSTR psz, DWORD csz)
 
DWORD cert_name_to_str_with_indent (DWORD dwCertEncodingType, DWORD indentLevel, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
 
DWORD WINAPI CertNameToStrW (DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
 
BOOL WINAPI CertStrToNameA (DWORD dwCertEncodingType, LPCSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCSTR *ppszError)
 
static void CRYPT_InitializeKeynameKeeper (struct KeynameKeeper *keeper)
 
static void CRYPT_FreeKeynameKeeper (struct KeynameKeeper *keeper)
 
static void CRYPT_KeynameKeeperFromTokenW (struct KeynameKeeper *keeper, const struct X500TokenW *key)
 
static BOOL CRYPT_GetNextKeyW (LPCWSTR str, struct X500TokenW *token, LPCWSTR *ppszError)
 
static BOOL CRYPT_GetNextValueW (LPCWSTR str, DWORD dwFlags, LPCWSTR separators, WCHAR *separator_used, struct X500TokenW *token, LPCWSTR *ppszError)
 
static BOOL CRYPT_EncodeValueWithType (DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, DWORD type, LPCWSTR *ppszError)
 
static BOOL CRYPT_EncodeValue (DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, const DWORD *types, LPCWSTR *ppszError)
 
static BOOL CRYPT_ValueToRDN (DWORD dwCertEncodingType, PCERT_NAME_INFO info, PCCRYPT_OID_INFO keyOID, struct X500TokenW *value, DWORD dwStrType, LPCWSTR *ppszError)
 
BOOL WINAPI CertStrToNameW (DWORD dwCertEncodingType, LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCWSTR *ppszError)
 
DWORD WINAPI CertGetNameStringA (PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPSTR pszNameString, DWORD cchNameString)
 
static PCERT_ALT_NAME_ENTRY cert_find_alt_name_entry (PCCERT_CONTEXT cert, LPCSTR altNameOID, DWORD entryType, PCERT_ALT_NAME_INFO *info)
 
static DWORD cert_get_name_from_rdn_attr (DWORD encodingType, const CERT_NAME_BLOB *name, LPCSTR oid, LPWSTR pszNameString, DWORD cchNameString)
 
DWORD WINAPI CertGetNameStringW (PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPWSTR pszNameString, DWORD cchNameString)
 

Variables

static const WCHAR indent [] = { ' ',' ',' ',' ',' ',0 }
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 20 of file str.c.

Function Documentation

◆ cert_find_alt_name_entry()

static PCERT_ALT_NAME_ENTRY cert_find_alt_name_entry ( PCCERT_CONTEXT  cert,
LPCSTR  altNameOID,
DWORD  entryType,
PCERT_ALT_NAME_INFO info 
)
static

Definition at line 1179 of file str.c.

1181 {
1183  PCERT_EXTENSION ext = CertFindExtension(altNameOID,
1184  cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension);
1185 
1186  if (ext)
1187  {
1188  DWORD bytes = 0;
1189 
1190  if (CryptDecodeObjectEx(cert->dwCertEncodingType, X509_ALTERNATE_NAME,
1191  ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL,
1192  info, &bytes))
1193  {
1194  DWORD i;
1195 
1196  for (i = 0; !entry && i < (*info)->cAltEntry; i++)
1197  if ((*info)->rgAltEntry[i].dwAltNameChoice == entryType)
1198  entry = &(*info)->rgAltEntry[i];
1199  }
1200  }
1201  else
1202  *info = NULL;
1203  return entry;
1204 }
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
static const BYTE cert[]
Definition: str.c:71
Definition: wincrypt.h:332
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 unsigned char bytes[4]
Definition: adnsresfilter.c:74
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
unsigned long DWORD
Definition: ntddk_ex.h:95
PCERT_EXTENSION WINAPI CertFindExtension(LPCSTR pszObjId, DWORD cExtensions, CERT_EXTENSION rgExtensions[])
Definition: cert.c:2028
uint32_t entry
Definition: isohybrid.c:63
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define X509_ALTERNATE_NAME
Definition: wincrypt.h:3377

Referenced by CertGetNameStringW().

◆ cert_get_name_from_rdn_attr()

static DWORD cert_get_name_from_rdn_attr ( DWORD  encodingType,
const CERT_NAME_BLOB name,
LPCSTR  oid,
LPWSTR  pszNameString,
DWORD  cchNameString 
)
static

Definition at line 1206 of file str.c.

1208 {
1209  CERT_NAME_INFO *nameInfo;
1210  DWORD bytes = 0, ret = 0;
1211 
1212  if (CryptDecodeObjectEx(encodingType, X509_NAME, name->pbData,
1213  name->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &nameInfo, &bytes))
1214  {
1215  PCERT_RDN_ATTR nameAttr;
1216 
1217  if (!oid)
1218  oid = szOID_RSA_emailAddr;
1219  nameAttr = CertFindRDNAttr(oid, nameInfo);
1220  if (nameAttr)
1221  ret = CertRDNValueToStrW(nameAttr->dwValueType, &nameAttr->Value,
1222  pszNameString, cchNameString);
1223  LocalFree(nameInfo);
1224  }
1225  return ret;
1226 }
DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
Definition: str.c:100
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
smooth NULL
Definition: ftsmooth.c:416
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
#define X509_NAME
Definition: wincrypt.h:3372
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define szOID_RSA_emailAddr
Definition: wincrypt.h:3035
Definition: name.c:36
DWORD dwValueType
Definition: wincrypt.h:257
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName)
Definition: cert.c:2051

Referenced by CertGetNameStringW().

◆ cert_name_to_str_with_indent()

DWORD cert_name_to_str_with_indent ( DWORD  dwCertEncodingType,
DWORD  indent,
const CERT_NAME_BLOB pName,
DWORD  dwStrType,
LPWSTR  psz,
DWORD  csz 
)

String functions

Definition at line 576 of file str.c.

578 {
579  static const DWORD unsupportedFlags = CERT_NAME_STR_NO_QUOTING_FLAG |
581  static const WCHAR commaSep[] = { ',',' ',0 };
582  static const WCHAR semiSep[] = { ';',' ',0 };
583  static const WCHAR crlfSep[] = { '\r','\n',0 };
584  static const WCHAR plusSep[] = { ' ','+',' ',0 };
585  static const WCHAR spaceSep[] = { ' ',0 };
586  DWORD ret = 0, bytes = 0;
587  BOOL bRet;
589 
590  if (dwStrType & unsupportedFlags)
591  FIXME("unsupported flags: %08x\n", dwStrType & unsupportedFlags);
592 
595  if (bRet)
596  {
597  DWORD i, j, sepLen, rdnSepLen;
598  LPCWSTR sep, rdnSep;
600  const CERT_RDN *rdn = info->rgRDN;
601 
602  if(reverse && info->cRDN > 1) rdn += (info->cRDN - 1);
603 
605  sep = semiSep;
607  sep = crlfSep;
608  else
609  sep = commaSep;
610  sepLen = lstrlenW(sep);
612  rdnSep = spaceSep;
613  else
614  rdnSep = plusSep;
615  rdnSepLen = lstrlenW(rdnSep);
616  for (i = 0; (!psz || ret < csz) && i < info->cRDN; i++)
617  {
618  for (j = 0; (!psz || ret < csz) && j < rdn->cRDNAttr; j++)
619  {
620  DWORD chars;
621  LPCSTR prefixA = NULL;
622  LPCWSTR prefixW = NULL;
623 
624  if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR)
625  prefixA = rdn->rgRDNAttr[j].pszObjId;
626  else if ((dwStrType & 0x000000ff) == CERT_X500_NAME_STR)
627  {
630  rdn->rgRDNAttr[j].pszObjId,
632 
633  if (oidInfo)
634  prefixW = oidInfo->pwszName;
635  else
636  prefixA = rdn->rgRDNAttr[j].pszObjId;
637  }
639  {
640  DWORD k;
641 
642  for (k = 0; k < indentLevel; k++)
643  {
644  if (psz)
645  {
646  chars = min(strlenW(indent), csz - ret - 1);
647  memcpy(psz + ret, indent, chars * sizeof(WCHAR));
648  }
649  else
650  chars = strlenW(indent);
651  ret += chars;
652  }
653  }
654  if (prefixW)
655  {
656  /* - 1 is needed to account for the NULL terminator. */
657  chars = CRYPT_AddPrefixW(prefixW,
658  psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
659  ret += chars;
660  }
661  else if (prefixA)
662  {
663  /* - 1 is needed to account for the NULL terminator. */
664  chars = CRYPT_AddPrefixAToW(prefixA,
665  psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
666  ret += chars;
667  }
668  chars = quote_rdn_value_to_str_w(
669  rdn->rgRDNAttr[j].dwValueType,
670  &rdn->rgRDNAttr[j].Value, psz ? psz + ret : NULL,
671  psz ? csz - ret : 0);
672  if (chars)
673  ret += chars - 1;
674  if (j < rdn->cRDNAttr - 1)
675  {
676  if (psz && ret < csz - rdnSepLen - 1)
677  memcpy(psz + ret, rdnSep, rdnSepLen * sizeof(WCHAR));
678  ret += rdnSepLen;
679  }
680  }
681  if (i < info->cRDN - 1)
682  {
683  if (psz && ret < csz - sepLen - 1)
684  memcpy(psz + ret, sep, sepLen * sizeof(WCHAR));
685  ret += sepLen;
686  }
687  if(reverse) rdn--;
688  else rdn++;
689  }
690  LocalFree(info);
691  }
692  if (psz && csz)
693  {
694  *(psz + ret) = '\0';
695  ret++;
696  }
697  else
698  ret++;
699  return ret;
700 }
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:263
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3487
#define CERT_X500_NAME_STR
Definition: wincrypt.h:3486
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static const WCHAR commaSep[]
Definition: main.c:520
#define lstrlenW
Definition: compat.h:407
struct _test_info info[]
Definition: SetCursorPos.c:19
_STLP_MOVE_TO_STD_NAMESPACE void reverse(_BidirectionalIter __first, _BidirectionalIter __last)
Definition: _algo.h:332
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3489
static struct list oidInfo
Definition: oid.c:1206
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 unsigned char bytes[4]
Definition: adnsresfilter.c:74
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CERT_OID_NAME_STR
Definition: wincrypt.h:3485
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
const char * LPCSTR
Definition: xmlstorage.h:183
static DWORD CRYPT_AddPrefixW(LPCWSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:556
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
#define X509_NAME
Definition: wincrypt.h:3372
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
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3488
static LPSTR pName
Definition: security.c:75
static LPCSTR DWORD dwStrType
Definition: str.c:196
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1688
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static DWORD CRYPT_AddPrefixAToW(LPCSTR prefix, LPWSTR psz, DWORD csz)
Definition: str.c:530
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1702
static const WCHAR indent[]
Definition: str.c:574
#define CERT_NAME_STR_REVERSE_FLAG
Definition: wincrypt.h:3492
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define min(a, b)
Definition: monoChain.cc:55
static DWORD quote_rdn_value_to_str_w(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
Definition: str.c:288
DWORD dwValueType
Definition: wincrypt.h:257
#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
Definition: wincrypt.h:3494
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
int k
Definition: mpi.c:3369
LPSTR pszObjId
Definition: wincrypt.h:256

Referenced by CertGetNameStringW(), CertNameToStrW(), CRYPT_FormatAltNameEntry(), and name_value_to_str().

◆ CertGetNameStringA()

DWORD WINAPI CertGetNameStringA ( PCCERT_CONTEXT  pCertContext,
DWORD  dwType,
DWORD  dwFlags,
void pvTypePara,
LPSTR  pszNameString,
DWORD  cchNameString 
)

Definition at line 1127 of file str.c.

1129 {
1130  DWORD ret;
1131 
1132  TRACE("(%p, %d, %08x, %p, %p, %d)\n", pCertContext, dwType, dwFlags,
1133  pvTypePara, pszNameString, cchNameString);
1134 
1135  if (pszNameString)
1136  {
1137  LPWSTR wideName;
1138  DWORD nameLen;
1139 
1140  nameLen = CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara,
1141  NULL, 0);
1142  wideName = CryptMemAlloc(nameLen * sizeof(WCHAR));
1143  if (wideName)
1144  {
1145  CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara,
1146  wideName, nameLen);
1147  nameLen = WideCharToMultiByte(CP_ACP, 0, wideName, nameLen,
1148  pszNameString, cchNameString, NULL, NULL);
1149  if (nameLen <= cchNameString)
1150  ret = nameLen;
1151  else
1152  {
1153  pszNameString[cchNameString - 1] = '\0';
1154  ret = cchNameString;
1155  }
1156  CryptMemFree(wideName);
1157  }
1158  else
1159  {
1160  *pszNameString = '\0';
1161  ret = 1;
1162  }
1163  }
1164  else
1165  ret = CertGetNameStringW(pCertContext, dwType, dwFlags, pvTypePara,
1166  NULL, 0);
1167  return ret;
1168 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPWSTR pszNameString, DWORD cchNameString)
Definition: str.c:1228
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ PCCERT_CONTEXT pCertContext
Definition: wincrypt.h:4840

Referenced by GetFriendlyNameOfCertA().

◆ CertGetNameStringW()

DWORD WINAPI CertGetNameStringW ( PCCERT_CONTEXT  pCertContext,
DWORD  dwType,
DWORD  dwFlags,
void pvTypePara,
LPWSTR  pszNameString,
DWORD  cchNameString 
)

Definition at line 1228 of file str.c.

1230 {
1231  DWORD ret = 0;
1233  LPCSTR altNameOID;
1234 
1235  TRACE("(%p, %d, %08x, %p, %p, %d)\n", pCertContext, dwType,
1236  dwFlags, pvTypePara, pszNameString, cchNameString);
1237 
1238  if (!pCertContext)
1239  goto done;
1240 
1242  {
1244  altNameOID = szOID_ISSUER_ALT_NAME;
1245  }
1246  else
1247  {
1249  altNameOID = szOID_SUBJECT_ALT_NAME;
1250  }
1251 
1252  switch (dwType)
1253  {
1254  case CERT_NAME_EMAIL_TYPE:
1255  {
1258  altNameOID, CERT_ALT_NAME_RFC822_NAME, &info);
1259 
1260  if (entry)
1261  {
1262  if (!pszNameString)
1263  ret = strlenW(entry->u.pwszRfc822Name) + 1;
1264  else if (cchNameString)
1265  {
1266  ret = min(strlenW(entry->u.pwszRfc822Name), cchNameString - 1);
1267  memcpy(pszNameString, entry->u.pwszRfc822Name,
1268  ret * sizeof(WCHAR));
1269  pszNameString[ret++] = 0;
1270  }
1271  }
1272  if (info)
1273  LocalFree(info);
1274  if (!ret)
1276  name, szOID_RSA_emailAddr, pszNameString, cchNameString);
1277  break;
1278  }
1279  case CERT_NAME_RDN_TYPE:
1280  {
1281  DWORD type = pvTypePara ? *(DWORD *)pvTypePara : 0;
1282 
1283  if (name->cbData)
1285  type, pszNameString, cchNameString);
1286  else
1287  {
1290  altNameOID, CERT_ALT_NAME_DIRECTORY_NAME, &info);
1291 
1292  if (entry)
1294  &entry->u.DirectoryName, type, pszNameString, cchNameString);
1295  if (info)
1296  LocalFree(info);
1297  }
1298  break;
1299  }
1300  case CERT_NAME_ATTR_TYPE:
1302  name, pvTypePara, pszNameString, cchNameString);
1303  if (!ret)
1304  {
1305  CERT_ALT_NAME_INFO *altInfo;
1307  altNameOID, CERT_ALT_NAME_DIRECTORY_NAME, &altInfo);
1308 
1309  if (entry)
1311  &entry->u.DirectoryName, 0, pszNameString, cchNameString);
1312  if (altInfo)
1313  LocalFree(altInfo);
1314  }
1315  break;
1317  {
1318  static const LPCSTR simpleAttributeOIDs[] = { szOID_COMMON_NAME,
1321  CERT_NAME_INFO *nameInfo = NULL;
1322  DWORD bytes = 0, i;
1323 
1325  name->pbData, name->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &nameInfo,
1326  &bytes))
1327  {
1328  PCERT_RDN_ATTR nameAttr = NULL;
1329 
1330  for (i = 0; !nameAttr && i < ARRAY_SIZE(simpleAttributeOIDs); i++)
1331  nameAttr = CertFindRDNAttr(simpleAttributeOIDs[i], nameInfo);
1332  if (nameAttr)
1333  ret = CertRDNValueToStrW(nameAttr->dwValueType,
1334  &nameAttr->Value, pszNameString, cchNameString);
1335  LocalFree(nameInfo);
1336  }
1337  if (!ret)
1338  {
1339  CERT_ALT_NAME_INFO *altInfo;
1341  altNameOID, CERT_ALT_NAME_RFC822_NAME, &altInfo);
1342 
1343  if (altInfo)
1344  {
1345  if (!entry && altInfo->cAltEntry)
1346  entry = &altInfo->rgAltEntry[0];
1347  if (entry)
1348  {
1349  if (!pszNameString)
1350  ret = strlenW(entry->u.pwszRfc822Name) + 1;
1351  else if (cchNameString)
1352  {
1353  ret = min(strlenW(entry->u.pwszRfc822Name),
1354  cchNameString - 1);
1355  memcpy(pszNameString, entry->u.pwszRfc822Name,
1356  ret * sizeof(WCHAR));
1357  pszNameString[ret++] = 0;
1358  }
1359  }
1360  LocalFree(altInfo);
1361  }
1362  }
1363  break;
1364  }
1366  {
1367  DWORD cch = cchNameString;
1368 
1370  CERT_FRIENDLY_NAME_PROP_ID, pszNameString, &cch))
1371  ret = cch;
1372  else
1374  CERT_NAME_SIMPLE_DISPLAY_TYPE, dwFlags, pvTypePara, pszNameString,
1375  cchNameString);
1376  break;
1377  }
1378  case CERT_NAME_DNS_TYPE:
1379  {
1382  altNameOID, CERT_ALT_NAME_DNS_NAME, &info);
1383 
1384  if (entry)
1385  {
1386  if (!pszNameString)
1387  ret = strlenW(entry->u.pwszDNSName) + 1;
1388  else if (cchNameString)
1389  {
1390  ret = min(strlenW(entry->u.pwszDNSName), cchNameString - 1);
1391  memcpy(pszNameString, entry->u.pwszDNSName, ret * sizeof(WCHAR));
1392  pszNameString[ret++] = 0;
1393  }
1394  }
1395  if (info)
1396  LocalFree(info);
1397  if (!ret)
1399  name, szOID_COMMON_NAME, pszNameString, cchNameString);
1400  break;
1401  }
1402  case CERT_NAME_URL_TYPE:
1403  {
1406  altNameOID, CERT_ALT_NAME_URL, &info);
1407 
1408  if (entry)
1409  {
1410  if (!pszNameString)
1411  ret = strlenW(entry->u.pwszURL) + 1;
1412  else if (cchNameString)
1413  {
1414  ret = min(strlenW(entry->u.pwszURL), cchNameString - 1);
1415  memcpy(pszNameString, entry->u.pwszURL, ret * sizeof(WCHAR));
1416  pszNameString[ret++] = 0;
1417  }
1418  }
1419  if (info)
1420  LocalFree(info);
1421  break;
1422  }
1423  default:
1424  FIXME("unimplemented for type %d\n", dwType);
1425  ret = 0;
1426  }
1427 done:
1428  if (!ret)
1429  {
1430  if (!pszNameString)
1431  ret = 1;
1432  else if (cchNameString)
1433  {
1434  pszNameString[0] = 0;
1435  ret = 1;
1436  }
1437  }
1438  return ret;
1439 }
DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPWSTR psz, DWORD csz)
Definition: str.c:100
#define CERT_NAME_FRIENDLY_DISPLAY_TYPE
Definition: wincrypt.h:3501
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define CERT_NAME_ATTR_TYPE
Definition: wincrypt.h:3499
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
#define CERT_ALT_NAME_DNS_NAME
Definition: wincrypt.h:347
DWORD WINAPI CertNameToStrW(DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:702
#define CERT_ALT_NAME_DIRECTORY_NAME
Definition: wincrypt.h:349
#define CERT_ALT_NAME_URL
Definition: wincrypt.h:351
DWORD dwCertEncodingType
Definition: wincrypt.h:479
Definition: wincrypt.h:332
static DWORD cert_get_name_from_rdn_attr(DWORD encodingType, const CERT_NAME_BLOB *name, LPCSTR oid, LPWSTR pszNameString, DWORD cchNameString)
Definition: str.c:1206
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CERT_NAME_ISSUER_FLAG
Definition: wincrypt.h:3506
#define szOID_COMMON_NAME
Definition: wincrypt.h:3134
#define CERT_NAME_SIMPLE_DISPLAY_TYPE
Definition: wincrypt.h:3500
#define szOID_ORGANIZATIONAL_UNIT_NAME
Definition: wincrypt.h:3142
struct _test_info info[]
Definition: SetCursorPos.c:19
#define X509_ASN_ENCODING
Definition: wincrypt.h:2297
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
BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, DWORD dwPropId, void *pvData, DWORD *pcbData)
Definition: cert.c:551
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
CERT_NAME_BLOB Issuer
Definition: wincrypt.h:244
#define FIXME(fmt,...)
Definition: debug.h:110
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
#define CERT_NAME_EMAIL_TYPE
Definition: wincrypt.h:3497
smooth NULL
Definition: ftsmooth.c:416
#define CERT_FRIENDLY_NAME_PROP_ID
Definition: wincrypt.h:2697
#define szOID_ISSUER_ALT_NAME
Definition: wincrypt.h:3181
#define CERT_NAME_URL_TYPE
Definition: wincrypt.h:3503
const char * LPCSTR
Definition: xmlstorage.h:183
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
#define X509_NAME
Definition: wincrypt.h:3372
#define TRACE(s)
Definition: solgame.cpp:4
PCERT_INFO pCertInfo
Definition: wincrypt.h:482
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CERT_ALT_NAME_RFC822_NAME
Definition: wincrypt.h:346
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CERT_NAME_RDN_TYPE
Definition: wincrypt.h:3498
int ret
PCERT_ALT_NAME_ENTRY rgAltEntry
Definition: wincrypt.h:357
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static PCERT_ALT_NAME_ENTRY cert_find_alt_name_entry(PCCERT_CONTEXT cert, LPCSTR altNameOID, DWORD entryType, PCERT_ALT_NAME_INFO *info)
Definition: str.c:1179
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ARRAY_SIZE(a)
Definition: main.h:24
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define szOID_SUBJECT_ALT_NAME
Definition: wincrypt.h:3180
#define min(a, b)
Definition: monoChain.cc:55
#define szOID_RSA_emailAddr
Definition: wincrypt.h:3035
CERT_NAME_BLOB Subject
Definition: wincrypt.h:247
Definition: name.c:36
DWORD dwValueType
Definition: wincrypt.h:257
DWORD WINAPI CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType, DWORD dwFlags, void *pvTypePara, LPWSTR pszNameString, DWORD cchNameString)
Definition: str.c:1228
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
#define szOID_ORGANIZATION_NAME
Definition: wincrypt.h:3141
#define CERT_NAME_DNS_TYPE
Definition: wincrypt.h:3502
PCERT_RDN_ATTR WINAPI CertFindRDNAttr(LPCSTR pszObjId, PCERT_NAME_INFO pName)
Definition: cert.c:2051
DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:576
_In_ PCCERT_CONTEXT pCertContext
Definition: wincrypt.h:4840
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by add_cert_to_list(), add_cert_to_view(), CertGetNameStringA(), dump_element(), get_cert_name_string(), and GetFriendlyNameOfCertW().

◆ CertNameToStrA()

DWORD WINAPI CertNameToStrA ( DWORD  dwCertEncodingType,
PCERT_NAME_BLOB  pName,
DWORD  dwStrType,
LPSTR  psz,
DWORD  csz 
)

Definition at line 414 of file str.c.

416 {
417  static const DWORD unsupportedFlags = CERT_NAME_STR_NO_QUOTING_FLAG |
419  static const char commaSep[] = ", ";
420  static const char semiSep[] = "; ";
421  static const char crlfSep[] = "\r\n";
422  static const char plusSep[] = " + ";
423  static const char spaceSep[] = " ";
424  DWORD ret = 0, bytes = 0;
425  BOOL bRet;
427 
428  TRACE("(%d, %p, %08x, %p, %d)\n", dwCertEncodingType, pName, dwStrType,
429  psz, csz);
430  if (dwStrType & unsupportedFlags)
431  FIXME("unsupported flags: %08x\n", dwStrType & unsupportedFlags);
432 
435  if (bRet)
436  {
437  DWORD i, j, sepLen, rdnSepLen;
438  LPCSTR sep, rdnSep;
440  const CERT_RDN *rdn = info->rgRDN;
441 
442  if(reverse && info->cRDN > 1) rdn += (info->cRDN - 1);
443 
445  sep = semiSep;
447  sep = crlfSep;
448  else
449  sep = commaSep;
450  sepLen = strlen(sep);
452  rdnSep = spaceSep;
453  else
454  rdnSep = plusSep;
455  rdnSepLen = strlen(rdnSep);
456  for (i = 0; (!psz || ret < csz) && i < info->cRDN; i++)
457  {
458  for (j = 0; (!psz || ret < csz) && j < rdn->cRDNAttr; j++)
459  {
460  DWORD chars;
461  char prefixBuf[13]; /* big enough for SERIALNUMBER */
462  LPCSTR prefix = NULL;
463 
464  if ((dwStrType & 0x000000ff) == CERT_OID_NAME_STR)
465  prefix = rdn->rgRDNAttr[j].pszObjId;
466  else if ((dwStrType & 0x000000ff) == CERT_X500_NAME_STR)
467  {
470  rdn->rgRDNAttr[j].pszObjId,
472 
473  if (oidInfo)
474  {
475  WideCharToMultiByte(CP_ACP, 0, oidInfo->pwszName, -1,
476  prefixBuf, sizeof(prefixBuf), NULL, NULL);
477  prefix = prefixBuf;
478  }
479  else
480  prefix = rdn->rgRDNAttr[j].pszObjId;
481  }
482  if (prefix)
483  {
484  /* - 1 is needed to account for the NULL terminator. */
485  chars = CRYPT_AddPrefixA(prefix,
486  psz ? psz + ret : NULL, psz ? csz - ret - 1 : 0);
487  ret += chars;
488  }
489  chars = quote_rdn_value_to_str_a(
490  rdn->rgRDNAttr[j].dwValueType,
491  &rdn->rgRDNAttr[j].Value, psz ? psz + ret : NULL,
492  psz ? csz - ret : 0);
493  if (chars)
494  ret += chars - 1;
495  if (j < rdn->cRDNAttr - 1)
496  {
497  if (psz && ret < csz - rdnSepLen - 1)
498  memcpy(psz + ret, rdnSep, rdnSepLen);
499  ret += rdnSepLen;
500  }
501  }
502  if (i < info->cRDN - 1)
503  {
504  if (psz && ret < csz - sepLen - 1)
505  memcpy(psz + ret, sep, sepLen);
506  ret += sepLen;
507  }
508  if(reverse) rdn--;
509  else rdn++;
510  }
511  LocalFree(info);
512  }
513  if (psz && csz)
514  {
515  *(psz + ret) = '\0';
516  ret++;
517  }
518  else
519  ret++;
520  TRACE("Returning %s\n", debugstr_a(psz));
521  return ret;
522 }
PCERT_RDN_ATTR rgRDNAttr
Definition: wincrypt.h:263
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3487
#define CERT_X500_NAME_STR
Definition: wincrypt.h:3486
#define WideCharToMultiByte
Definition: compat.h:101
BOOL WINAPI CryptDecodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo)
Definition: decode.c:6286
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
static const WCHAR commaSep[]
Definition: main.c:520
struct _test_info info[]
Definition: SetCursorPos.c:19
_STLP_MOVE_TO_STD_NAMESPACE void reverse(_BidirectionalIter __first, _BidirectionalIter __last)
Definition: _algo.h:332
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3489
static struct list oidInfo
Definition: oid.c:1206
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 unsigned char bytes[4]
Definition: adnsresfilter.c:74
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CERT_OID_NAME_STR
Definition: wincrypt.h:3485
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
const char * LPCSTR
Definition: xmlstorage.h:183
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:258
#define X509_NAME
Definition: wincrypt.h:3372
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
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3488
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
static LPCSTR DWORD dwStrType
Definition: str.c:196
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1688
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1702
#define CERT_NAME_STR_REVERSE_FLAG
Definition: wincrypt.h:3492
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
DWORD dwValueType
Definition: wincrypt.h:257
#define CERT_NAME_STR_ENABLE_T61_UNICODE_FLAG
Definition: wincrypt.h:3494
#define CRYPT_DECODE_ALLOC_FLAG
Definition: wincrypt.h:3454
static DWORD CRYPT_AddPrefixA(LPCSTR prefix, LPSTR psz, DWORD csz)
Definition: str.c:396
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
static DWORD quote_rdn_value_to_str_a(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue, LPSTR psz, DWORD csz)
Definition: str.c:179
LPSTR pszObjId
Definition: wincrypt.h:256

Referenced by _test_name_blob(), and HTTPREQ_QueryOption().

◆ CertNameToStrW()

DWORD WINAPI CertNameToStrW ( DWORD  dwCertEncodingType,
PCERT_NAME_BLOB  pName,
DWORD  dwStrType,
LPWSTR  psz,
DWORD  csz 
)

Definition at line 702 of file str.c.

704 {
705  BOOL ret;
706 
707  TRACE("(%d, %p, %08x, %p, %d)\n", dwCertEncodingType, pName, dwStrType,
708  psz, csz);
709 
711  psz, csz);
712  TRACE("Returning %s\n", debugstr_w(psz));
713  return ret;
714 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static LPSTR pName
Definition: security.c:75
static LPCSTR DWORD dwStrType
Definition: str.c:196
int ret
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
DWORD cert_name_to_str_with_indent(DWORD dwCertEncodingType, DWORD indentLevel, const CERT_NAME_BLOB *pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:576

Referenced by blob_to_str(), CertGetNameStringW(), compare_cert_by_name_str(), and field_format_detailed_cert_name().

◆ CertRDNValueToStrA()

DWORD WINAPI CertRDNValueToStrA ( DWORD  dwValueType,
PCERT_RDN_VALUE_BLOB  pValue,
LPSTR  psz,
DWORD  csz 
)

Definition at line 33 of file str.c.

35 {
36  DWORD ret = 0, len;
37 
38  TRACE("(%d, %p, %p, %d)\n", dwValueType, pValue, psz, csz);
39 
40  switch (dwValueType)
41  {
42  case CERT_RDN_ANY_TYPE:
43  break;
52  len = pValue->cbData;
53  if (!psz || !csz)
54  ret = len;
55  else
56  {
57  DWORD chars = min(len, csz - 1);
58 
59  if (chars)
60  {
61  memcpy(psz, pValue->pbData, chars);
62  ret += chars;
63  csz -= chars;
64  }
65  }
66  break;
70  pValue->cbData / sizeof(WCHAR), NULL, 0, NULL, NULL);
71  if (!psz || !csz)
72  ret = len;
73  else
74  {
75  DWORD chars = min(pValue->cbData / sizeof(WCHAR), csz - 1);
76 
77  if (chars)
78  {
80  chars, psz, csz - 1, NULL, NULL);
81  csz -= ret;
82  }
83  }
84  break;
85  default:
86  FIXME("string type %d unimplemented\n", dwValueType);
87  }
88  if (psz && csz)
89  {
90  *(psz + ret) = '\0';
91  csz--;
92  ret++;
93  }
94  else
95  ret++;
96  TRACE("returning %d (%s)\n", ret, debugstr_a(psz));
97  return ret;
98 }
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2785
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2779
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2788
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2781
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2786
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
int ret
BYTE * pbData
Definition: wincrypt.h:103
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2783
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2776
#define min(a, b)
Definition: monoChain.cc:55
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780

Referenced by get_cert_common_name().

◆ CertRDNValueToStrW()

DWORD WINAPI CertRDNValueToStrW ( DWORD  dwValueType,
PCERT_RDN_VALUE_BLOB  pValue,
LPWSTR  psz,
DWORD  csz 
)

Definition at line 100 of file str.c.

102 {
103  DWORD ret = 0, len, i, strLen;
104 
105  TRACE("(%d, %p, %p, %d)\n", dwValueType, pValue, psz, csz);
106 
107  switch (dwValueType)
108  {
109  case CERT_RDN_ANY_TYPE:
110  break;
115  case CERT_RDN_IA5_STRING:
119  len = pValue->cbData;
120  if (!psz || !csz)
121  ret = len;
122  else
123  {
124  WCHAR *ptr = psz;
125 
126  for (i = 0; i < pValue->cbData && ptr - psz < csz; ptr++, i++)
127  *ptr = pValue->pbData[i];
128  ret = ptr - psz;
129  }
130  break;
131  case CERT_RDN_BMP_STRING:
133  strLen = len = pValue->cbData / sizeof(WCHAR);
134  if (!psz || !csz)
135  ret = len;
136  else
137  {
138  WCHAR *ptr = psz;
139 
140  for (i = 0; i < strLen && ptr - psz < csz; ptr++, i++)
141  *ptr = ((LPCWSTR)pValue->pbData)[i];
142  ret = ptr - psz;
143  }
144  break;
145  default:
146  FIXME("string type %d unimplemented\n", dwValueType);
147  }
148  if (psz && csz)
149  {
150  *(psz + ret) = '\0';
151  csz--;
152  ret++;
153  }
154  else
155  ret++;
156  TRACE("returning %d (%s)\n", ret, debugstr_w(psz));
157  return ret;
158 }
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2785
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
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2779
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2788
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2781
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2786
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
int ret
BYTE * pbData
Definition: wincrypt.h:103
GLenum GLsizei len
Definition: glext.h:6722
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2783
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2776
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780

Referenced by cert_get_name_from_rdn_attr(), CertGetNameStringW(), and get_cps_str_from_qualifier().

◆ CertStrToNameA()

BOOL WINAPI CertStrToNameA ( DWORD  dwCertEncodingType,
LPCSTR  pszX500,
DWORD  dwStrType,
void pvReserved,
BYTE pbEncoded,
DWORD pcbEncoded,
LPCSTR ppszError 
)

Definition at line 716 of file str.c.

719 {
720  BOOL ret;
721  int len;
722 
723  TRACE("(%08x, %s, %08x, %p, %p, %p, %p)\n", dwCertEncodingType,
725  ppszError);
726 
727  len = MultiByteToWideChar(CP_ACP, 0, pszX500, -1, NULL, 0);
728  if (len)
729  {
730  LPWSTR x500, errorStr;
731 
732  if ((x500 = CryptMemAlloc(len * sizeof(WCHAR))))
733  {
734  MultiByteToWideChar(CP_ACP, 0, pszX500, -1, x500, len);
737  ppszError ? (LPCWSTR *)&errorStr : NULL);
738  if (ppszError)
739  {
740  if (!ret)
741  {
742  LONG i;
743 
744  *ppszError = pszX500;
745  for (i = 0; i < errorStr - x500; i++)
747  }
748  else
749  *ppszError = NULL;
750  }
751  CryptMemFree(x500);
752  }
753  else
754  {
756  ret = FALSE;
757  }
758  }
759  else
760  {
762  if (ppszError)
763  *ppszError = pszX500;
764  ret = FALSE;
765  }
766  return ret;
767 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
LPSTR WINAPI CharNextA(_In_ LPCSTR)
#define CRYPT_E_INVALID_X500_STRING
Definition: winerror.h:3027
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
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static LPCSTR pszX500
Definition: str.c:196
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD dwStrType
Definition: str.c:196
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500, DWORD dwStrType, void *pvReserved, BYTE *pbEncoded, DWORD *pcbEncoded, LPCWSTR *ppszError)
Definition: str.c:1024
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
#define MultiByteToWideChar
Definition: compat.h:100
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

◆ CertStrToNameW()

BOOL WINAPI CertStrToNameW ( DWORD  dwCertEncodingType,
LPCWSTR  pszX500,
DWORD  dwStrType,
void pvReserved,
BYTE pbEncoded,
DWORD pcbEncoded,
LPCWSTR ppszError 
)

Definition at line 1024 of file str.c.

1027 {
1028  CERT_NAME_INFO info = { 0, NULL };
1029  LPCWSTR str;
1030  struct KeynameKeeper keeper;
1031  DWORD i;
1032  BOOL ret = TRUE;
1033 
1034  TRACE("(%08x, %s, %08x, %p, %p, %p, %p)\n", dwCertEncodingType,
1036  ppszError);
1037 
1039  str = pszX500;
1040  while (str && *str && ret)
1041  {
1042  struct X500TokenW token;
1043 
1045  if (ret && token.start)
1046  {
1047  PCCRYPT_OID_INFO keyOID;
1048 
1050  keyOID = CryptFindOIDInfo(CRYPT_OID_INFO_NAME_KEY, keeper.keyName,
1052  if (!keyOID)
1053  {
1054  if (ppszError)
1055  *ppszError = token.start;
1057  ret = FALSE;
1058  }
1059  else
1060  {
1061  str = token.end;
1062  while (isspaceW(*str))
1063  str++;
1064  if (*str != '=')
1065  {
1066  if (ppszError)
1067  *ppszError = str;
1069  ret = FALSE;
1070  }
1071  else
1072  {
1073  static const WCHAR commaSep[] = { ',',0 };
1074  static const WCHAR semiSep[] = { ';',0 };
1075  static const WCHAR crlfSep[] = { '\r','\n',0 };
1076  static const WCHAR allSepsWithoutPlus[] = { ',',';','\r','\n',0 };
1077  static const WCHAR allSeps[] = { '+',',',';','\r','\n',0 };
1078  LPCWSTR sep;
1079  WCHAR sep_used;
1080 
1081  str++;
1083  sep = commaSep;
1085  sep = semiSep;
1087  sep = crlfSep;
1089  sep = allSepsWithoutPlus;
1090  else
1091  sep = allSeps;
1092  ret = CRYPT_GetNextValueW(str, dwStrType, sep, &sep_used, &token,
1093  ppszError);
1094  if (ret)
1095  {
1096  str = token.end;
1097  /* if token.end points to the separator, skip it */
1098  if (str && sep_used && *str == sep_used) str++;
1099 
1101  keyOID, &token, dwStrType, ppszError);
1102  }
1103  }
1104  }
1105  }
1106  }
1107  CRYPT_FreeKeynameKeeper(&keeper);
1108  if (ret)
1109  {
1110  if (ppszError)
1111  *ppszError = NULL;
1113  0, NULL, pbEncoded, pcbEncoded);
1114  }
1115  for (i = 0; i < info.cRDN; i++)
1116  {
1117  DWORD j;
1118 
1119  for (j = 0; j < info.rgRDN[i].cRDNAttr; j++)
1120  LocalFree(info.rgRDN[i].rgRDNAttr[j].Value.pbData);
1121  CryptMemFree(info.rgRDN[i].rgRDNAttr);
1122  }
1123  CryptMemFree(info.rgRDN);
1124  return ret;
1125 }
#define CERT_NAME_STR_SEMICOLON_FLAG
Definition: wincrypt.h:3487
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CERT_NAME_STR_COMMA_FLAG
Definition: wincrypt.h:3491
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators, WCHAR *separator_used, struct X500TokenW *token, LPCWSTR *ppszError)
Definition: str.c:839
BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded)
Definition: encode.c:4696
static const WCHAR commaSep[]
Definition: main.c:520
static BOOL CRYPT_ValueToRDN(DWORD dwCertEncodingType, PCERT_NAME_INFO info, PCCRYPT_OID_INFO keyOID, struct X500TokenW *value, DWORD dwStrType, LPCWSTR *ppszError)
Definition: str.c:972
static void CRYPT_InitializeKeynameKeeper(struct KeynameKeeper *keeper)
Definition: str.c:776
#define CRYPT_E_INVALID_X500_STRING
Definition: winerror.h:3027
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
unsigned int BOOL
Definition: ntddk_ex.h:94
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 token
Definition: glfuncs.h:210
#define debugstr_w
Definition: kernel32.h:32
static LPCSTR pszX500
Definition: str.c:196
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
smooth NULL
Definition: ftsmooth.c:416
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
#define X509_NAME
Definition: wincrypt.h:3372
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
#define CERT_NAME_STR_NO_PLUS_FLAG
Definition: wincrypt.h:3488
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD dwStrType
Definition: str.c:196
static DWORD DWORD void LPSTR str
Definition: str.c:201
__wchar_t WCHAR
Definition: xmlstorage.h:180
static LPCSTR DWORD void BYTE * pbEncoded
Definition: str.c:196
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CRYPT_RDN_ATTR_OID_GROUP_ID
Definition: wincrypt.h:1688
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
static LPCSTR DWORD void BYTE DWORD * pcbEncoded
Definition: str.c:196
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
static void CRYPT_FreeKeynameKeeper(struct KeynameKeeper *keeper)
Definition: str.c:782
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
#define CRYPT_OID_INFO_NAME_KEY
Definition: wincrypt.h:1703
static BOOL CRYPT_GetNextKeyW(LPCWSTR str, struct X500TokenW *token, LPCWSTR *ppszError)
Definition: str.c:810
static void CRYPT_KeynameKeeperFromTokenW(struct KeynameKeeper *keeper, const struct X500TokenW *key)
Definition: str.c:794

Referenced by CertStrToNameA(), and testGetIssuerCert().

◆ CRYPT_AddPrefixA()

static DWORD CRYPT_AddPrefixA ( LPCSTR  prefix,
LPSTR  psz,
DWORD  csz 
)
static

Definition at line 396 of file str.c.

397 {
398  DWORD chars;
399 
400  TRACE("(%s, %p, %d)\n", debugstr_a(prefix), psz, csz);
401 
402  if (psz)
403  {
404  chars = min(strlen(prefix), csz);
405  memcpy(psz, prefix, chars);
406  *(psz + chars) = '=';
407  chars++;
408  }
409  else
410  chars = lstrlenA(prefix) + 1;
411  return chars;
412 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define min(a, b)
Definition: monoChain.cc:55

Referenced by CertNameToStrA().

◆ CRYPT_AddPrefixAToW()

static DWORD CRYPT_AddPrefixAToW ( LPCSTR  prefix,
LPWSTR  psz,
DWORD  csz 
)
static

Definition at line 530 of file str.c.

531 {
532  DWORD chars;
533 
534  TRACE("(%s, %p, %d)\n", debugstr_a(prefix), psz, csz);
535 
536  if (psz)
537  {
538  DWORD i;
539 
540  chars = min(strlen(prefix), csz);
541  for (i = 0; i < chars; i++)
542  *(psz + i) = prefix[i];
543  *(psz + chars) = '=';
544  chars++;
545  }
546  else
547  chars = lstrlenA(prefix) + 1;
548  return chars;
549 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define min(a, b)
Definition: monoChain.cc:55

Referenced by cert_name_to_str_with_indent().

◆ CRYPT_AddPrefixW()

static DWORD CRYPT_AddPrefixW ( LPCWSTR  prefix,
LPWSTR  psz,
DWORD  csz 
)
static

Definition at line 556 of file str.c.

557 {
558  DWORD chars;
559 
560  TRACE("(%s, %p, %d)\n", debugstr_w(prefix), psz, csz);
561 
562  if (psz)
563  {
564  chars = min(strlenW(prefix), csz);
565  memcpy(psz, prefix, chars * sizeof(WCHAR));
566  *(psz + chars) = '=';
567  chars++;
568  }
569  else
570  chars = lstrlenW(prefix) + 1;
571  return chars;
572 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55

Referenced by cert_name_to_str_with_indent().

◆ CRYPT_EncodeValue()

static BOOL CRYPT_EncodeValue ( DWORD  dwCertEncodingType,
const struct X500TokenW value,
PCERT_NAME_BLOB  output,
const DWORD types,
LPCWSTR ppszError 
)
static

Definition at line 958 of file str.c.

961 {
962  DWORD i;
963  BOOL ret;
964 
965  ret = FALSE;
966  for (i = 0; !ret && types[i]; i++)
968  types[i], ppszError);
969  return ret;
970 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static BOOL CRYPT_EncodeValueWithType(DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, DWORD type, LPCWSTR *ppszError)
Definition: str.c:906
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
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
Definition: cmds.c:130
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041

Referenced by CRYPT_ValueToRDN().

◆ CRYPT_EncodeValueWithType()

static BOOL CRYPT_EncodeValueWithType ( DWORD  dwCertEncodingType,
const struct X500TokenW value,
PCERT_NAME_BLOB  output,
DWORD  type,
LPCWSTR ppszError 
)
static

Definition at line 906 of file str.c.

909 {
910  CERT_NAME_VALUE nameValue = { type, { 0, NULL } };
911  BOOL ret = TRUE;
912 
913  if (value->end > value->start)
914  {
915  LONG i;
916  LPWSTR ptr;
917 
918  nameValue.Value.pbData = CryptMemAlloc((value->end - value->start + 1) *
919  sizeof(WCHAR));
920  if (!nameValue.Value.pbData)
921  {
923  return FALSE;
924  }
925  ptr = (LPWSTR)nameValue.Value.pbData;
926  for (i = 0; i < value->end - value->start; i++)
927  {
928  *ptr++ = value->start[i];
929  if (value->start[i] == '"')
930  i++;
931  }
932  /* The string is NULL terminated because of a quirk in encoding
933  * unicode names values: if the length is given as 0, the value is
934  * assumed to be a NULL-terminated string.
935  */
936  *ptr = 0;
937  nameValue.Value.cbData = (LPBYTE)ptr - nameValue.Value.pbData;
938  }
940  &nameValue, CRYPT_ENCODE_ALLOC_FLAG, NULL, &output->pbData,
941  &output->cbData);
942  if (!ret && ppszError)
943  {
944  if (type == CERT_RDN_NUMERIC_STRING &&
946  *ppszError = value->start + output->cbData;
947  else if (type == CERT_RDN_PRINTABLE_STRING &&
949  *ppszError = value->start + output->cbData;
950  else if (type == CERT_RDN_IA5_STRING &&
952  *ppszError = value->start + output->cbData;
953  }
954  CryptMemFree(nameValue.Value.pbData);
955  return ret;
956 }
#define TRUE
Definition: types.h:120
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
#define CRYPT_E_INVALID_NUMERIC_STRING
Definition: winerror.h:3024
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded)
Definition: encode.c:4696
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static DWORD type
Definition: str.c:201
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
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static PVOID ptr
Definition: dispmode.c:27
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
smooth NULL
Definition: ftsmooth.c:416
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2779
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define for
Definition: utility.h:88
#define SetLastError(x)
Definition: compat.h:409
int ret
BYTE * pbData
Definition: wincrypt.h:103
CERT_RDN_VALUE_BLOB Value
Definition: wincrypt.h:273
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define CRYPT_E_INVALID_PRINTABLE_STRING
Definition: winerror.h:3025
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
#define CRYPT_ENCODE_ALLOC_FLAG
Definition: wincrypt.h:3441
#define CRYPT_E_INVALID_IA5_STRING
Definition: winerror.h:3026
static LPWSTR
Definition: str.c:190
#define X509_UNICODE_NAME_VALUE
Definition: wincrypt.h:3389
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by CRYPT_EncodeValue().

◆ CRYPT_FreeKeynameKeeper()

static void CRYPT_FreeKeynameKeeper ( struct KeynameKeeper keeper)
static

Definition at line 782 of file str.c.

783 {
784  if (keeper->keyName != keeper->buf)
785  CryptMemFree(keeper->keyName);
786 }
VOID WINAPI CryptMemFree(LPVOID pv)
Definition: main.c:141
WCHAR buf[10]
Definition: str.c:771
LPWSTR keyName
Definition: str.c:772

Referenced by CertStrToNameW(), and CRYPT_KeynameKeeperFromTokenW().

◆ CRYPT_GetNextKeyW()

static BOOL CRYPT_GetNextKeyW ( LPCWSTR  str,
struct X500TokenW token,
LPCWSTR ppszError 
)
static

Definition at line 810 of file str.c.

812 {
813  BOOL ret = TRUE;
814 
815  while (*str && isspaceW(*str))
816  str++;
817  if (*str)
818  {
819  token->start = str;
820  while (*str && *str != '=' && !isspaceW(*str))
821  str++;
822  if (*str && (*str == '=' || isspaceW(*str)))
823  token->end = str;
824  else
825  {
826  TRACE("missing equals char at %s\n", debugstr_w(token->start));
827  if (ppszError)
828  *ppszError = token->start;
830  ret = FALSE;
831  }
832  }
833  else
834  token->start = NULL;
835  return ret;
836 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define CRYPT_E_INVALID_X500_STRING
Definition: winerror.h:3027
unsigned int BOOL
Definition: ntddk_ex.h:94
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 token
Definition: glfuncs.h:210
#define debugstr_w
Definition: kernel32.h:32
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD DWORD void LPSTR str
Definition: str.c:201
#define SetLastError(x)
Definition: compat.h:409
int ret

Referenced by CertStrToNameW().

◆ CRYPT_GetNextValueW()

static BOOL CRYPT_GetNextValueW ( LPCWSTR  str,
DWORD  dwFlags,
LPCWSTR  separators,
WCHAR separator_used,
struct X500TokenW token,
LPCWSTR ppszError 
)
static

Definition at line 839 of file str.c.

841 {
842  BOOL ret = TRUE;
843 
844  TRACE("(%s, %s, %p, %p)\n", debugstr_w(str), debugstr_w(separators), token,
845  ppszError);
846 
847  *separator_used = 0;
848  while (*str && isspaceW(*str))
849  str++;
850  if (*str)
851  {
852  token->start = str;
853  if (!(dwFlags & CERT_NAME_STR_NO_QUOTING_FLAG) && *str == '"')
854  {
855  token->end = NULL;
856  str++;
857  while (!token->end && ret)
858  {
859  while (*str && *str != '"')
860  str++;
861  if (*str == '"')
862  {
863  if (*(str + 1) != '"')
864  token->end = str + 1;
865  else
866  str += 2;
867  }
868  else
869  {
870  TRACE("unterminated quote at %s\n", debugstr_w(str));
871  if (ppszError)
872  *ppszError = str;
874  ret = FALSE;
875  }
876  }
877  }
878  else
879  {
880  WCHAR map[256] = { 0 };
881 
882  while (*separators)
883  map[*separators++] = 1;
884  while (*str && (*str >= 0xff || !map[*str]))
885  str++;
886  token->end = str;
887  if (map[*str]) *separator_used = *str;
888  }
889  }
890  else
891  {
892  TRACE("missing value at %s\n", debugstr_w(str));
893  if (ppszError)
894  *ppszError = str;
896  ret = FALSE;
897  }
898  return ret;
899 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define CRYPT_E_INVALID_X500_STRING
Definition: winerror.h:3027
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3489
unsigned int BOOL
Definition: ntddk_ex.h:94
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 token
Definition: glfuncs.h:210
#define debugstr_w
Definition: kernel32.h:32
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD DWORD void LPSTR str
Definition: str.c:201
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
Definition: _map.h:44
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by CertStrToNameW().

◆ CRYPT_InitializeKeynameKeeper()

static void CRYPT_InitializeKeynameKeeper ( struct KeynameKeeper keeper)
static

Definition at line 776 of file str.c.

777 {
778  keeper->keyName = keeper->buf;
779  keeper->keyLen = ARRAY_SIZE(keeper->buf);
780 }
DWORD keyLen
Definition: str.c:773
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR buf[10]
Definition: str.c:771
LPWSTR keyName
Definition: str.c:772

Referenced by CertStrToNameW().

◆ CRYPT_KeynameKeeperFromTokenW()

static void CRYPT_KeynameKeeperFromTokenW ( struct KeynameKeeper keeper,
const struct X500TokenW key 
)
static

Definition at line 794 of file str.c.

796 {
797  DWORD len = key->end - key->start;
798 
799  if (len >= keeper->keyLen)
800  {
801  CRYPT_FreeKeynameKeeper( keeper );
802  keeper->keyLen = len + 1;
803  keeper->keyName = CryptMemAlloc(keeper->keyLen * sizeof(WCHAR));
804  }
805  memcpy(keeper->keyName, key->start, len * sizeof(WCHAR));
806  keeper->keyName[len] = '\0';
807  TRACE("Keyname is %s\n", debugstr_w(keeper->keyName));
808 }
DWORD keyLen
Definition: str.c:773
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static void CRYPT_FreeKeynameKeeper(struct KeynameKeeper *keeper)
Definition: str.c:782
LPWSTR keyName
Definition: str.c:772
Definition: path.c:42

Referenced by CertStrToNameW().

◆ CRYPT_ValueToRDN()

static BOOL CRYPT_ValueToRDN ( DWORD  dwCertEncodingType,
PCERT_NAME_INFO  info,
PCCRYPT_OID_INFO  keyOID,
struct X500TokenW value,
DWORD  dwStrType,
LPCWSTR ppszError 
)
static

Definition at line 972 of file str.c.

974 {
975  BOOL ret = FALSE;
976 
977  TRACE("OID %s, value %s\n", debugstr_a(keyOID->pszOID),
978  debugstr_wn(value->start, value->end - value->start));
979 
980  if (!info->rgRDN)
981  info->rgRDN = CryptMemAlloc(sizeof(CERT_RDN));
982  else
983  info->rgRDN = CryptMemRealloc(info->rgRDN,
984  (info->cRDN + 1) * sizeof(CERT_RDN));
985  if (info->rgRDN)
986  {
987  /* FIXME: support multiple RDN attrs */
988  info->rgRDN[info->cRDN].rgRDNAttr =
989  CryptMemAlloc(sizeof(CERT_RDN_ATTR));
990  if (info->rgRDN[info->cRDN].rgRDNAttr)
991  {
992  static const DWORD defaultTypes[] = { CERT_RDN_PRINTABLE_STRING,
993  CERT_RDN_BMP_STRING, 0 };
994  const DWORD *types;
995 
996  info->rgRDN[info->cRDN].cRDNAttr = 1;
997  info->rgRDN[info->cRDN].rgRDNAttr[0].pszObjId =
998  (LPSTR)keyOID->pszOID;
999  info->rgRDN[info->cRDN].rgRDNAttr[0].dwValueType =
1001  if (keyOID->ExtraInfo.cbData)
1002  types = (const DWORD *)keyOID->ExtraInfo.pbData;
1003  else
1004  types = defaultTypes;
1005 
1006  /* Remove surrounding quotes */
1007  if (value->start[0] == '"' && !(dwStrType & CERT_NAME_STR_NO_QUOTING_FLAG))
1008  {
1009  value->start++;
1010  value->end--;
1011  }
1013  &info->rgRDN[info->cRDN].rgRDNAttr[0].Value, types, ppszError);
1014  }
1015  else
1017  info->cRDN++;
1018  }
1019  else
1021  return ret;
1022 }
CRYPT_DATA_BLOB ExtraInfo
Definition: wincrypt.h:1412
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
#define CERT_RDN_ENCODED_BLOB
Definition: wincrypt.h:2777
GLsizei GLenum GLenum * types
Definition: glext.h:7753
#define CERT_NAME_STR_NO_QUOTING_FLAG
Definition: wincrypt.h:3489
LPVOID WINAPI CryptMemAlloc(ULONG cbSize)
Definition: main.c:131
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPCSTR DWORD void BYTE DWORD LPCSTR * ppszError
Definition: str.c:196
static BOOL CRYPT_EncodeValue(DWORD dwCertEncodingType, const struct X500TokenW *value, PCERT_NAME_BLOB output, const DWORD *types, LPCWSTR *ppszError)
Definition: str.c:958
static LPSTR
Definition: str.c:189
#define TRACE(s)
Definition: solgame.cpp:4
static LPCSTR DWORD dwStrType
Definition: str.c:196
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: cmds.c:130
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
Definition: main.c:136
int ret
BYTE * pbData
Definition: wincrypt.h:103
#define debugstr_wn
Definition: kernel32.h:33
_In_ DWORD dwCertEncodingType
Definition: wincrypt.h:5041
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by CertStrToNameW().

◆ is_quotable_char()

static BOOL is_quotable_char ( char  c)
inlinestatic

Definition at line 160 of file str.c.

161 {
162  switch(c)
163  {
164  case '+':
165  case ',':
166  case '"':
167  case '=':
168  case '<':
169  case '>':
170  case ';':
171  case '#':
172  case '\n':
173  return TRUE;
174  default:
175  return FALSE;
176  }
177 }
#define TRUE
Definition: types.h:120
const GLubyte * c
Definition: glext.h:8905

Referenced by quote_rdn_value_to_str_a(), and quote_rdn_value_to_str_w().

◆ quote_rdn_value_to_str_a()

static DWORD quote_rdn_value_to_str_a ( DWORD  dwValueType,
PCERT_RDN_VALUE_BLOB  pValue,
LPSTR  psz,
DWORD  csz 
)
static

Definition at line 179 of file str.c.

181 {
182  DWORD ret = 0, len, i;
183  BOOL needsQuotes = FALSE;
184 
185  TRACE("(%d, %p, %p, %d)\n", dwValueType, pValue, psz, csz);
186 
187  switch (dwValueType)
188  {
189  case CERT_RDN_ANY_TYPE:
190  break;
195  case CERT_RDN_IA5_STRING:
199  len = pValue->cbData;
200  if (pValue->cbData && isspace(pValue->pbData[0]))
201  needsQuotes = TRUE;
202  if (pValue->cbData && isspace(pValue->pbData[pValue->cbData - 1]))
203  needsQuotes = TRUE;
204  for (i = 0; i < pValue->cbData; i++)
205  {
206  if (is_quotable_char(pValue->pbData[i]))
207  needsQuotes = TRUE;
208  if (pValue->pbData[i] == '"')
209  len += 1;
210  }
211  if (needsQuotes)
212  len += 2;
213  if (!psz || !csz)
214  ret = len;
215  else
216  {
217  char *ptr = psz;
218 
219  if (needsQuotes)
220  *ptr++ = '"';
221  for (i = 0; i < pValue->cbData && ptr - psz < csz; ptr++, i++)
222  {
223  *ptr = pValue->pbData[i];
224  if (pValue->pbData[i] == '"' && ptr - psz < csz - 1)
225  *(++ptr) = '"';
226  }
227  if (needsQuotes && ptr - psz < csz)
228  *ptr++ = '"';
229  ret = ptr - psz;
230  }
231  break;
232  case CERT_RDN_BMP_STRING:
235  pValue->cbData / sizeof(WCHAR), NULL, 0, NULL, NULL);
236  if (pValue->cbData && isspaceW(((LPCWSTR)pValue->pbData)[0]))
237  needsQuotes = TRUE;
238  if (pValue->cbData &&
239  isspaceW(((LPCWSTR)pValue->pbData)[pValue->cbData / sizeof(WCHAR)-1]))
240  needsQuotes = TRUE;
241  for (i = 0; i < pValue->cbData / sizeof(WCHAR); i++)
242  {
243  if (is_quotable_char(((LPCWSTR)pValue->pbData)[i]))
244  needsQuotes = TRUE;
245  if (((LPCWSTR)pValue->pbData)[i] == '"')
246  len += 1;
247  }
248  if (needsQuotes)
249  len += 2;
250  if (!psz || !csz)
251  ret = len;
252  else
253  {
254  char *dst = psz;
255 
256  if (needsQuotes)
257  *dst++ = '"';
258  for (i = 0; i < pValue->cbData / sizeof(WCHAR) &&
259  dst - psz < csz; dst++, i++)
260  {
261  LPCWSTR src = (LPCWSTR)pValue->pbData + i;
262 
264  csz - (dst - psz) - 1, NULL, NULL);
265  if (*src == '"' && dst - psz < csz - 1)
266  *(++dst) = '"';
267  }
268  if (needsQuotes && dst - psz < csz)
269  *dst++ = '"';
270  ret = dst - psz;
271  }
272  break;
273  default:
274  FIXME("string type %d unimplemented\n", dwValueType);
275  }
276  if (psz && csz)
277  {
278  *(psz + ret) = '\0';
279  csz--;
280  ret++;
281  }
282  else
283  ret++;
284  TRACE("returning %d (%s)\n", ret, debugstr_a(psz));
285  return ret;
286 }
#define isspace(c)
Definition: acclib.h:69
#define TRUE
Definition: types.h:120
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2785
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2779
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2788
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2781
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL is_quotable_char(char c)
Definition: str.c:160
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2786
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
int ret
BYTE * pbData
Definition: wincrypt.h:103
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2783
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2776
GLenum GLenum dst
Definition: glext.h:6340
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780

Referenced by CertNameToStrA().

◆ quote_rdn_value_to_str_w()

static DWORD quote_rdn_value_to_str_w ( DWORD  dwValueType,
PCERT_RDN_VALUE_BLOB  pValue,
LPWSTR  psz,
DWORD  csz 
)
static

Definition at line 288 of file str.c.

290 {
291  DWORD ret = 0, len, i, strLen;
292  BOOL needsQuotes = FALSE;
293 
294  TRACE("(%d, %p, %p, %d)\n", dwValueType, pValue, psz, csz);
295 
296  switch (dwValueType)
297  {
298  case CERT_RDN_ANY_TYPE:
299  break;
304  case CERT_RDN_IA5_STRING:
308  len = pValue->cbData;
309  if (pValue->cbData && isspace(pValue->pbData[0]))
310  needsQuotes = TRUE;
311  if (pValue->cbData && isspace(pValue->pbData[pValue->cbData - 1]))
312  needsQuotes = TRUE;
313  for (i = 0; i < pValue->cbData; i++)
314  {
315  if (is_quotable_char(pValue->pbData[i]))
316  needsQuotes = TRUE;
317  if (pValue->pbData[i] == '"')
318  len += 1;
319  }
320  if (needsQuotes)
321  len += 2;
322  if (!psz || !csz)
323  ret = len;
324  else
325  {
326  WCHAR *ptr = psz;
327 
328  if (needsQuotes)
329  *ptr++ = '"';
330  for (i = 0; i < pValue->cbData && ptr - psz < csz; ptr++, i++)
331  {
332  *ptr = pValue->pbData[i];
333  if (pValue->pbData[i] == '"' && ptr - psz < csz - 1)
334  *(++ptr) = '"';
335  }
336  if (needsQuotes && ptr - psz < csz)
337  *ptr++ = '"';
338  ret = ptr - psz;
339  }
340  break;
341  case CERT_RDN_BMP_STRING:
343  strLen = len = pValue->cbData / sizeof(WCHAR);
344  if (pValue->cbData && isspace(pValue->pbData[0]))
345  needsQuotes = TRUE;
346  if (pValue->cbData && isspace(pValue->pbData[strLen - 1]))
347  needsQuotes = TRUE;
348  for (i = 0; i < strLen; i++)
349  {
350  if (is_quotable_char(((LPCWSTR)pValue->pbData)[i]))
351  needsQuotes = TRUE;
352  if (((LPCWSTR)pValue->pbData)[i] == '"')
353  len += 1;
354  }
355  if (needsQuotes)
356  len += 2;
357  if (!psz || !csz)
358  ret = len;
359  else
360  {
361  WCHAR *ptr = psz;
362 
363  if (needsQuotes)
364  *ptr++ = '"';
365  for (i = 0; i < strLen && ptr - psz < csz; ptr++, i++)
366  {
367  *ptr = ((LPCWSTR)pValue->pbData)[i];
368  if (((LPCWSTR)pValue->pbData)[i] == '"' && ptr - psz < csz - 1)
369  *(++ptr) = '"';
370  }
371  if (needsQuotes && ptr - psz < csz)
372  *ptr++ = '"';
373  ret = ptr - psz;
374  }
375  break;
376  default:
377  FIXME("string type %d unimplemented\n", dwValueType);
378  }
379  if (psz && csz)
380  {
381  *(psz + ret) = '\0';
382  csz--;
383  ret++;
384  }
385  else
386  ret++;
387  TRACE("returning %d (%s)\n", ret, debugstr_w(psz));
388  return ret;
389 }
#define isspace(c)
Definition: acclib.h:69
#define TRUE
Definition: types.h:120
#define CERT_RDN_BMP_STRING
Definition: wincrypt.h:2791
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CERT_RDN_IA5_STRING
Definition: wincrypt.h:2784
#define CERT_RDN_GRAPHIC_STRING
Definition: wincrypt.h:2785
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define CERT_RDN_NUMERIC_STRING
Definition: wincrypt.h:2779
#define CERT_RDN_GENERAL_STRING
Definition: wincrypt.h:2788
#define CERT_RDN_TELETEX_STRING
Definition: wincrypt.h:2781
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL is_quotable_char(char c)
Definition: str.c:160
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CERT_RDN_VISIBLE_STRING
Definition: wincrypt.h:2786
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CERT_RDN_UTF8_STRING
Definition: wincrypt.h:2793
int ret
BYTE * pbData
Definition: wincrypt.h:103
GLenum GLsizei len
Definition: glext.h:6722
#define CERT_RDN_VIDEOTEX_STRING
Definition: wincrypt.h:2783
#define CERT_RDN_ANY_TYPE
Definition: wincrypt.h:2776
#define CERT_RDN_PRINTABLE_STRING
Definition: wincrypt.h:2780

Referenced by cert_name_to_str_with_indent().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( crypt  )

Variable Documentation

◆ indent

const WCHAR indent[] = { ' ',' ',' ',' ',' ',0 }
static

Definition at line 574 of file str.c.

Referenced by cert_name_to_str_with_indent().