/// <summary> /// Create a certificate from binary data. /// </summary> /// <param name="Data">Binary certificate data</param> public Certificate(byte[] Data) { //Goedel.Debug.Trace.WriteLine(Convert.ToBase64String(Data)); _Data = Data; var X509Cert = new X509Certificate2(Data); _KeyPair = KeyPair.GetKeyPair(X509Cert.PublicKey.Key); TBSCertificate = new TBSCertificate(X509Cert); }
/// <summary> /// Create a certificate with the specified subject Key. Note that the template is /// must be completed with calls to set validity etc. before use. /// </summary> /// <param name="SubjectKey">Cryptographic provider for the subject key.</param> /// <param name="Application">Certificate application(s).</param> /// <param name="Subject">Subject name.</param> /// <param name="SubjectAltName">The certificate subject altname</param> public Certificate(KeyPair SubjectKey, Application Application, string Subject, string SubjectAltName) { _KeyPair = SubjectKey; var SubjectName = new Name(Subject).ToList(); TBSCertificate = new TBSCertificate(SubjectKey, SubjectName); TBSCertificate.SetProfile(Application); TBSCertificate.SetSubjectAltName(SubjectAltName); }
/// <summary> /// Create a certificate with the specified subject Key. Note that the template is /// must be completed with calls to set validity etc. before use. /// </summary> /// <param name="SubjectKey">Cryptographic provider for the subject key.</param> /// <param name="Application">Certificate application(s).</param> public Certificate(CryptoProvider SubjectKey, Application Application) { _KeyPair = SubjectKey.KeyPair; if (SubjectKey as CryptoProviderSignature != null) { _CryptoProviderSignature = SubjectKey as CryptoProviderSignature; } if (SubjectKey as CryptoProviderExchange != null) { _CryptoProviderExchange = SubjectKey as CryptoProviderExchange; } var SubjectName = new Name(SubjectKey).ToList(); TBSCertificate = new TBSCertificate(SubjectKey.KeyPair, SubjectName); }
/// <summary> /// Create a certificate with the specified subject Key. Note that the template is /// must be completed with calls to set validity etc. before use. /// </summary> /// <param name="SubjectKey">Cryptographic provider for the subject key.</param> /// <param name="Application">Certificate application(s).</param> public Certificate(KeyPair SubjectKey, Application Application) { _KeyPair = SubjectKey; var SubjectName = new Name(SubjectKey).ToList(); TBSCertificate = new TBSCertificate(SubjectKey, SubjectName); }