Example #1
0
        static DCinemaSecurityMessageType AppendFLMRequiredExtension(DCinemaSecurityMessageType extraTheatreMessage, FLMRequiredExtensionsType flmRequiredExtention)
        {
            DCinemaSecurityMessageType facilityListMessage = extraTheatreMessage;

            StringWriter stringWriter = new StringWriter();
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(FLMRequiredExtensionsType));
            xmlSerializer.Serialize(stringWriter, flmRequiredExtention);
            string serializedXML = stringWriter.ToString();
            XmlDocument docFlmRequiredExtention = new XmlDocument();
            docFlmRequiredExtention.LoadXml(serializedXML);

            facilityListMessage.AuthenticatedPublic.RequiredExtensions = docFlmRequiredExtention.DocumentElement;

            extraTheatreMessage.AuthenticatedPublic.MessageType = "http://www.smpte-ra.org/schemas/430-7/2008/FLM";
            extraTheatreMessage.AuthenticatedPublic.AnnotationText.Value = "Test Facility List Message";

            return facilityListMessage;
        }
        private static FLMRequiredExtensionsType BuildFlmRequiredExtention(X509Certificate2 x509Certificate2, ISingleResult<flm_GetFacilityInfoResult> facilityInfoCollection, ArrayList secureDeviceArray)
        {
            FLMRequiredExtensionsType flmRequiredExtention = new FLMRequiredExtensionsType();

            flm_GetFacilityInfoResult facilityInfo = facilityInfoCollection.First();

            #region Build the FacilityInfo element
            flmRequiredExtention.FacilityInfo = new FLMRequiredExtensionsTypeFacilityInfo();
            flmRequiredExtention.FacilityInfo.FacilityID = "urn:x-facilityID:" + facilityInfo.URI_Mapping + ":" + facilityInfo.Site_Code.ToString();
            flmRequiredExtention.FacilityInfo.AnnotationText = new UserTextType();
            flmRequiredExtention.FacilityInfo.AnnotationText.language = "en-us";
            flmRequiredExtention.FacilityInfo.AnnotationText.Value = "FLM for site " + facilityInfo.Site_Name;
            flmRequiredExtention.FacilityInfo.FacilityName = new UserTextType();
            flmRequiredExtention.FacilityInfo.FacilityName.Value = facilityInfo.Site_Name;

            #endregion

            #region Build the SecureDeviceList element
            flmRequiredExtention.SecurityDeviceList = new SecurityDeviceListType();

            ArrayList secureDeviceCombinedTypeArray = new ArrayList();

            flm_GetFacilitySecureEquipmentResult currentDevice = null;
            X509Certificate2 deviceCertificate = null;
            ArrayList versionInformation = null;
            foreach (flm_GetFacilitySecureEquipmentResult secureDevice in secureDeviceArray)
            {
                if ((null != currentDevice) && (currentDevice.Equipment_Id == secureDevice.Equipment_Id)) // It still the same device (get next version element)
                {
                    AddInfoType(versionInformation, secureDevice);
                    currentDevice = secureDevice;
                    continue;
                }
                else // the next device in the list
                {
                    #region Add the last completed device to the array
                    if ((null != currentDevice) && (null != deviceCertificate))
                    {
                        CombinedType securityDevice = BuildSecurityDeviceCombinedType(currentDevice, versionInformation, deviceCertificate);
                        secureDeviceCombinedTypeArray.Add(securityDevice);
                    }
                    #endregion

                    currentDevice = null;
                    deviceCertificate = null;
                    versionInformation = null;

                    #region Get the serial number of the next device. Skip this device if we cannot get the serial number
                    if ((null == secureDevice.Serial_Number) || (secureDevice.Serial_Number.Length < 1))
                    {
                        continue;
                    }
                    #endregion

                    #region Get the certificate of the next device. Skip this device if we cannot get the certificate
                    string deviceCertificateChainString = secureDevice.Cert_String;
                    if (null == deviceCertificateChainString)
                    {
                        continue;
                    }

                    int certificateCount = X509Certificate_ClassLibrary.X509CertificateClassLibrary.GetBeginCertificateCount(deviceCertificateChainString);
                    if (certificateCount < 1)
                    {
                        continue;
                    }

                    string deviceCertificateString = X509Certificate_ClassLibrary.X509CertificateClassLibrary.GetBeginCertificate(0, deviceCertificateChainString);
                    if (null == deviceCertificateString)
                    {
                        continue;
                    }

                    deviceCertificate = X509Certificate_ClassLibrary.X509CertificateClassLibrary.BuildCertificate(deviceCertificateString);
                    if (null == deviceCertificate)
                    {
                        currentDevice = null;
                        continue;
                    }
                    #endregion

                    currentDevice = secureDevice;
                    versionInformation = new ArrayList();

                    AddInfoType(versionInformation, secureDevice);
                }
            }
            #endregion

            #region Add the Secure Device List to the Required Extention
            flmRequiredExtention.SecurityDeviceList.Items = new CombinedType[secureDeviceCombinedTypeArray.Count];
            int index = 0;
            foreach (CombinedType device in secureDeviceCombinedTypeArray)
            {
                flmRequiredExtention.SecurityDeviceList.Items[index] = device;
                index++;
            }
            #endregion

            return flmRequiredExtention;
        }
