using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; namespace QRBee.Core.Security { /// /// Private key manipulation methods /// public interface IPrivateKeyHandler { /// /// Check if private key exists on this machine /// /// bool Exists(); /// /// Generate new private key and store it /// /// /// Certificate request to be sent to CA in PEM format ReadableCertificateRequest GeneratePrivateKey(string subjectName = null); /// /// Re-create certificate request if CA response was not received in time. /// /// Certificate request to be sent to CA in PEM format ReadableCertificateRequest CreateCertificateRequest(string subjectName); /// /// Attach CA-generated public key certificate to the private key /// and store it /// /// void AttachCertificate(X509Certificate2 cert); /// /// Load private key. Note that public key certificate part can be /// self-signed until CA issues a proper certificate /// /// RSA LoadPrivateKey(); /// /// Get public key certificate /// /// Public key certificate X509Certificate2 GetCertificate(); } }