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
6ad5416f
Commit
6ad5416f
authored
Dec 01, 2010
by
Alexander Morozov
Committed by
Alexandre Julliard
Dec 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Implement getting content of an enveloped message.
parent
03e94320
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
5 deletions
+125
-5
crypt32_private.h
dlls/crypt32/crypt32_private.h
+18
-0
encode.c
dlls/crypt32/encode.c
+55
-0
msg.c
dlls/crypt32/msg.c
+52
-3
msg.c
dlls/crypt32/tests/msg.c
+0
-2
No files found.
dlls/crypt32/crypt32_private.h
View file @
6ad5416f
...
@@ -82,6 +82,24 @@ typedef struct _CRYPT_DIGESTED_DATA
...
@@ -82,6 +82,24 @@ typedef struct _CRYPT_DIGESTED_DATA
BOOL
CRYPT_AsnEncodePKCSDigestedData
(
const
CRYPT_DIGESTED_DATA
*
digestedData
,
BOOL
CRYPT_AsnEncodePKCSDigestedData
(
const
CRYPT_DIGESTED_DATA
*
digestedData
,
void
*
pvData
,
DWORD
*
pcbData
);
void
*
pvData
,
DWORD
*
pcbData
);
typedef
struct
_CRYPT_ENCRYPTED_CONTENT_INFO
{
LPSTR
contentType
;
CRYPT_ALGORITHM_IDENTIFIER
contentEncryptionAlgorithm
;
CRYPT_DATA_BLOB
encryptedContent
;
}
CRYPT_ENCRYPTED_CONTENT_INFO
;
typedef
struct
_CRYPT_ENVELOPED_DATA
{
DWORD
version
;
DWORD
cRecipientInfo
;
PCMSG_KEY_TRANS_RECIPIENT_INFO
rgRecipientInfo
;
CRYPT_ENCRYPTED_CONTENT_INFO
encryptedContentInfo
;
}
CRYPT_ENVELOPED_DATA
;
BOOL
CRYPT_AsnEncodePKCSEnvelopedData
(
const
CRYPT_ENVELOPED_DATA
*
envelopedData
,
void
*
pvData
,
DWORD
*
pcbData
);
typedef
struct
_CRYPT_SIGNED_INFO
typedef
struct
_CRYPT_SIGNED_INFO
{
{
DWORD
version
;
DWORD
version
;
...
...
dlls/crypt32/encode.c
View file @
6ad5416f
...
@@ -4293,6 +4293,61 @@ BOOL CRYPT_AsnEncodeCMSSignedInfo(CRYPT_SIGNED_INFO *signedInfo, void *pvData,
...
@@ -4293,6 +4293,61 @@ BOOL CRYPT_AsnEncodeCMSSignedInfo(CRYPT_SIGNED_INFO *signedInfo, void *pvData,
return
ret
;
return
ret
;
}
}
static
BOOL
WINAPI
CRYPT_AsnEncodeRecipientInfo
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
const
CMSG_KEY_TRANS_RECIPIENT_INFO
*
info
=
pvStructInfo
;
struct
AsnEncodeSequenceItem
items
[]
=
{
{
&
info
->
dwVersion
,
CRYPT_AsnEncodeInt
,
0
},
{
&
info
->
RecipientId
.
u
.
IssuerSerialNumber
,
CRYPT_AsnEncodeIssuerSerialNumber
,
0
},
{
&
info
->
KeyEncryptionAlgorithm
,
CRYPT_AsnEncodeAlgorithmIdWithNullParams
,
0
},
{
&
info
->
EncryptedKey
,
CRYPT_AsnEncodeOctets
,
0
},
};
return
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
);
}
static
BOOL
WINAPI
CRYPT_AsnEncodeEncryptedContentInfo
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
DWORD
dwFlags
,
PCRYPT_ENCODE_PARA
pEncodePara
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
const
CRYPT_ENCRYPTED_CONTENT_INFO
*
info
=
pvStructInfo
;
struct
AsnEncodeTagSwappedItem
swapped
=
{
ASN_CONTEXT
|
0
,
&
info
->
encryptedContent
,
CRYPT_AsnEncodeOctets
};
struct
AsnEncodeSequenceItem
items
[]
=
{
{
info
->
contentType
,
CRYPT_AsnEncodeOid
,
0
},
{
&
info
->
contentEncryptionAlgorithm
,
CRYPT_AsnEncodeAlgorithmIdWithNullParams
,
0
},
{
&
swapped
,
CRYPT_AsnEncodeSwapTag
,
0
},
};
return
CRYPT_AsnEncodeSequence
(
dwCertEncodingType
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
dwFlags
,
pEncodePara
,
pbEncoded
,
pcbEncoded
);
}
BOOL
CRYPT_AsnEncodePKCSEnvelopedData
(
const
CRYPT_ENVELOPED_DATA
*
envelopedData
,
void
*
pvData
,
DWORD
*
pcbData
)
{
struct
DERSetDescriptor
recipientInfosSet
=
{
envelopedData
->
cRecipientInfo
,
envelopedData
->
rgRecipientInfo
,
sizeof
(
CMSG_KEY_TRANS_RECIPIENT_INFO
),
0
,
CRYPT_AsnEncodeRecipientInfo
};
struct
AsnEncodeSequenceItem
items
[]
=
{
{
&
envelopedData
->
version
,
CRYPT_AsnEncodeInt
,
0
},
{
&
recipientInfosSet
,
CRYPT_DEREncodeItemsAsSet
,
0
},
{
&
envelopedData
->
encryptedContentInfo
,
CRYPT_AsnEncodeEncryptedContentInfo
,
0
},
};
return
CRYPT_AsnEncodeSequence
(
X509_ASN_ENCODING
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
0
,
NULL
,
pvData
,
pcbData
);
}
static
CryptEncodeObjectExFunc
CRYPT_GetBuiltinEncoder
(
DWORD
dwCertEncodingType
,
static
CryptEncodeObjectExFunc
CRYPT_GetBuiltinEncoder
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
)
LPCSTR
lpszStructType
)
{
{
...
...
dlls/crypt32/msg.c
View file @
6ad5416f
...
@@ -1785,9 +1785,58 @@ static void CEnvelopedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
...
@@ -1785,9 +1785,58 @@ static void CEnvelopedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
static
BOOL
CEnvelopedEncodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
static
BOOL
CEnvelopedEncodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
DWORD
dwIndex
,
void
*
pvData
,
DWORD
*
pcbData
)
DWORD
dwIndex
,
void
*
pvData
,
DWORD
*
pcbData
)
{
{
FIXME
(
"(%p, %d, %d, %p, %p): stub
\n
"
,
hCryptMsg
,
dwParamType
,
dwIndex
,
CEnvelopedEncodeMsg
*
msg
=
hCryptMsg
;
pvData
,
pcbData
);
BOOL
ret
=
FALSE
;
return
FALSE
;
switch
(
dwParamType
)
{
case
CMSG_BARE_CONTENT_PARAM
:
if
(
msg
->
base
.
streamed
)
SetLastError
(
E_INVALIDARG
);
else
{
char
oid_rsa_data
[]
=
szOID_RSA_data
;
CRYPT_ENVELOPED_DATA
envelopedData
=
{
CMSG_ENVELOPED_DATA_PKCS_1_5_VERSION
,
msg
->
cRecipientInfo
,
msg
->
recipientInfo
,
{
oid_rsa_data
,
msg
->
algo
,
msg
->
data
}
};
ret
=
CRYPT_AsnEncodePKCSEnvelopedData
(
&
envelopedData
,
pvData
,
pcbData
);
}
break
;
case
CMSG_CONTENT_PARAM
:
{
CRYPT_CONTENT_INFO
info
;
ret
=
CryptMsgGetParam
(
hCryptMsg
,
CMSG_BARE_CONTENT_PARAM
,
0
,
NULL
,
&
info
.
Content
.
cbData
);
if
(
ret
)
{
info
.
Content
.
pbData
=
CryptMemAlloc
(
info
.
Content
.
cbData
);
if
(
info
.
Content
.
pbData
)
{
ret
=
CryptMsgGetParam
(
hCryptMsg
,
CMSG_BARE_CONTENT_PARAM
,
0
,
info
.
Content
.
pbData
,
&
info
.
Content
.
cbData
);
if
(
ret
)
{
char
oid_rsa_enveloped
[]
=
szOID_RSA_envelopedData
;
info
.
pszObjId
=
oid_rsa_enveloped
;
ret
=
CryptEncodeObjectEx
(
X509_ASN_ENCODING
,
PKCS_CONTENT_INFO
,
&
info
,
0
,
NULL
,
pvData
,
pcbData
);
}
CryptMemFree
(
info
.
Content
.
pbData
);
}
else
ret
=
FALSE
;
}
break
;
}
default:
SetLastError
(
CRYPT_E_INVALID_MSG_TYPE
);
}
return
ret
;
}
}
static
BOOL
CEnvelopedEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
static
BOOL
CEnvelopedEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
...
...
dlls/crypt32/tests/msg.c
View file @
6ad5416f
...
@@ -2248,11 +2248,9 @@ static void test_enveloped_msg_encoding(void)
...
@@ -2248,11 +2248,9 @@ static void test_enveloped_msg_encoding(void)
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
"CryptMsgOpenToEncode failed: %08x
\n
"
,
GetLastError
());
if
(
msg
)
if
(
msg
)
{
{
todo_wine
check_param
(
"enveloped empty bare content"
,
msg
,
check_param
(
"enveloped empty bare content"
,
msg
,
CMSG_BARE_CONTENT_PARAM
,
envelopedEmptyBareContent
,
CMSG_BARE_CONTENT_PARAM
,
envelopedEmptyBareContent
,
sizeof
(
envelopedEmptyBareContent
));
sizeof
(
envelopedEmptyBareContent
));
todo_wine
check_param
(
"enveloped empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
check_param
(
"enveloped empty content"
,
msg
,
CMSG_CONTENT_PARAM
,
envelopedEmptyContent
,
sizeof
(
envelopedEmptyContent
));
envelopedEmptyContent
,
sizeof
(
envelopedEmptyContent
));
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
...
...
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