Example #3
0
        static FLMRequiredExtensionsType BuildFlmRequiredExtention(X509Certificate2 x509Certificate2)
        {
            FLMRequiredExtensionsType flmRequiredExtention = new FLMRequiredExtensionsType();

            flmRequiredExtention.FacilityInfo = new FLMRequiredExtensionsTypeFacilityInfo();
            flmRequiredExtention.FacilityInfo.AnnotationText = new UserTextType();
            flmRequiredExtention.FacilityInfo.AnnotationText.language = "en-us";
            flmRequiredExtention.FacilityInfo.AnnotationText.Value = "Example Facility List Message";
            flmRequiredExtention.FacilityInfo.FacilityName = new UserTextType();
            flmRequiredExtention.FacilityInfo.FacilityName.Value = "urn:x-facilityID:dcipllc.com:000000";
            flmRequiredExtention.FacilityInfo.UTCOffset = new UTCOffsetType();
            flmRequiredExtention.FacilityInfo.UTCOffset.Offset = "-05:00";

            flmRequiredExtention.SecurityDeviceList = new SecurityDeviceListType();

            CombinedType securityDevice = new CombinedType();

            securityDevice.KeyInfo = new KeyInfoType();
            securityDevice.KeyInfo.ItemsElementName = new ItemsChoiceType3[2];
            securityDevice.KeyInfo.ItemsElementName[0] = ItemsChoiceType3.KeyName;
            securityDevice.KeyInfo.ItemsElementName[1] = ItemsChoiceType3.X509Data;
            securityDevice.KeyInfo.Items = new object[2];
            securityDevice.KeyInfo.Items[0] = x509Certificate2.IssuerName.Name;

            X509DataType x509Data = new X509DataType();
            x509Data.ItemsElementName = new ItemsChoiceType1[1];
            x509Data.ItemsElementName[0] = ItemsChoiceType1.X509Certificate;
            x509Data.Items = new object[1];
            x509Data.Items[0] = x509Certificate2.RawData;

            securityDevice.KeyInfo.Items[1] = x509Data;

            securityDevice.DeviceDescription = new deviceDescriptionType();
            securityDevice.DeviceDescription.DeviceIdentifier = new deviceIdentifierPolyType();
            securityDevice.DeviceDescription.DeviceIdentifier.idtype = new deviceIdentifierPolyTypeIdtype();
            securityDevice.DeviceDescription.DeviceIdentifier.idtype = deviceIdentifierPolyTypeIdtype.DeviceUID;
            securityDevice.DeviceDescription.DeviceIdentifier.Value = "urn:uid:" + Guid.Empty;
            securityDevice.DeviceDescription.DeviceTypeID = new deviceTypeType();
            securityDevice.DeviceDescription.DeviceTypeID.scope = "http://www.dcipllc.com/schemas/430-7/2009/FLM#deviceTypes";
            securityDevice.DeviceDescription.DeviceTypeID.Value = "SMS";
            securityDevice.DeviceDescription.DeviceSerial = "000000";
            securityDevice.DeviceDescription.ManufacturerName = "Doremi";
            securityDevice.DeviceDescription.ModelNumber = "DCP0000";
            securityDevice.DeviceDescription.DeviceComment = new UserTextType();
            securityDevice.DeviceDescription.DeviceComment.Value = "Not a Real Device";

            flmRequiredExtention.SecurityDeviceList.Items = new CertOnlyType[1];
            flmRequiredExtention.SecurityDeviceList.Items[0] = securityDevice;

            return flmRequiredExtention;
        }
        private static DCinemaSecurityMessageType AppendFLMRequiredExtension(DCinemaSecurityMessageType extraTheatreMessage, FLMRequiredExtensionsType flmRequiredExtention)
        {
            DCinemaSecurityMessageType facilityListMessage = extraTheatreMessage;

            StringWriter stringWriter = new StringWriter();
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(FLMRequiredExtensionsType));
            xmlSerializer.Serialize(stringWriter, flmRequiredExtention);
            string serializedXML = stringWriter.ToString();
            XmlDocument docFlmRequiredExtention = new XmlDocument();
            docFlmRequiredExtention.LoadXml(serializedXML);

            facilityListMessage.AuthenticatedPublic.RequiredExtensions = docFlmRequiredExtention.DocumentElement;

            return facilityListMessage;
        }