//! Implementation of asymmetric cryptography using Windows CNG API.
#![allow(unused_variables)]
use std::time::SystemTime;
use std::convert::TryInto;
use crate::{Error, Result};
use crate::crypto::asymmetric::{Decryptor, KeyPair, Signer};
use crate::crypto::backend::interface::Asymmetric;
use crate::crypto::mem::Protected;
use crate::crypto::mpi;
use crate::crypto::SessionKey;
use crate::crypto::{pad, pad_at_least, pad_truncating};
use crate::packet::key::{Key4, SecretParts};
use crate::packet::{key, Key};
use crate::types::PublicKeyAlgorithm;
use crate::types::{Curve, HashAlgorithm};
use num_bigint_dig::{traits::ModInverse, BigInt, BigUint};
use win_crypto_ng as cng;
const CURVE25519_SIZE: usize = 32;
impl Asymmetric for super::Backend {
fn x25519_generate_key() -> Result<(Protected, [u8; 32])> {
use cng::asymmetric::{Ecdh, AsymmetricKey, Export};
use cng::asymmetric::ecc::Curve25519;
let pair =
AsymmetricKey::builder(Ecdh(Curve25519)).build()?.export()?;
let mut public = [0u8; 32];
public.copy_from_slice(pair.x());
Ok((pair.d().into(), public))
}