Refactor SecureString related code to not use BSTR and to be compatible with .NET Core.
Also, pay close attention to making sure every place where the contents of the SecureString are extracted in plain text gets pinned during use and zeroed out afterwards.