internal SubjectIdentifier(System.Security.Cryptography.CAPI.CERT_ID certId) { switch (certId.dwIdChoice) { case 1: { X509IssuerSerial serial = PkcsUtils.DecodeIssuerSerial(certId.Value.IssuerSerialNumber); this.Reset(SubjectIdentifierType.IssuerAndSerialNumber, serial); return; } case 2: { byte[] destination = new byte[certId.Value.KeyId.cbData]; Marshal.Copy(certId.Value.KeyId.pbData, destination, 0, destination.Length); this.Reset(SubjectIdentifierType.SubjectKeyIdentifier, System.Security.Cryptography.X509Certificates.X509Utils.EncodeHexString(destination)); return; } } throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_Cms_Invalid_Subject_Identifier_Type"), certId.dwIdChoice.ToString(CultureInfo.InvariantCulture)); }
internal CMSG_SIGNER_ENCODE_INFO(int size) { this.cbSize = (uint) size; this.pCertInfo = IntPtr.Zero; this.hCryptProv = IntPtr.Zero; this.dwKeySpec = 0; this.HashAlgorithm = new System.Security.Cryptography.CAPI.CRYPT_ALGORITHM_IDENTIFIER(); this.pvHashAuxInfo = IntPtr.Zero; this.cAuthAttr = 0; this.rgAuthAttr = IntPtr.Zero; this.cUnauthAttr = 0; this.rgUnauthAttr = IntPtr.Zero; this.SignerId = new System.Security.Cryptography.CAPI.CERT_ID(); this.HashEncryptionAlgorithm = new System.Security.Cryptography.CAPI.CRYPT_ALGORITHM_IDENTIFIER(); this.pvHashEncryptionAuxInfo = IntPtr.Zero; }