I am trying to generate **X509Certificate2** certificate from **.pfx** file
string Location = "C:/Users/SSB/Downloads/PFX file/CertificatePFX.pfx";
string pass = "0987654321";
X509Certificate2 certificate = new X509Certificate2(Location, pass);
but the unity gave me error as
CryptographicException: Input data cannot be coded as a valid certificate.
Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) (at <6a66fe237d4242c9924192d3c28dd540>:0)
Rethrow as CryptographicException: Input data cannot be coded as a valid certificate.
Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) (at <6a66fe237d4242c9924192d3c28dd540>:0)
Mono.Security.X509.X509Certificate..ctor (System.Byte[] data) (at <6a66fe237d4242c9924192d3c28dd540>:0)
System.Security.Cryptography.X509Certificates.X509Certificate2ImplMono.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) (at <6fcfdd162b5d4836bef3c96f53194db6>:0)
System.Security.Cryptography.X509Certificates.X509Helper2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags, System.Boolean disableProvider) (at <6fcfdd162b5d4836bef3c96f53194db6>:0)
System.Security.Cryptography.X509Certificates.X509Certificate2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) (at <6fcfdd162b5d4836bef3c96f53194db6>:0)
System.Security.Cryptography.X509Certificates.X509Certificate2.Import (System.String fileName, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) (at <6fcfdd162b5d4836bef3c96f53194db6>:0)
System.Security.Cryptography.X509Certificates.X509Certificate2..ctor (System.String fileName, System.String password) (at <6fcfdd162b5d4836bef3c96f53194db6>:0)
Please tell me where am I wrong? and what should be done to make this work?
unity version: 2020.3.14f1
↧