Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9194d600
Commit
9194d600
authored
Aug 02, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Test encoding/decoding a couple more alt name entry types.
parent
0cb61484
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
2 deletions
+70
-2
encode.c
dlls/crypt32/tests/encode.c
+70
-2
No files found.
dlls/crypt32/tests/encode.c
View file @
9194d600
...
...
@@ -1291,6 +1291,12 @@ static const BYTE encodedDnsName[] = { 0x30, 0x0c, 0x82, 0x0a, 0x77, 0x69,
static
const
BYTE
localhost
[]
=
{
127
,
0
,
0
,
1
};
static
const
BYTE
encodedIPAddr
[]
=
{
0x30
,
0x06
,
0x87
,
0x04
,
0x7f
,
0x00
,
0x00
,
0x01
};
static
const
unsigned
char
encodedCommonName
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
'J'
,
'u'
,
'a'
,
'n'
,
' '
,
'L'
,
'a'
,
'n'
,
'g'
,
0
};
static
const
BYTE
encodedOidName
[]
=
{
0x30
,
0x04
,
0x88
,
0x02
,
0x2a
,
0x03
};
static
const
BYTE
encodedDirectoryName
[]
=
{
0x30
,
0x19
,
0xa4
,
0x17
,
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
};
static
void
test_encodeAltName
(
DWORD
dwEncoding
)
{
...
...
@@ -1299,6 +1305,7 @@ static void test_encodeAltName(DWORD dwEncoding)
BYTE
*
buf
=
NULL
;
DWORD
size
=
0
;
BOOL
ret
;
char
oid
[]
=
"1.2.3"
;
/* Test with empty info */
ret
=
CryptEncodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
&
info
,
...
...
@@ -1379,6 +1386,29 @@ static void test_encodeAltName(DWORD dwEncoding)
ok
(
!
memcmp
(
buf
,
encodedIPAddr
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
/* Test with OID */
entry
.
dwAltNameChoice
=
CERT_ALT_NAME_REGISTERED_ID
;
U
(
entry
).
pszRegisteredID
=
oid
;
ret
=
CryptEncodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
size
);
if
(
buf
)
{
ok
(
size
==
sizeof
(
encodedOidName
),
"Wrong size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
encodedOidName
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
/* Test with directory name */
entry
.
dwAltNameChoice
=
CERT_ALT_NAME_DIRECTORY_NAME
;
U
(
entry
).
DirectoryName
.
cbData
=
sizeof
(
encodedCommonName
);
U
(
entry
).
DirectoryName
.
pbData
=
(
LPBYTE
)
encodedCommonName
;
ret
=
CryptEncodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
size
);
if
(
buf
)
{
ok
(
size
==
sizeof
(
encodedDirectoryName
),
"Wrong size %d
\n
"
,
size
);
ok
(
!
memcmp
(
buf
,
encodedDirectoryName
,
size
),
"Unexpected value
\n
"
);
LocalFree
(
buf
);
}
}
static
void
test_decodeAltName
(
DWORD
dwEncoding
)
...
...
@@ -1489,6 +1519,46 @@ static void test_decodeAltName(DWORD dwEncoding)
sizeof
(
localhost
)),
"Unexpected IP address value
\n
"
);
LocalFree
(
buf
);
}
ret
=
CryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
encodedOidName
,
sizeof
(
encodedOidName
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
todo_wine
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
buf
)
{
info
=
(
CERT_ALT_NAME_INFO
*
)
buf
;
ok
(
info
->
cAltEntry
==
1
,
"Expected 1 entries, got %d
\n
"
,
info
->
cAltEntry
);
ok
(
info
->
rgAltEntry
[
0
].
dwAltNameChoice
==
CERT_ALT_NAME_REGISTERED_ID
,
"Expected CERT_ALT_NAME_REGISTERED_ID, got %d
\n
"
,
info
->
rgAltEntry
[
0
].
dwAltNameChoice
);
ok
(
!
strcmp
(
info
->
rgAltEntry
[
0
].
pszRegisteredID
,
"1.2.3"
),
"Expected OID 1.2.3, got %s
\n
"
,
info
->
rgAltEntry
[
0
].
pszRegisteredID
);
LocalFree
(
buf
);
}
ret
=
CryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
encodedDirectoryName
,
sizeof
(
encodedDirectoryName
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
todo_wine
ok
(
ret
,
"CryptDecodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
buf
)
{
info
=
(
CERT_ALT_NAME_INFO
*
)
buf
;
ok
(
info
->
cAltEntry
==
1
,
"Expected 1 entries, got %d
\n
"
,
info
->
cAltEntry
);
ok
(
info
->
rgAltEntry
[
0
].
dwAltNameChoice
==
CERT_ALT_NAME_DIRECTORY_NAME
,
"Expected CERT_ALT_NAME_DIRECTORY_NAME, got %d
\n
"
,
info
->
rgAltEntry
[
0
].
dwAltNameChoice
);
ok
(
U
(
info
->
rgAltEntry
[
0
]).
DirectoryName
.
cbData
==
sizeof
(
encodedCommonName
),
"Unexpected directory name length %d
\n
"
,
U
(
info
->
rgAltEntry
[
0
]).
DirectoryName
.
cbData
);
ok
(
!
memcmp
(
U
(
info
->
rgAltEntry
[
0
]).
DirectoryName
.
pbData
,
encodedCommonName
,
sizeof
(
encodedCommonName
)),
"Unexpected directory name value
\n
"
);
LocalFree
(
buf
);
}
}
struct
UnicodeExpectedError
...
...
@@ -1981,8 +2051,6 @@ static void test_encodeBasicConstraints(DWORD dwEncoding)
}
static
const
unsigned
char
bin63
[]
=
{
0x30
,
0x06
,
0x01
,
0x01
,
0x01
,
0x02
,
0x01
,
0x01
};
static
const
unsigned
char
encodedCommonName
[]
=
{
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
'J'
,
'u'
,
'a'
,
'n'
,
' '
,
'L'
,
'a'
,
'n'
,
'g'
,
0
};
static
void
test_decodeBasicConstraints
(
DWORD
dwEncoding
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment