public byte[] EncodeX509KeyUsageExtension(X509KeyUsageFlags keyUsages) { unsafe { ushort keyUsagesAsShort = (ushort)keyUsages; CRYPT_BIT_BLOB blob = new CRYPT_BIT_BLOB() { cbData = 2, pbData = (byte *)&keyUsagesAsShort, cUnusedBits = 0, }; return(Interop.crypt32.EncodeObject(CryptDecodeObjectStructType.X509_KEY_USAGE, &blob)); } }
internal CMSG_CTRL_KEY_AGREE_DECRYPT_PARA(int size) { cbSize = (uint) size; hCryptProv = IntPtr.Zero; dwKeySpec = 0; pKeyAgree = IntPtr.Zero; dwRecipientIndex = 0; dwRecipientEncryptedKeyIndex = 0; OriginatorPublicKey = new CRYPT_BIT_BLOB(); }