EncryptedData.Encrypt method
[CAPICOM is a 32-bit only component that is available for use in the following operating systems: Windows Server 2008, Windows Vista, and Windows XP. Instead, use Platform Invocation Services (PInvoke) to call the Win32 API functions CryptEncryptMessage and CryptDecryptMessage to encrypt and decrypt messages. For information about PInvoke, see Platform Invoke Tutorial. The .NET and CryptoAPI via P/Invoke: Part 1 and .NET and CryptoAPI via P/Invoke: Part 2 subsections of Extending .NET Cryptography with CAPICOM and P/Invoke may also be helpful.]
The Encrypt method derives a session key from the secret and encrypts the Content property value using that key. It returns the encrypted content as an encoded string.
Syntax
EncryptedData.Encrypt( _
[ ByVal EncodingType ] _
)
Parameters
-
EncodingType [in, optional]
-
A value of the CAPICOM_ENCODING_TYPE enumeration that indicates the encoding type used to encode the encrypted data. The default value is CAPICOM_ENCODE_BASE64. This parameter can be one of the following values.
Value Meaning - CAPICOM_ENCODE_ANY
This encoding type is used only when the input data has an unknown encoding type. If this value is used to specify the output's encoding type, CAPICOM_ENCODE_BASE64 will be used instead. Introduced in CAPICOM 2.0. - CAPICOM_ENCODE_BASE64
Data is saved as a base64-encoded string. - CAPICOM_ENCODE_BINARY
Data is saved as a pure binary sequence.
Return value
A string that contains the encrypted, encoded data.
Remarks
Before calling the Encrypt method, set the Content property and call the SetSecret method.
Requirements
Requirement | Value |
---|---|
End of client support |
Windows Vista |
End of server support |
Windows Server 2008 |
Redistributable |
CAPICOM 2.0 or later on Windows Server 2003 and Windows XP |
Header |
|
DLL |
|
See also