Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DeriveSecretAgreementHandle() [1/2]

SafeNCryptSecretHandle System.Security.Cryptography.ECDiffieHellmanCng.DeriveSecretAgreementHandle ( CngKey otherPartyPublicKey)
inline

Definition at line 314 of file ECDiffieHellmanCng.cs.

315 {
316 if (otherPartyPublicKey == null)
317 {
318 throw new ArgumentNullException("otherPartyPublicKey");
319 }
320 if (otherPartyPublicKey.AlgorithmGroup != CngAlgorithmGroup.ECDiffieHellman)
321 {
322 throw new ArgumentException(System.SR.Cryptography_ArgECDHRequiresECDHKey, "otherPartyPublicKey");
323 }
324 if (otherPartyPublicKey.KeySize != KeySize)
325 {
326 throw new ArgumentException(System.SR.Cryptography_ArgECDHKeySizeMismatch, "otherPartyPublicKey");
327 }
328 using SafeNCryptKeyHandle privateKey = Key.Handle;
329 using SafeNCryptKeyHandle otherPartyPublicKey2 = otherPartyPublicKey.Handle;
330 return global::Interop.NCrypt.DeriveSecretAgreement(privateKey, otherPartyPublicKey2);
331 }
static string Cryptography_ArgECDHRequiresECDHKey
Definition SR.cs:42
static string Cryptography_ArgECDHKeySizeMismatch
Definition SR.cs:40
Definition SR.cs:7
SafeNCryptKeyHandle Handle
Definition CngKey.cs:51

References System.Security.Cryptography.CngKey.AlgorithmGroup, System.SR.Cryptography_ArgECDHKeySizeMismatch, System.SR.Cryptography_ArgECDHRequiresECDHKey, System.Security.Cryptography.CngAlgorithmGroup.ECDiffieHellman, System.Security.Cryptography.CngKey.Handle, System.Security.Cryptography.ECDiffieHellmanCng.Key, System.Security.Cryptography.CngKey.KeySize, and System.Security.Cryptography.ECDiffieHellmanCng.KeySize.