CmsMakeEnvDataFromString(String, String, String, CipherAlgorithm, CmsKeyEncrAlgorithm, HashAlgorithm, CmsEnvDataOptions, KdfKdfAlg, KdfKeyWrapAlg, String, Int32, CmsContentEncrAlg) Method |
Create a CMS enveloped-data object from an ASCII string (advanced options).
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.30549 (23.1.0.0)
Syntaxpublic static int MakeEnvDataFromString(
string outputFile,
string inputData,
string certList,
CipherAlgorithm cipherAlg = ,
CmsKeyEncrAlgorithm keyEncrAlg = CmsKeyEncrAlgorithm.Default,
HashAlgorithm hashAlg = HashAlgorithm.Sha1,
CmsEnvDataOptions advOptions = CmsEnvDataOptions.None,
KdfKdfAlg kdfAlg = KdfKdfAlg.X963,
KdfKeyWrapAlg keyWrapAlg = KdfKeyWrapAlg.Default,
string keyString = "",
int count = 0,
CmsContentEncrAlg contEncrAlg = CmsContentEncrAlg.Aes128
)
Public Shared Function MakeEnvDataFromString (
outputFile As String,
inputData As String,
certList As String,
Optional cipherAlg As CipherAlgorithm = ,
Optional keyEncrAlg As CmsKeyEncrAlgorithm = CmsKeyEncrAlgorithm.Default,
Optional hashAlg As HashAlgorithm = HashAlgorithm.Sha1,
Optional advOptions As CmsEnvDataOptions = CmsEnvDataOptions.None,
Optional kdfAlg As KdfKdfAlg = KdfKdfAlg.X963,
Optional keyWrapAlg As KdfKeyWrapAlg = KdfKeyWrapAlg.Default,
Optional keyString As String = "",
Optional count As Integer = 0,
Optional contEncrAlg As CmsContentEncrAlg = CmsContentEncrAlg.Aes128
) As Integer
Parameters
- outputFile String
- Output file to be created
- inputData String
- Input data string, expected plain ASCII text.
- certList String
- List of recipient X.509 certificate filename(s), separated by semi-colons (;).
Alternatively, specify a single PKCS#7 certificate chain file (.p7c/.p7b).
Special cases:
Set as "type=@pwri" to create a single recipientInfo of the PasswordRecipientInfo type (pwri);
or set as "type=@kekri,keyid=<string>" to create a single recipientInfo of the KEKRecipientInfo type (kekri). See Remarks.
- cipherAlg CipherAlgorithm (Optional)
- Content encryption algorithm [default=ignored]. Deprecated: use contEncrAlg.
(This parameter will be removed in a future update)
- keyEncrAlg CmsKeyEncrAlgorithm (Optional)
- Key encryption algorithm [default=rsaEncryption)]
- hashAlg HashAlgorithm (Optional)
- Hash function where applicable. Must be one of the SHA-* family [default=SHA-1; SHA-256 for RSA-KEM]
- advOptions CmsEnvDataOptions (Optional)
- Advanced options. See CmsEnvDataOptions.
- kdfAlg KdfKdfAlg (Optional)
- Key derivation function (KDF) for ECDH key agreement scheme (where applicable)
- keyWrapAlg KdfKeyWrapAlg (Optional)
- Key wrap algorithm for ECDH key agreement scheme (default=match content encryption algorithm)
- keyString String (Optional)
- (formerly ukmString) Use to pass optional additional user key material (ukm) for KDF where KeyAgreement (kari) type or RSA-KEM is used.
Or use to pass the password for a pwri type or the key encryption key (KEK) for a kekri type.
Either pass a plain ASCII string, e.g. "abc" or use the format "#x<hex-digits>" to pass a string of arbitrary octet values,
e.g. "#xdeadbeef01" to pass the 5 bytes 0xde,0xad,0xbe,0xef,0x01. Optional for kari types but required for pwri and kekri types.
- count Int32 (Optional)
- Optional iteration count for KDF in pwri type (default=4096) or tag length for AuthEnvelopedData (in range 12-16, default=16). Otherwise ignored.
- contEncrAlg CmsContentEncrAlg (Optional)
- Alternative way to specify content encryption algorithm with more options. Takes precedence over cipherAlg. [default=AES128-CBC]
Return Value
Int32Number of successful recipients or negative
error code
Remarks
See remarks for
MakeEnvData(String, String, String, CipherAlgorithm, CmsKeyEncrAlgorithm, HashAlgorithm, CmsEnvDataOptions, KdfKdfAlg, KdfKeyWrapAlg, String, Int32, CmsContentEncrAlg)
See Also