PeerIdentityImport function (p2p.h)
The PeerIdentityImport function imports one peer identity. If the peer identity exists on a computer, PEER_E_ALREADY_EXISTS is returned.
Syntax
NOT_BUILD_WINDOWS_DEPRECATE HRESULT PeerIdentityImport(
[in] PCWSTR pwzImportXML,
[in] PCWSTR pwzPassword,
[out] PWSTR *ppwzIdentity
);
Parameters
[in] pwzImportXML
Pointer to the XML format peer identity to import, which is returned by PeerIdentityExport. This binary data must match the exported data byte-for-byte. The XML must remain valid XML with no extra characters.
[in] pwzPassword
Specifies the password to use to de-crypt a peer identity. The password must be identical to the password supplied to PeerIdentityExport. This parameter cannot be NULL.
[out] ppwzIdentity
Pointer to a string that represents a peer identity that is imported. If the import operation is successful, the application must free ppwzIdentity by calling PeerFreeData.
Return value
If the function call succeeds, the return value is S_OK. Otherwise, it returns one of the following values.
Return code | Description |
---|---|
|
One of the parameters is not valid, or the XML data in ppwzImportXML has been tampered with. |
|
There is not enough memory to perform the specified operation. |
|
The peer identity already exists on this computer. |
|
Access to the peer identity or peer group keys is denied. Typically, this is caused by an incorrect access control list (ACL) for the folder that contains the user or computer keys. This can happen when the ACL has been reset manually. |
Remarks
The XML fragment used by PeerIdentityImport is as follows:
<PEERIDENTITYEXPORT VERSION="1.0">
<IDENTITY>
<!-- UTF-8 encoded peer name of the identity -->
</IDENTITY>
<IDENTITYDATA xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">
<!-- base64 encoded / PFX encoded and encrypted IDC with the private key -->
</IDENTTYDATA>
</PEERIDENTITYEXPORT>
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP with SP2 [desktop apps only],Windows XP with SP1 with the Advanced Networking Pack for Windows XP |
Minimum supported server | None supported |
Target Platform | Windows |
Header | p2p.h |
Library | P2P.lib |
DLL | P2P.dll |