ReactOS 0.4.17-dev-470-gf9e3448
base64.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wincrypt.h"
#include "wine/debug.h"
Include dependency graph for base64.c:

Go to the source code of this file.

Macros

#define CERT_HEADER   "-----BEGIN CERTIFICATE-----"
 
#define CERT_HEADER_START   "-----BEGIN "
 
#define CERT_DELIMITER   "-----"
 
#define CERT_TRAILER   "-----END CERTIFICATE-----"
 
#define CERT_TRAILER_START   "-----END "
 
#define CERT_REQUEST_HEADER   "-----BEGIN NEW CERTIFICATE REQUEST-----"
 
#define CERT_REQUEST_TRAILER   "-----END NEW CERTIFICATE REQUEST-----"
 
#define X509_HEADER   "-----BEGIN X509 CRL-----"
 
#define X509_TRAILER   "-----END X509 CRL-----"
 
#define BASE64_DECODE_PADDING   0x100
 
#define BASE64_DECODE_WHITESPACE   0x200
 
#define BASE64_DECODE_INVALID   0x300
 

Typedefs

typedef BOOL(* BinaryToStringAFunc) (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
 
typedef BOOL(* BinaryToStringWFunc) (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
 
typedef LONG(* StringToBinaryAFunc) (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
typedef LONG(* StringToBinaryWFunc) (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (crypt)
 
static BOOL EncodeBinaryToBinaryA (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
 
static DWORD stradd (LPSTR ptr, LPCSTR end, LPCSTR s, DWORD slen)
 
static DWORD encodeBase64A (const BYTE *in_buf, int in_len, LPCSTR sep, char *out_buf, DWORD *out_len)
 
static BOOL BinaryToBase64A (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
 
static BOOL BinaryToHexRawA (const BYTE *bin, DWORD nbin, DWORD flags, char *str, DWORD *nstr)
 
BOOL WINAPI CryptBinaryToStringA (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
 
static BOOL EncodeBinaryToBinaryW (const BYTE *in_buf, DWORD in_len, DWORD flags, WCHAR *out_buf, DWORD *out_len)
 
static LONG encodeBase64W (const BYTE *in_buf, int in_len, LPCWSTR sep, WCHAR *out_buf, DWORD *out_len)
 
static BOOL BinaryToBase64W (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
 
static BOOL BinaryToHexRawW (const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr)
 
static BOOL binary_to_hexW (const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr)
 
BOOL WINAPI CryptBinaryToStringW (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
 
static int decodeBase64Byte (int c)
 
static LONG Base64ToBinary (const void *pszString, BOOL wide, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64ToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64WithHeaderAndTrailerToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip)
 
static LONG Base64HeaderToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64RequestHeaderToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64X509HeaderToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64AnyToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG DecodeBinaryToBinaryA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG DecodeAnyA (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static BOOL is_hex_string_special_char (WCHAR c)
 
static WCHAR wchar_from_str (BOOL wide, const void **str, DWORD *len)
 
static BYTE digit_from_char (WCHAR c)
 
static LONG string_to_hex (const void *str, BOOL wide, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
 
static LONG string_to_hexA (const char *str, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
 
BOOL WINAPI CryptStringToBinaryA (LPCSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64ToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64WithHeaderAndTrailerToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip)
 
static LONG Base64HeaderToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64RequestHeaderToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64X509HeaderToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG Base64AnyToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG DecodeBinaryToBinaryW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG DecodeAnyW (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 
static LONG string_to_hexW (const WCHAR *str, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
 
BOOL WINAPI CryptStringToBinaryW (LPCWSTR pszString, DWORD cchString, DWORD dwFlags, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
 

Variables

static const WCHAR CERT_HEADER_W [] = L"-----BEGIN CERTIFICATE-----"
 
static const WCHAR CERT_HEADER_START_W [] = L"-----BEGIN "
 
static const WCHAR CERT_DELIMITER_W [] = L"-----"
 
static const WCHAR CERT_TRAILER_W [] = L"-----END CERTIFICATE-----"
 
static const WCHAR CERT_TRAILER_START_W [] = L"-----END "
 
static const WCHAR CERT_REQUEST_HEADER_W [] = L"-----BEGIN NEW CERTIFICATE REQUEST-----"
 
static const WCHAR CERT_REQUEST_TRAILER_W [] = L"-----END NEW CERTIFICATE REQUEST-----"
 
static const WCHAR X509_HEADER_W [] = L"-----BEGIN X509 CRL-----"
 
static const WCHAR X509_TRAILER_W [] = L"-----END X509 CRL-----"
 
static const char b64 []
 

Macro Definition Documentation

◆ BASE64_DECODE_INVALID

#define BASE64_DECODE_INVALID   0x300

Definition at line 694 of file base64.c.

◆ BASE64_DECODE_PADDING

#define BASE64_DECODE_PADDING   0x100

Definition at line 692 of file base64.c.

◆ BASE64_DECODE_WHITESPACE

#define BASE64_DECODE_WHITESPACE   0x200

Definition at line 693 of file base64.c.

◆ CERT_DELIMITER

#define CERT_DELIMITER   "-----"

Definition at line 33 of file base64.c.

◆ CERT_HEADER

#define CERT_HEADER   "-----BEGIN CERTIFICATE-----"

Definition at line 31 of file base64.c.

◆ CERT_HEADER_START

#define CERT_HEADER_START   "-----BEGIN "

Definition at line 32 of file base64.c.

◆ CERT_REQUEST_HEADER

#define CERT_REQUEST_HEADER   "-----BEGIN NEW CERTIFICATE REQUEST-----"

Definition at line 36 of file base64.c.

◆ CERT_REQUEST_TRAILER

#define CERT_REQUEST_TRAILER   "-----END NEW CERTIFICATE REQUEST-----"

Definition at line 37 of file base64.c.

◆ CERT_TRAILER

#define CERT_TRAILER   "-----END CERTIFICATE-----"

Definition at line 34 of file base64.c.

◆ CERT_TRAILER_START

#define CERT_TRAILER_START   "-----END "

Definition at line 35 of file base64.c.

◆ X509_HEADER

#define X509_HEADER   "-----BEGIN X509 CRL-----"

Definition at line 38 of file base64.c.

◆ X509_TRAILER

#define X509_TRAILER   "-----END X509 CRL-----"

Definition at line 39 of file base64.c.

Typedef Documentation

◆ BinaryToStringAFunc

typedef BOOL(* BinaryToStringAFunc) (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)

Definition at line 54 of file base64.c.

◆ BinaryToStringWFunc

typedef BOOL(* BinaryToStringWFunc) (const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)

Definition at line 56 of file base64.c.

◆ StringToBinaryAFunc

typedef LONG(* StringToBinaryAFunc) (LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)

Definition at line 720 of file base64.c.

◆ StringToBinaryWFunc

typedef LONG(* StringToBinaryWFunc) (LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)

Definition at line 1129 of file base64.c.

Function Documentation

◆ Base64AnyToBinaryA()

static LONG Base64AnyToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 895 of file base64.c.

897{
898 LONG ret;
899
900 ret = Base64HeaderToBinaryA(pszString, cchString, pbBinary, pcbBinary,
901 pdwSkip, pdwFlags);
902 if (ret == ERROR_INVALID_DATA)
903 ret = Base64ToBinaryA(pszString, cchString, pbBinary, pcbBinary,
904 pdwSkip, pdwFlags);
905 return ret;
906}
static LONG Base64HeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:862
static LONG Base64ToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:805
return ret
Definition: mutex.c:146
long LONG
Definition: pedump.c:60
#define ERROR_INVALID_DATA
Definition: winerror.h:238

Referenced by CryptStringToBinaryA().

◆ Base64AnyToBinaryW()

static LONG Base64AnyToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1222 of file base64.c.

1224{
1225 LONG ret;
1226
1227 ret = Base64HeaderToBinaryW(pszString, cchString, pbBinary, pcbBinary,
1228 pdwSkip, pdwFlags);
1229 if (ret == ERROR_INVALID_DATA)
1230 ret = Base64ToBinaryW(pszString, cchString, pbBinary, pcbBinary,
1231 pdwSkip, pdwFlags);
1232 return ret;
1233}
static LONG Base64HeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1189
static LONG Base64ToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1132

Referenced by CryptStringToBinaryW().

◆ Base64HeaderToBinaryA()

static LONG Base64HeaderToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 862 of file base64.c.

864{
865 LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
866 pbBinary, pcbBinary, pdwSkip);
867
868 if (!ret && pdwFlags)
869 *pdwFlags = CRYPT_STRING_BASE64HEADER;
870 return ret;
871}
static LONG Base64WithHeaderAndTrailerToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip)
Definition: base64.c:811
#define CRYPT_STRING_BASE64HEADER
Definition: wincrypt.h:3131

Referenced by Base64AnyToBinaryA(), CryptStringToBinaryA(), and DecodeAnyA().

◆ Base64HeaderToBinaryW()

static LONG Base64HeaderToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1189 of file base64.c.

1191{
1192 LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString,
1193 pbBinary, pcbBinary, pdwSkip);
1194
1195 if (!ret && pdwFlags)
1196 *pdwFlags = CRYPT_STRING_BASE64HEADER;
1197 return ret;
1198}
static LONG Base64WithHeaderAndTrailerToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip)
Definition: base64.c:1138

Referenced by Base64AnyToBinaryW(), CryptStringToBinaryW(), and DecodeAnyW().

◆ Base64RequestHeaderToBinaryA()

static LONG Base64RequestHeaderToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 873 of file base64.c.

875{
876 LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
877 pbBinary, pcbBinary, pdwSkip);
878
879 if (!ret && pdwFlags)
881 return ret;
882}
#define CRYPT_STRING_BASE64REQUESTHEADER
Definition: wincrypt.h:3134

Referenced by CryptStringToBinaryA().

◆ Base64RequestHeaderToBinaryW()

static LONG Base64RequestHeaderToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1200 of file base64.c.

1202{
1203 LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString,
1204 pbBinary, pcbBinary, pdwSkip);
1205
1206 if (!ret && pdwFlags)
1208 return ret;
1209}

Referenced by CryptStringToBinaryW().

◆ Base64ToBinary()

static LONG Base64ToBinary ( const void pszString,
BOOL  wide,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 723 of file base64.c.

725{
726 DWORD cbIn, cbValid, cbOut, hasPadding;
727 BYTE block[4];
728 for (cbIn = cbValid = cbOut = hasPadding = 0; cbIn < cchString; ++cbIn)
729 {
730 int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
731 int d = decodeBase64Byte(c);
733 goto invalid;
735 continue;
736
737 /* When padding starts, data is not acceptable */
738 if (hasPadding && d != BASE64_DECODE_PADDING)
739 goto invalid;
740
741 /* Padding after a full block (like "VVVV=") is ok and stops decoding */
742 if (d == BASE64_DECODE_PADDING && (cbValid & 3) == 0)
743 break;
744
745 cbValid += 1;
746
748 {
749 hasPadding = 1;
750 /* When padding reaches a full block, stop decoding */
751 if ((cbValid & 3) == 0)
752 break;
753 continue;
754 }
755
756 /* cbOut is incremented in the 4-char block as follows: "1-23" */
757 if ((cbValid & 3) != 2)
758 cbOut += 1;
759 }
760 /* Fail if the block has bad padding; omitting padding is fine */
761 if ((cbValid & 3) != 0 && hasPadding)
762 goto invalid;
763 /* Check available buffer size */
764 if (pbBinary && *pcbBinary && cbOut > *pcbBinary)
765 goto overflow;
766 /* Convert the data; this step depends on the validity checks above! */
767 if (pbBinary) for (cbIn = cbValid = cbOut = 0; cbIn < cchString; ++cbIn)
768 {
769 int c = wide ? (int)((WCHAR*)pszString)[cbIn] : (int)((char*)pszString)[cbIn];
770 int d = decodeBase64Byte(c);
772 continue;
774 break;
775 block[cbValid & 3] = d;
776 cbValid += 1;
777 switch (cbValid & 3) {
778 case 1:
779 pbBinary[cbOut++] = (block[0] << 2);
780 break;
781 case 2:
782 pbBinary[cbOut-1] = (block[0] << 2) | (block[1] >> 4);
783 break;
784 case 3:
785 pbBinary[cbOut++] = (block[1] << 4) | (block[2] >> 2);
786 break;
787 case 0:
788 pbBinary[cbOut++] = (block[2] << 6) | (block[3] >> 0);
789 break;
790 }
791 }
792 *pcbBinary = cbOut;
793 if (pdwSkip)
794 *pdwSkip = 0;
795 if (pdwFlags)
796 *pdwFlags = CRYPT_STRING_BASE64;
797 return ERROR_SUCCESS;
800invalid:
801 *pcbBinary = cbOut;
802 return ERROR_INVALID_DATA;
803}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define BASE64_DECODE_PADDING
Definition: base64.c:692
static int decodeBase64Byte(int c)
Definition: base64.c:696
#define BASE64_DECODE_WHITESPACE
Definition: base64.c:693
#define BASE64_DECODE_INVALID
Definition: base64.c:694
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLubyte * c
Definition: glext.h:8905
#define d
Definition: ke_i.h:81
short WCHAR
Definition: pedump.c:58
#define CRYPT_STRING_BASE64
Definition: wincrypt.h:3132
static unsigned int block
Definition: xmlmemory.c:101
unsigned char BYTE
Definition: xxhash.c:193

Referenced by Base64ToBinaryA(), and Base64ToBinaryW().

◆ Base64ToBinaryA()

static LONG Base64ToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 805 of file base64.c.

807{
808 return Base64ToBinary(pszString, FALSE, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
809}
#define FALSE
Definition: types.h:117
static LONG Base64ToBinary(const void *pszString, BOOL wide, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:723

Referenced by Base64AnyToBinaryA(), Base64WithHeaderAndTrailerToBinaryA(), CryptStringToBinaryA(), and DecodeAnyA().

◆ Base64ToBinaryW()

static LONG Base64ToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1132 of file base64.c.

1134{
1135 return Base64ToBinary(pszString, TRUE, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
1136}
#define TRUE
Definition: types.h:120

Referenced by Base64AnyToBinaryW(), Base64WithHeaderAndTrailerToBinaryW(), CryptStringToBinaryW(), and DecodeAnyW().

◆ Base64WithHeaderAndTrailerToBinaryA()

static LONG Base64WithHeaderAndTrailerToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip 
)
static

Definition at line 811 of file base64.c.

814{
815 LONG ret;
817 LPCSTR trailer = CERT_TRAILER_START;
818
819 LPCSTR headerBegins;
820 LPCSTR dataBegins;
821 LPCSTR trailerBegins;
822 size_t dataLength;
823
824 if ((strlen(header) + strlen(trailer)) > cchString)
825 {
826 return ERROR_INVALID_DATA;
827 }
828
829 if (!(headerBegins = strstr(pszString, header)))
830 {
831 TRACE("Can't find %s in %s.\n", header, debugstr_an(pszString, cchString));
832 return ERROR_INVALID_DATA;
833 }
834
835 dataBegins = headerBegins + strlen(header);
836 if (!(dataBegins = strstr(dataBegins, CERT_DELIMITER)))
837 {
838 return ERROR_INVALID_DATA;
839 }
840 dataBegins += strlen(CERT_DELIMITER);
841 if (*dataBegins == '\r') dataBegins++;
842 if (*dataBegins == '\n') dataBegins++;
843
844 if (!(trailerBegins = strstr(dataBegins, trailer)))
845 {
846 return ERROR_INVALID_DATA;
847 }
848 if (*(trailerBegins-1) == '\n') trailerBegins--;
849 if (*(trailerBegins-1) == '\r') trailerBegins--;
850
851 if (pdwSkip)
852 *pdwSkip = headerBegins - pszString;
853
854 dataLength = trailerBegins - dataBegins;
855
856 ret = Base64ToBinaryA(dataBegins, dataLength, pbBinary, pcbBinary, NULL,
857 NULL);
858
859 return ret;
860}
#define NULL
Definition: types.h:112
#define CERT_HEADER_START
Definition: base64.c:32
#define CERT_TRAILER_START
Definition: base64.c:35
#define CERT_DELIMITER
Definition: base64.c:33
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3420
ULONG dataLength
Definition: scsi.h:3797
#define TRACE(s)
Definition: solgame.cpp:4
const char * LPCSTR
Definition: typedefs.h:52

Referenced by Base64HeaderToBinaryA(), Base64RequestHeaderToBinaryA(), and Base64X509HeaderToBinaryA().

◆ Base64WithHeaderAndTrailerToBinaryW()

static LONG Base64WithHeaderAndTrailerToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip 
)
static

Definition at line 1138 of file base64.c.

1141{
1142 LONG ret;
1144 LPCWSTR trailer = CERT_TRAILER_START_W;
1145
1146 LPCWSTR headerBegins;
1147 LPCWSTR dataBegins;
1148 LPCWSTR trailerBegins;
1149 size_t dataLength;
1150
1151 if ((lstrlenW(header) + lstrlenW(trailer)) > cchString)
1152 {
1153 return ERROR_INVALID_DATA;
1154 }
1155
1156 if (!(headerBegins = wcsstr(pszString, header)))
1157 {
1158 TRACE("Can't find %s in %s.\n", debugstr_w(header), debugstr_wn(pszString, cchString));
1159 return ERROR_INVALID_DATA;
1160 }
1161
1162 dataBegins = headerBegins + lstrlenW(header);
1163 if (!(dataBegins = wcsstr(dataBegins, CERT_DELIMITER_W)))
1164 {
1165 return ERROR_INVALID_DATA;
1166 }
1167 dataBegins += lstrlenW(CERT_DELIMITER_W);
1168 if (*dataBegins == '\r') dataBegins++;
1169 if (*dataBegins == '\n') dataBegins++;
1170
1171 if (!(trailerBegins = wcsstr(dataBegins, trailer)))
1172 {
1173 return ERROR_INVALID_DATA;
1174 }
1175 if (*(trailerBegins-1) == '\n') trailerBegins--;
1176 if (*(trailerBegins-1) == '\r') trailerBegins--;
1177
1178 if (pdwSkip)
1179 *pdwSkip = headerBegins - pszString;
1180
1181 dataLength = trailerBegins - dataBegins;
1182
1183 ret = Base64ToBinaryW(dataBegins, dataLength, pbBinary, pcbBinary, NULL,
1184 NULL);
1185
1186 return ret;
1187}
static const WCHAR CERT_DELIMITER_W[]
Definition: base64.c:43
static const WCHAR CERT_TRAILER_START_W[]
Definition: base64.c:45
static const WCHAR CERT_HEADER_START_W[]
Definition: base64.c:42
#define lstrlenW
Definition: compat.h:750
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2998
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
const uint16_t * LPCWSTR
Definition: typedefs.h:57

Referenced by Base64HeaderToBinaryW(), Base64RequestHeaderToBinaryW(), and Base64X509HeaderToBinaryW().

◆ Base64X509HeaderToBinaryA()

static LONG Base64X509HeaderToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 884 of file base64.c.

886{
887 LONG ret = Base64WithHeaderAndTrailerToBinaryA(pszString, cchString,
888 pbBinary, pcbBinary, pdwSkip);
889
890 if (!ret && pdwFlags)
892 return ret;
893}
#define CRYPT_STRING_BASE64X509CRLHEADER
Definition: wincrypt.h:3140

Referenced by CryptStringToBinaryA().

◆ Base64X509HeaderToBinaryW()

static LONG Base64X509HeaderToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1211 of file base64.c.

1213{
1214 LONG ret = Base64WithHeaderAndTrailerToBinaryW(pszString, cchString,
1215 pbBinary, pcbBinary, pdwSkip);
1216
1217 if (!ret && pdwFlags)
1219 return ret;
1220}

Referenced by CryptStringToBinaryW().

◆ binary_to_hexW()

static BOOL binary_to_hexW ( const BYTE bin,
DWORD  nbin,
DWORD  flags,
LPWSTR  str,
DWORD nstr 
)
static

Definition at line 571 of file base64.c.

572{
573 static const WCHAR hex[] = L"0123456789abcdef";
574 DWORD needed, i;
575
576 needed = nbin * 3; /* spaces + terminating \0 */
577
579 {
580 needed += (nbin + 7) / 16; /* space every 16 characters */
581 needed += 1; /* terminating \n */
582 }
583 else if (!(flags & CRYPT_STRING_NOCRLF))
584 {
585 needed += (nbin + 7) / 16; /* space every 16 characters */
586 needed += nbin / 16 + 1; /* LF every 16 characters + terminating \r */
587
588 if (nbin % 16)
589 needed += 1; /* terminating \n */
590 }
591
592 if (!str)
593 {
594 *nstr = needed;
595 return TRUE;
596 }
597
598 if (needed > *nstr)
599 {
601 return FALSE;
602 }
603
604 for (i = 0; i < nbin; i++)
605 {
606 *str++ = hex[(bin[i] >> 4) & 0xf];
607 *str++ = hex[bin[i] & 0xf];
608
609 if (i >= nbin - 1) break;
610
611 if (i && !(flags & CRYPT_STRING_NOCRLF))
612 {
613 if (!((i + 1) % 16))
614 {
616 *str++ = '\n';
617 else
618 {
619 *str++ = '\r';
620 *str++ = '\n';
621 }
622 continue;
623 }
624 else if (!((i + 1) % 8))
625 *str++ = ' ';
626 }
627
628 *str++ = ' ';
629 }
630
632 *str++ = '\n';
633 else if (!(flags & CRYPT_STRING_NOCRLF))
634 {
635 *str++ = '\r';
636 *str++ = '\n';
637 }
638
639 *str = 0;
640 *nstr = needed - 1;
641 return TRUE;
642}
ios_base &_STLP_CALL hex(ios_base &__s)
Definition: _ios_base.h:324
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SetLastError(x)
Definition: compat.h:752
#define L(x)
Definition: resources.c:13
GLbitfield flags
Definition: glext.h:7161
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 struct _PeImage bin
const WCHAR * str
#define CRYPT_STRING_NOCRLF
Definition: wincrypt.h:3149
#define CRYPT_STRING_NOCR
Definition: wincrypt.h:3150

Referenced by CryptBinaryToStringW().

◆ BinaryToBase64A()

static BOOL BinaryToBase64A ( const BYTE pbBinary,
DWORD  cbBinary,
DWORD  dwFlags,
LPSTR  pszString,
DWORD pcchString 
)
static

Definition at line 166 of file base64.c.

168{
169 static const char crlf[] = "\r\n", lf[] = "\n";
170 BOOL ret = TRUE;
171 LPCSTR header = NULL, trailer = NULL, sep;
172 DWORD charsNeeded;
173
175 sep = lf;
176 else if (dwFlags & CRYPT_STRING_NOCRLF)
177 sep = "";
178 else
179 sep = crlf;
180 switch (dwFlags & 0x0fffffff)
181 {
183 /* no header or footer */
184 break;
187 trailer = CERT_TRAILER;
188 break;
191 trailer = CERT_REQUEST_TRAILER;
192 break;
195 trailer = X509_TRAILER;
196 break;
197 }
198
199 charsNeeded = 0;
200 encodeBase64A(pbBinary, cbBinary, sep, NULL, &charsNeeded);
201 if (header)
202 charsNeeded += strlen(header) + strlen(sep);
203 if (trailer)
204 charsNeeded += strlen(trailer) + strlen(sep);
205
206 if (pszString)
207 {
208 LPSTR ptr = pszString;
209 DWORD size = *pcchString;
210 LPSTR end = ptr + size;
211
212 if (header)
213 {
215 ptr += stradd(ptr, end, sep, strlen(sep));
216 size = end - ptr;
217 }
218 ptr += encodeBase64A(pbBinary, cbBinary, sep, ptr, &size);
219 if (trailer)
220 {
221 ptr += stradd(ptr, end, trailer, strlen(trailer));
222 ptr += stradd(ptr, end, sep, strlen(sep));
223 }
224
225 if (ptr < end)
226 *ptr = '\0';
227
228 if (charsNeeded <= *pcchString)
229 {
230 *pcchString = charsNeeded - 1;
231 }
232 else
233 {
234 *pcchString = charsNeeded;
236 ret = FALSE;
237 }
238 }
239 else
240 *pcchString = charsNeeded;
241
242 return ret;
243}
#define X509_TRAILER
Definition: base64.c:39
static DWORD stradd(LPSTR ptr, LPCSTR end, LPCSTR s, DWORD slen)
Definition: base64.c:80
#define CERT_TRAILER
Definition: base64.c:34
static DWORD encodeBase64A(const BYTE *in_buf, int in_len, LPCSTR sep, char *out_buf, DWORD *out_len)
Definition: base64.c:88
#define CERT_REQUEST_HEADER
Definition: base64.c:36
#define X509_HEADER
Definition: base64.c:38
#define CERT_HEADER
Definition: base64.c:31
#define CERT_REQUEST_TRAILER
Definition: base64.c:37
static const WCHAR crlf[]
Definition: object.c:1094
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
static PVOID ptr
Definition: dispmode.c:27
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
char * LPSTR
Definition: typedefs.h:51

Referenced by CryptBinaryToStringA().

◆ BinaryToBase64W()

static BOOL BinaryToBase64W ( const BYTE pbBinary,
DWORD  cbBinary,
DWORD  dwFlags,
LPWSTR  pszString,
DWORD pcchString 
)
static

Definition at line 449 of file base64.c.

451{
452 BOOL ret = TRUE;
453 LPCWSTR header = NULL, trailer = NULL, sep;
454 DWORD charsNeeded;
455
457 sep = L"\n";
458 else if (dwFlags & CRYPT_STRING_NOCRLF)
459 sep = L"";
460 else
461 sep = L"\r\n";
462 switch (dwFlags & 0x0fffffff)
463 {
465 /* no header or footer */
466 break;
469 trailer = CERT_TRAILER_W;
470 break;
473 trailer = CERT_REQUEST_TRAILER_W;
474 break;
477 trailer = X509_TRAILER_W;
478 break;
479 }
480
481 charsNeeded = 0;
482 encodeBase64W(pbBinary, cbBinary, sep, NULL, &charsNeeded);
483 if (header)
484 charsNeeded += lstrlenW(header) + lstrlenW(sep);
485 if (trailer)
486 charsNeeded += lstrlenW(trailer) + lstrlenW(sep);
487
488 if (pszString)
489 {
490 if (charsNeeded <= *pcchString)
491 {
492 LPWSTR ptr = pszString;
493 DWORD size = charsNeeded;
494
495 if (header)
496 {
498 ptr += lstrlenW(ptr);
499 lstrcpyW(ptr, sep);
500 ptr += lstrlenW(sep);
501 }
502 encodeBase64W(pbBinary, cbBinary, sep, ptr, &size);
503 ptr += size - 1;
504 if (trailer)
505 {
506 lstrcpyW(ptr, trailer);
507 ptr += lstrlenW(ptr);
508 lstrcpyW(ptr, sep);
509 }
510 *pcchString = charsNeeded - 1;
511 }
512 else
513 {
514 *pcchString = charsNeeded;
516 ret = FALSE;
517 }
518 }
519 else
520 *pcchString = charsNeeded;
521
522 return ret;
523}
static const WCHAR CERT_REQUEST_TRAILER_W[]
Definition: base64.c:47
static const WCHAR CERT_TRAILER_W[]
Definition: base64.c:44
static const WCHAR CERT_HEADER_W[]
Definition: base64.c:41
static LONG encodeBase64W(const BYTE *in_buf, int in_len, LPCWSTR sep, WCHAR *out_buf, DWORD *out_len)
Definition: base64.c:368
static const WCHAR X509_HEADER_W[]
Definition: base64.c:48
static const WCHAR X509_TRAILER_W[]
Definition: base64.c:49
static const WCHAR CERT_REQUEST_HEADER_W[]
Definition: base64.c:46
#define lstrcpyW
Definition: compat.h:749
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by CryptBinaryToStringW().

◆ BinaryToHexRawA()

static BOOL BinaryToHexRawA ( const BYTE bin,
DWORD  nbin,
DWORD  flags,
char str,
DWORD nstr 
)
static

Definition at line 245 of file base64.c.

246{
247 static const char hex[] = "0123456789abcdef";
248 DWORD needed;
249
251 needed = 0;
252 else if (flags & CRYPT_STRING_NOCR)
253 needed = 1;
254 else
255 needed = 2;
256
257 needed += nbin * 2 + 1;
258
259 if (!str)
260 {
261 *nstr = needed;
262 return TRUE;
263 }
264
265 if (needed > *nstr && *nstr < 3)
266 {
268 return FALSE;
269 }
270
271 nbin = min(nbin, (*nstr - 1) / 2);
272
273 while (nbin--)
274 {
275 *str++ = hex[(*bin >> 4) & 0xf];
276 *str++ = hex[*bin & 0xf];
277 bin++;
278 }
279
280 if (needed > *nstr)
281 {
282 *str = 0;
284 return FALSE;
285 }
286
288 {
289 *str++ = '\n';
290 }
291 else if (!(flags & CRYPT_STRING_NOCRLF))
292 {
293 *str++ = '\r';
294 *str++ = '\n';
295 }
296
297 *str = 0;
298 *nstr = needed - 1;
299 return TRUE;
300}
#define min(a, b)
Definition: monoChain.cc:55

Referenced by CryptBinaryToStringA().

◆ BinaryToHexRawW()

static BOOL BinaryToHexRawW ( const BYTE bin,
DWORD  nbin,
DWORD  flags,
LPWSTR  str,
DWORD nstr 
)
static

Definition at line 525 of file base64.c.

526{
527 static const WCHAR hex[] = L"0123456789abcdef";
528 DWORD needed;
529
531 needed = 0;
532 else if (flags & CRYPT_STRING_NOCR)
533 needed = 1;
534 else
535 needed = 2;
536
537 needed += nbin * 2 + 1;
538
539 if (!str)
540 {
541 *nstr = needed;
542 return TRUE;
543 }
544
545 if (needed > *nstr)
546 {
548 return FALSE;
549 }
550
551 while (nbin--)
552 {
553 *str++ = hex[(*bin >> 4) & 0xf];
554 *str++ = hex[*bin & 0xf];
555 bin++;
556 }
557
559 *str++ = '\n';
560 else if (!(flags & CRYPT_STRING_NOCRLF))
561 {
562 *str++ = '\r';
563 *str++ = '\n';
564 }
565
566 *str = 0;
567 *nstr = needed - 1;
568 return TRUE;
569}

Referenced by CryptBinaryToStringW().

◆ CryptBinaryToStringA()

BOOL WINAPI CryptBinaryToStringA ( const BYTE pbBinary,
DWORD  cbBinary,
DWORD  dwFlags,
LPSTR  pszString,
DWORD pcchString 
)

Definition at line 302 of file base64.c.

304{
306
307 TRACE("(%p, %ld, %08lx, %p, %p)\n", pbBinary, cbBinary, dwFlags, pszString,
308 pcchString);
309
310 if (!pbBinary)
311 {
313 return FALSE;
314 }
315 if (!pcchString)
316 {
318 return FALSE;
319 }
320
321 switch (dwFlags & 0x0fffffff)
322 {
325 break;
331 break;
334 break;
335 case CRYPT_STRING_HEX:
339 FIXME("Unimplemented type %ld\n", dwFlags & 0x0fffffff);
340 /* fall through */
341 default:
343 return FALSE;
344 }
345 return encoder(pbBinary, cbBinary, dwFlags, pszString, pcchString);
346}
#define FIXME(fmt,...)
Definition: precomp.h:53
BOOL(* BinaryToStringAFunc)(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
Definition: base64.c:54
static BOOL EncodeBinaryToBinaryA(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
Definition: base64.c:59
static BOOL BinaryToHexRawA(const BYTE *bin, DWORD nbin, DWORD flags, char *str, DWORD *nstr)
Definition: base64.c:245
static BOOL BinaryToBase64A(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPSTR pszString, DWORD *pcchString)
Definition: base64.c:166
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CRYPT_STRING_BINARY
Definition: wincrypt.h:3133
#define CRYPT_STRING_HEXADDR
Definition: wincrypt.h:3141
#define CRYPT_STRING_HEX
Definition: wincrypt.h:3135
#define CRYPT_STRING_HEXASCII
Definition: wincrypt.h:3136
#define CRYPT_STRING_HEXRAW
Definition: wincrypt.h:3143
#define CRYPT_STRING_HEXASCIIADDR
Definition: wincrypt.h:3142

Referenced by create_websocket_accept(), encodeAndCompareBase64_A(), save_base64(), and test_CryptBinaryToString().

◆ CryptBinaryToStringW()

BOOL WINAPI CryptBinaryToStringW ( const BYTE pbBinary,
DWORD  cbBinary,
DWORD  dwFlags,
LPWSTR  pszString,
DWORD pcchString 
)

Definition at line 644 of file base64.c.

646{
648
649 TRACE("(%p, %ld, %08lx, %p, %p)\n", pbBinary, cbBinary, dwFlags, pszString,
650 pcchString);
651
652 if (!pbBinary)
653 {
655 return FALSE;
656 }
657 if (!pcchString)
658 {
660 return FALSE;
661 }
662
663 switch (dwFlags & 0x0fffffff)
664 {
667 break;
673 break;
676 break;
677 case CRYPT_STRING_HEX:
679 break;
683 FIXME("Unimplemented type %ld\n", dwFlags & 0x0fffffff);
684 /* fall through */
685 default:
687 return FALSE;
688 }
689 return encoder(pbBinary, cbBinary, dwFlags, pszString, pcchString);
690}
static BOOL BinaryToHexRawW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr)
Definition: base64.c:525
static BOOL EncodeBinaryToBinaryW(const BYTE *in_buf, DWORD in_len, DWORD flags, WCHAR *out_buf, DWORD *out_len)
Definition: base64.c:348
static BOOL binary_to_hexW(const BYTE *bin, DWORD nbin, DWORD flags, LPWSTR str, DWORD *nstr)
Definition: base64.c:571
static BOOL BinaryToBase64W(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
Definition: base64.c:449
BOOL(* BinaryToStringWFunc)(const BYTE *pbBinary, DWORD cbBinary, DWORD dwFlags, LPWSTR pszString, DWORD *pcchString)
Definition: base64.c:56

Referenced by build_request_path(), encode_compare_base64_W(), and test_CryptBinaryToString().

◆ CryptStringToBinaryA()

BOOL WINAPI CryptStringToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
DWORD  dwFlags,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)

Definition at line 1062 of file base64.c.

1065{
1067 LONG ret;
1068
1069 TRACE("(%s, %ld, %08lx, %p, %p, %p, %p)\n", debugstr_an(pszString, cchString ? cchString : -1),
1070 cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
1071
1072 if (!pszString)
1073 {
1075 return FALSE;
1076 }
1077 /* Only the bottom byte contains valid types */
1078 if (dwFlags & 0xfffffff0)
1079 {
1081 return FALSE;
1082 }
1083 switch (dwFlags)
1084 {
1087 break;
1090 break;
1093 break;
1096 break;
1099 break;
1102 break;
1103 case CRYPT_STRING_ANY:
1105 break;
1106 case CRYPT_STRING_HEX:
1108 break;
1112 FIXME("Unimplemented type %ld\n", dwFlags & 0x7fffffff);
1113 /* fall through */
1114 default:
1116 return FALSE;
1117 }
1118 if (!cchString)
1119 cchString = strlen(pszString);
1120 ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
1121 if (ret)
1123 return ret == ERROR_SUCCESS;
1124}
static LONG Base64RequestHeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:873
LONG(* StringToBinaryAFunc)(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:720
static LONG string_to_hexA(const char *str, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
Definition: base64.c:1057
static LONG Base64AnyToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:895
static LONG DecodeAnyA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:932
static LONG Base64X509HeaderToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:884
static LONG DecodeBinaryToBinaryA(LPCSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:908
#define CRYPT_STRING_BASE64_ANY
Definition: wincrypt.h:3137
#define CRYPT_STRING_ANY
Definition: wincrypt.h:3138

Referenced by CRYPT_QueryContextObject(), CRYPT_QueryMessageObject(), decode_base64_blob(), decodeAndCompareBase64_A(), decodeBase64WithLenFmt(), and test_CryptStringToBinary().

◆ CryptStringToBinaryW()

BOOL WINAPI CryptStringToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
DWORD  dwFlags,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)

Definition at line 1280 of file base64.c.

1283{
1285 LONG ret;
1286
1287 TRACE("(%s, %ld, %08lx, %p, %p, %p, %p)\n", debugstr_wn(pszString, cchString ? cchString : -1),
1288 cchString, dwFlags, pbBinary, pcbBinary, pdwSkip, pdwFlags);
1289
1290 if (!pszString)
1291 {
1293 return FALSE;
1294 }
1295 /* Only the bottom byte contains valid types */
1296 if (dwFlags & 0xfffffff0)
1297 {
1299 return FALSE;
1300 }
1301 switch (dwFlags)
1302 {
1305 break;
1308 break;
1311 break;
1314 break;
1317 break;
1320 break;
1321 case CRYPT_STRING_ANY:
1323 break;
1324 case CRYPT_STRING_HEX:
1326 break;
1330 FIXME("Unimplemented type %ld\n", dwFlags & 0x7fffffff);
1331 /* fall through */
1332 default:
1334 return FALSE;
1335 }
1336 if (!cchString)
1337 cchString = lstrlenW(pszString);
1338 ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
1339 if (ret)
1341 return ret == ERROR_SUCCESS;
1342}
static LONG string_to_hexW(const WCHAR *str, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
Definition: base64.c:1275
LONG(* StringToBinaryWFunc)(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1129
static LONG Base64RequestHeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1200
static LONG Base64AnyToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1222
static LONG Base64X509HeaderToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1211
static LONG DecodeBinaryToBinaryW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1235
static LONG DecodeAnyW(LPCWSTR pszString, DWORD cchString, BYTE *pbBinary, DWORD *pcbBinary, DWORD *pdwSkip, DWORD *pdwFlags)
Definition: base64.c:1259

Referenced by CRYPT_QueryMessageObject(), decodeBase64WithLenFmtW(), and test_CryptStringToBinary().

◆ DecodeAnyA()

static LONG DecodeAnyA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 932 of file base64.c.

934{
935 LONG ret;
936
937 ret = Base64HeaderToBinaryA(pszString, cchString, pbBinary, pcbBinary,
938 pdwSkip, pdwFlags);
939 if (ret == ERROR_INVALID_DATA)
940 ret = Base64ToBinaryA(pszString, cchString, pbBinary, pcbBinary,
941 pdwSkip, pdwFlags);
942 if (ret == ERROR_INVALID_DATA)
943 ret = DecodeBinaryToBinaryA(pszString, cchString, pbBinary, pcbBinary,
944 pdwSkip, pdwFlags);
945 return ret;
946}

Referenced by CryptStringToBinaryA().

◆ DecodeAnyW()

static LONG DecodeAnyW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1259 of file base64.c.

1261{
1262 LONG ret;
1263
1264 ret = Base64HeaderToBinaryW(pszString, cchString, pbBinary, pcbBinary,
1265 pdwSkip, pdwFlags);
1266 if (ret == ERROR_INVALID_DATA)
1267 ret = Base64ToBinaryW(pszString, cchString, pbBinary, pcbBinary,
1268 pdwSkip, pdwFlags);
1269 if (ret == ERROR_INVALID_DATA)
1270 ret = DecodeBinaryToBinaryW(pszString, cchString, pbBinary, pcbBinary,
1271 pdwSkip, pdwFlags);
1272 return ret;
1273}

Referenced by CryptStringToBinaryW().

◆ decodeBase64Byte()

static int decodeBase64Byte ( int  c)
inlinestatic

Definition at line 696 of file base64.c.

697{
699
700 if (c >= 'A' && c <= 'Z')
701 ret = c - 'A';
702 else if (c >= 'a' && c <= 'z')
703 ret = c - 'a' + 26;
704 else if (c >= '0' && c <= '9')
705 ret = c - '0' + 52;
706 else if (c == '+')
707 ret = 62;
708 else if (c == '/')
709 ret = 63;
710 else if (c == '=')
712 else if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
714 return ret;
715}

Referenced by Base64ToBinary().

◆ DecodeBinaryToBinaryA()

static LONG DecodeBinaryToBinaryA ( LPCSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 908 of file base64.c.

910{
912
913 if (*pcbBinary < cchString)
914 {
915 if (!pbBinary)
916 *pcbBinary = cchString;
917 else
918 {
920 *pcbBinary = cchString;
921 }
922 }
923 else
924 {
925 if (cchString)
926 memcpy(pbBinary, pszString, cchString);
927 *pcbBinary = cchString;
928 }
929 return ret;
930}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by CryptStringToBinaryA(), and DecodeAnyA().

◆ DecodeBinaryToBinaryW()

static LONG DecodeBinaryToBinaryW ( LPCWSTR  pszString,
DWORD  cchString,
BYTE pbBinary,
DWORD pcbBinary,
DWORD pdwSkip,
DWORD pdwFlags 
)
static

Definition at line 1235 of file base64.c.

1237{
1239
1240 if (*pcbBinary < cchString)
1241 {
1242 if (!pbBinary)
1243 *pcbBinary = cchString;
1244 else
1245 {
1247 *pcbBinary = cchString;
1248 }
1249 }
1250 else
1251 {
1252 if (cchString)
1253 memcpy(pbBinary, pszString, cchString * sizeof(WCHAR));
1254 *pcbBinary = cchString * sizeof(WCHAR);
1255 }
1256 return ret;
1257}

Referenced by CryptStringToBinaryW(), and DecodeAnyW().

◆ digit_from_char()

static BYTE digit_from_char ( WCHAR  c)
static

Definition at line 981 of file base64.c.

982{
983 if (c >= '0' && c <= '9')
984 return c - '0';
985 c = towlower(c);
986 if (c >= 'a' && c <= 'f')
987 return c - 'a' + 0xa;
988 return 0xff;
989}
#define towlower(c)
Definition: wctype.h:97

Referenced by string_to_hex(), and test_CryptStringToBinary().

◆ encodeBase64A()

static DWORD encodeBase64A ( const BYTE in_buf,
int  in_len,
LPCSTR  sep,
char out_buf,
DWORD out_len 
)
static

Definition at line 88 of file base64.c.

90{
91 int div, i;
92 const BYTE *d = in_buf;
93 int bytes = (in_len*8 + 5)/6, pad_bytes = (bytes % 4) ? 4 - (bytes % 4) : 0;
94 LPSTR ptr;
95 LPCSTR end;
96 char chunk[4];
97
98 if (!out_buf)
99 {
100 TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
101 *out_len = bytes + pad_bytes;
102 *out_len += (*out_len / 64 + (*out_len % 64 ? 1 : 0)) * strlen(sep) + 1;
103 return 0;
104 }
105
106 /* Three bytes of input give 4 chars of output */
107 div = in_len / 3;
108
109 ptr = out_buf;
110 end = ptr + *out_len;
111 i = 0;
112 while (div > 0 && ptr < end)
113 {
114 /* first char is the first 6 bits of the first byte*/
115 chunk[0] = b64[ ( d[0] >> 2) & 0x3f ];
116 /* second char is the last 2 bits of the first byte and the first 4
117 * bits of the second byte */
118 chunk[1] = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
119 /* third char is the last 4 bits of the second byte and the first 2
120 * bits of the third byte */
121 chunk[2] = b64[ ((d[1] << 2) & 0x3c) | (d[2] >> 6 & 0x03)];
122 /* fourth char is the remaining 6 bits of the third byte */
123 chunk[3] = b64[ d[2] & 0x3f];
124 ptr += stradd(ptr, end, chunk, 4);
125 i += 4;
126 d += 3;
127 div--;
128
129 if (i && i % 64 == 0)
130 ptr += stradd(ptr, end, sep, strlen(sep));
131 }
132
133 switch(pad_bytes)
134 {
135 case 1:
136 /* first char is the first 6 bits of the first byte*/
137 chunk[0] = b64[ ( d[0] >> 2) & 0x3f ];
138 /* second char is the last 2 bits of the first byte and the first 4
139 * bits of the second byte */
140 chunk[1] = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
141 /* third char is the last 4 bits of the second byte padded with
142 * two zeroes */
143 chunk[2] = b64[ ((d[1] << 2) & 0x3c) ];
144 /* fourth char is a = to indicate one byte of padding */
145 chunk[3] = '=';
146 ptr += stradd(ptr, end, chunk, 4);
147 break;
148 case 2:
149 /* first char is the first 6 bits of the first byte*/
150 chunk[0] = b64[ ( d[0] >> 2) & 0x3f ];
151 /* second char is the last 2 bits of the first byte padded with
152 * four zeroes*/
153 chunk[1] = b64[ ((d[0] << 4) & 0x30)];
154 /* third char is = to indicate padding */
155 chunk[2] = '=';
156 /* fourth char is = to indicate padding */
157 chunk[3] = '=';
158 ptr += stradd(ptr, end, chunk, 4);
159 break;
160 }
161 ptr += stradd(ptr, end, sep, strlen(sep));
162
163 return ptr - out_buf;
164}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
static const char b64[]
Definition: base64.c:51
_ACRTIMP div_t __cdecl div(int, int)
Definition: math.c:2081

Referenced by BinaryToBase64A().

◆ encodeBase64W()

static LONG encodeBase64W ( const BYTE in_buf,
int  in_len,
LPCWSTR  sep,
WCHAR out_buf,
DWORD out_len 
)
static

Definition at line 368 of file base64.c.

370{
371 int div, i;
372 const BYTE *d = in_buf;
373 int bytes = (in_len*8 + 5)/6, pad_bytes = (bytes % 4) ? 4 - (bytes % 4) : 0;
374 DWORD needed;
375 LPWSTR ptr;
376
377 TRACE("bytes is %d, pad bytes is %d\n", bytes, pad_bytes);
378 needed = bytes + pad_bytes;
379 needed += (needed / 64 + (needed % 64 ? 1 : 0)) * lstrlenW(sep);
380 needed++;
381
382 if (needed > *out_len)
383 {
384 *out_len = needed;
386 }
387 else
388 *out_len = needed;
389
390 /* Three bytes of input give 4 chars of output */
391 div = in_len / 3;
392
393 ptr = out_buf;
394 i = 0;
395 while (div > 0)
396 {
397 /* first char is the first 6 bits of the first byte*/
398 *ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
399 /* second char is the last 2 bits of the first byte and the first 4
400 * bits of the second byte */
401 *ptr++ = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
402 /* third char is the last 4 bits of the second byte and the first 2
403 * bits of the third byte */
404 *ptr++ = b64[ ((d[1] << 2) & 0x3c) | (d[2] >> 6 & 0x03)];
405 /* fourth char is the remaining 6 bits of the third byte */
406 *ptr++ = b64[ d[2] & 0x3f];
407 i += 4;
408 d += 3;
409 div--;
410
411 if (i && i % 64 == 0)
412 {
413 lstrcpyW(ptr, sep);
414 ptr += lstrlenW(sep);
415 }
416 }
417
418 switch(pad_bytes)
419 {
420 case 1:
421 /* first char is the first 6 bits of the first byte*/
422 *ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
423 /* second char is the last 2 bits of the first byte and the first 4
424 * bits of the second byte */
425 *ptr++ = b64[ ((d[0] << 4) & 0x30) | (d[1] >> 4 & 0x0f)];
426 /* third char is the last 4 bits of the second byte padded with
427 * two zeroes */
428 *ptr++ = b64[ ((d[1] << 2) & 0x3c) ];
429 /* fourth char is a = to indicate one byte of padding */
430 *ptr++ = '=';
431 break;
432 case 2:
433 /* first char is the first 6 bits of the first byte*/
434 *ptr++ = b64[ ( d[0] >> 2) & 0x3f ];
435 /* second char is the last 2 bits of the first byte padded with
436 * four zeroes*/
437 *ptr++ = b64[ ((d[0] << 4) & 0x30)];
438 /* third char is = to indicate padding */
439 *ptr++ = '=';
440 /* fourth char is = to indicate padding */
441 *ptr++ = '=';
442 break;
443 }
444 lstrcpyW(ptr, sep);
445
446 return ERROR_SUCCESS;
447}

Referenced by BinaryToBase64W().

◆ EncodeBinaryToBinaryA()

static BOOL EncodeBinaryToBinaryA ( const BYTE pbBinary,
DWORD  cbBinary,
DWORD  dwFlags,
LPSTR  pszString,
DWORD pcchString 
)
static

Definition at line 59 of file base64.c.

61{
62 BOOL ret = TRUE;
63
64 if (pszString)
65 {
66 if (*pcchString < cbBinary)
67 {
69 ret = FALSE;
70 }
71 else if (cbBinary)
72 memcpy(pszString, pbBinary, cbBinary);
73 }
74 else
75 *pcchString = cbBinary;
76
77 return ret;
78}

Referenced by CryptBinaryToStringA().

◆ EncodeBinaryToBinaryW()

static BOOL EncodeBinaryToBinaryW ( const BYTE in_buf,
DWORD  in_len,
DWORD  flags,
WCHAR out_buf,
DWORD out_len 
)
static

Definition at line 348 of file base64.c.

349{
350 BOOL ret = TRUE;
351
352 if (out_buf)
353 {
354 if (*out_len < in_len)
355 {
357 ret = FALSE;
358 }
359 else if (in_len)
360 memcpy(out_buf, in_buf, in_len);
361 }
362 else
363 *out_len = in_len;
364
365 return ret;
366}

Referenced by CryptBinaryToStringW().

◆ is_hex_string_special_char()

static BOOL is_hex_string_special_char ( WCHAR  c)
static

Definition at line 948 of file base64.c.

949{
950 switch (c)
951 {
952 case '-':
953 case ',':
954 case ' ':
955 case '\t':
956 case '\r':
957 case '\n':
958 return TRUE;
959
960 default:
961 return FALSE;
962 }
963}

Referenced by string_to_hex(), and test_CryptStringToBinary().

◆ stradd()

static DWORD stradd ( LPSTR  ptr,
LPCSTR  end,
LPCSTR  s,
DWORD  slen 
)
static

Definition at line 80 of file base64.c.

81{
82 if (ptr + slen > end)
83 slen = end - ptr;
84 memcpy(ptr, s, slen);
85 return slen;
86}
GLdouble s
Definition: gl.h:2039

Referenced by BinaryToBase64A(), and encodeBase64A().

◆ string_to_hex()

static LONG string_to_hex ( const void str,
BOOL  wide,
DWORD  len,
BYTE hex,
DWORD hex_len,
DWORD skipped,
DWORD ret_flags 
)
static

Definition at line 991 of file base64.c.

993{
994 unsigned int byte_idx = 0;
995 BYTE d1, d2;
996 WCHAR c;
997
998 if (!str || !hex_len)
1000
1001 if (!len)
1002 len = wide ? wcslen(str) : strlen(str);
1003
1004 if (wide && !len)
1006
1007 if (skipped)
1008 *skipped = 0;
1009 if (ret_flags)
1010 *ret_flags = 0;
1011
1012 while ((c = wchar_from_str(wide, &str, &len)) && is_hex_string_special_char(c))
1013 ;
1014
1015 while ((d1 = digit_from_char(c)) != 0xff)
1016 {
1017 if ((d2 = digit_from_char(wchar_from_str(wide, &str, &len))) == 0xff)
1018 {
1019 if (!hex)
1020 *hex_len = 0;
1021 return ERROR_INVALID_DATA;
1022 }
1023
1024 if (hex && byte_idx < *hex_len)
1025 hex[byte_idx] = (d1 << 4) | d2;
1026
1027 ++byte_idx;
1028
1029 do
1030 {
1031 c = wchar_from_str(wide, &str, &len);
1032 } while (c == '-' || c == ',');
1033 }
1034
1035 while (c)
1036 {
1038 {
1039 if (!hex)
1040 *hex_len = 0;
1041 return ERROR_INVALID_DATA;
1042 }
1043 c = wchar_from_str(wide, &str, &len);
1044 }
1045
1046 if (hex && byte_idx > *hex_len)
1047 return ERROR_MORE_DATA;
1048
1049 if (ret_flags)
1050 *ret_flags = CRYPT_STRING_HEX;
1051
1052 *hex_len = byte_idx;
1053
1054 return ERROR_SUCCESS;
1055}
static BOOL is_hex_string_special_char(WCHAR c)
Definition: base64.c:948
static BYTE digit_from_char(WCHAR c)
Definition: base64.c:981
static WCHAR wchar_from_str(BOOL wide, const void **str, DWORD *len)
Definition: base64.c:965
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
GLenum GLsizei len
Definition: glext.h:6722
#define c
Definition: ke_i.h:80

Referenced by string_to_hexA(), string_to_hexW(), and test_CryptStringToBinary().

◆ string_to_hexA()

static LONG string_to_hexA ( const char str,
DWORD  len,
BYTE hex,
DWORD hex_len,
DWORD skipped,
DWORD ret_flags 
)
static

Definition at line 1057 of file base64.c.

1058{
1059 return string_to_hex(str, FALSE, len, hex, hex_len, skipped, ret_flags);
1060}
static LONG string_to_hex(const void *str, BOOL wide, DWORD len, BYTE *hex, DWORD *hex_len, DWORD *skipped, DWORD *ret_flags)
Definition: base64.c:991

Referenced by CryptStringToBinaryA().

◆ string_to_hexW()

static LONG string_to_hexW ( const WCHAR str,
DWORD  len,
BYTE hex,
DWORD hex_len,
DWORD skipped,
DWORD ret_flags 
)
static

Definition at line 1275 of file base64.c.

1276{
1277 return string_to_hex(str, TRUE, len, hex, hex_len, skipped, ret_flags);
1278}

Referenced by CryptStringToBinaryW().

◆ wchar_from_str()

static WCHAR wchar_from_str ( BOOL  wide,
const void **  str,
DWORD len 
)
static

Definition at line 965 of file base64.c.

966{
967 WCHAR c;
968
969 if (!*len)
970 return 0;
971
972 --*len;
973 if (wide)
974 c = *(*(const WCHAR **)str)++;
975 else
976 c = *(*(const char **)str)++;
977
978 return c ? c : 0xffff;
979}

Referenced by string_to_hex().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( crypt  )

Variable Documentation

◆ b64

const char b64[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 51 of file base64.c.

Referenced by encode_base64(), encodeBase64A(), encodeBase64W(), setpixel_64bppARGB(), and setpixel_64bppPARGB().

◆ CERT_DELIMITER_W

const WCHAR CERT_DELIMITER_W[] = L"-----"
static

Definition at line 43 of file base64.c.

Referenced by Base64WithHeaderAndTrailerToBinaryW().

◆ CERT_HEADER_START_W

const WCHAR CERT_HEADER_START_W[] = L"-----BEGIN "
static

Definition at line 42 of file base64.c.

Referenced by Base64WithHeaderAndTrailerToBinaryW().

◆ CERT_HEADER_W

const WCHAR CERT_HEADER_W[] = L"-----BEGIN CERTIFICATE-----"
static

Definition at line 41 of file base64.c.

Referenced by BinaryToBase64W().

◆ CERT_REQUEST_HEADER_W

const WCHAR CERT_REQUEST_HEADER_W[] = L"-----BEGIN NEW CERTIFICATE REQUEST-----"
static

Definition at line 46 of file base64.c.

Referenced by BinaryToBase64W().

◆ CERT_REQUEST_TRAILER_W

const WCHAR CERT_REQUEST_TRAILER_W[] = L"-----END NEW CERTIFICATE REQUEST-----"
static

Definition at line 47 of file base64.c.

Referenced by BinaryToBase64W().

◆ CERT_TRAILER_START_W

const WCHAR CERT_TRAILER_START_W[] = L"-----END "
static

Definition at line 45 of file base64.c.

Referenced by Base64WithHeaderAndTrailerToBinaryW().

◆ CERT_TRAILER_W

const WCHAR CERT_TRAILER_W[] = L"-----END CERTIFICATE-----"
static

Definition at line 44 of file base64.c.

Referenced by BinaryToBase64W().

◆ X509_HEADER_W

const WCHAR X509_HEADER_W[] = L"-----BEGIN X509 CRL-----"
static

Definition at line 48 of file base64.c.

Referenced by BinaryToBase64W().

◆ X509_TRAILER_W

const WCHAR X509_TRAILER_W[] = L"-----END X509 CRL-----"
static

Definition at line 49 of file base64.c.

Referenced by BinaryToBase64W().