Exemple #1
0
 private void Reset(int version)
 {
     this.m_version             = version;
     this.m_recipientIdentifier = (SubjectIdentifier)null;
     this.m_encryptionAlgorithm = (AlgorithmIdentifier)null;
     this.m_encryptedKey        = new byte[0];
 }
Exemple #2
0
 private void Reset(uint originatorChoice, uint version, CAPI.CMSG_RECIPIENT_ENCRYPTED_KEY_INFO encryptedKeyInfo, uint subIndex)
 {
     this.m_encryptedKeyInfo     = encryptedKeyInfo;
     this.m_originatorChoice     = originatorChoice;
     this.m_version              = (int)version;
     this.m_originatorIdentifier = (SubjectIdentifierOrKey)null;
     this.m_userKeyMaterial      = new byte[0];
     this.m_encryptionAlgorithm  = (AlgorithmIdentifier)null;
     this.m_recipientIdentifier  = (SubjectIdentifier)null;
     this.m_encryptedKey         = new byte[0];
     this.m_date = DateTime.MinValue;
     this.m_otherKeyAttribute = (CryptographicAttributeObject)null;
     this.m_subIndex          = subIndex;
 }
Exemple #3
0
        internal static X509Certificate2 FindCertificate(SubjectIdentifier identifier, X509Certificate2Collection certificates)
        {
            X509Certificate2 x509Certificate2 = (X509Certificate2)null;

            if (certificates != null && certificates.Count > 0)
            {
                switch (identifier.Type)
                {
                case SubjectIdentifierType.IssuerAndSerialNumber:
                    X509Certificate2Collection certificate2Collection1 = certificates.Find(X509FindType.FindByIssuerDistinguishedName, (object)((X509IssuerSerial)identifier.Value).IssuerName, false);
                    if (certificate2Collection1.Count > 0)
                    {
                        X509Certificate2Collection certificate2Collection2 = certificate2Collection1.Find(X509FindType.FindBySerialNumber, (object)((X509IssuerSerial)identifier.Value).SerialNumber, false);
                        if (certificate2Collection2.Count > 0)
                        {
                            x509Certificate2 = certificate2Collection2[0];
                            break;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }

                case SubjectIdentifierType.SubjectKeyIdentifier:
                    X509Certificate2Collection certificate2Collection3 = certificates.Find(X509FindType.FindBySubjectKeyIdentifier, identifier.Value, false);
                    if (certificate2Collection3.Count > 0)
                    {
                        x509Certificate2 = certificate2Collection3[0];
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(x509Certificate2);
        }