Skip to content
Snippets Groups Projects
rsa.hh 739 B
Newer Older
  • Learn to ignore specific revisions
  • #ifndef __VEREIGN_NCRYPT_RSA_HH
    #define __VEREIGN_NCRYPT_RSA_HH
    
    #include <vereign/ncrypt/unique_ptr.hh>
    #include <vereign/bytes/buffer.hh>
    
    #include <windows.h>
    #include <ncrypt.h>
    #include <string>
    
    namespace vereign::ncrypt::rsa {
    
    auto OpenStorageProvider() -> UniquePtr;
    auto LoadKey(NCRYPT_PROV_HANDLE provider, const std::string& key_name) -> UniquePtr;
    auto CreateKey(NCRYPT_PROV_HANDLE provider, int bits, const std::string& key_name) -> UniquePtr;
    void DeleteKey(NCRYPT_KEY_HANDLE key);
    
    void PublicKeyEncrypt(NCRYPT_KEY_HANDLE key, bytes::View src, bytes::Buffer& encrypted);
    void PrivateKeyDecrypt(NCRYPT_KEY_HANDLE key, bytes::View src, bytes::Buffer& decrypted);
    
    } // vereign::ncrypt::rsa
    
    #endif // __VEREIGN_NCRYPT_RSA_HH