Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / X509Logo.cs / 1 / X509Logo.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.IO; using System.Text; using System.Diagnostics; using System.Collections.Generic; using System.Security.Cryptography; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; // // Summary: // There are 4 different logo types supported by the RFC. // Remarks: // Examples are // Community: Visa or MasterCard. // Issuer: Versign, Thawte // Subject: etrade.com, ebay.com // Other: no idea // internal enum X509LogoType : byte { Community = 0xa0, Issuer = 0xa1, Subject = 0xa2, Other = 0xa3 } // // Summary: // Graphical and auditory logos are supported // internal enum X509LogoDataType { Image, Audio }; // // Summary: // This is the base logo class. It contains the common properties between image // and audio logos. Including type, location and hash information // abstract class X509Logo { X509LogoType m_logoType; // Issuer, Subject, ... string m_mediaType; // mime-type image/gif, image/jpeg Dictionarym_fileHashes; // Multiple hashes are supported. List m_fileLocations; // Multiple file locations are supported. // // Reference file location and hash are not supported in this release. // // string m_referenceFileLocation; // Location of LogoTypeDataFile // byte[] m_referenceFileHash; // Hash of reference file public X509LogoType LogoType { get { return m_logoType; } } public string MediaType { get { return m_mediaType; } } public Dictionary Hashes { get { return m_fileHashes; } } public List FileLocations { get { return m_fileLocations; } } // // Summary: // Constructs a new X509Logo // // Parameters: // logoType - The pid of the calling client process. // mediaType - Format of logo file // hashes - Map of hash algorithm oid to the bytes of the hash. // fileLocations - List of the file locations where the logo can be found. // public X509Logo( X509LogoType logoType, string mediaType, Dictionary hashes, List fileLocations ) { m_logoType = logoType; m_mediaType = mediaType; m_fileHashes = hashes; m_fileLocations = fileLocations; } // // Summary: // Constructs a string representing the logo in the following format: // // 30 5f a1 5d a0 5b 30 59 0_�]�[0Y // 30 57 30 55 16 09 69 6d 0W0U..im // 61 67 65 2f 67 69 66 30 age/gif0 // 21 30 1f 30 07 06 05 2b !0.0.... // 0e 03 02 1a 04 14 8f e5 .......� // d3 1a 86 ac 8d 8e 6b c3 O.....kA // cf 80 6a d4 48 18 2c 7b I.jOH.,{ // 19 2e 30 25 16 23 68 74 ..0%.#ht // 74 70 3a 2f 2f 6c 6f 67 tp://log // 6f 2e 76 65 72 69 73 69 o.verisi // 67 6e 2e 63 6f 6d 2f 76 gn.com/v // 73 6c 6f 67 6f 2e 67 69 slogo.gi // 66 f // // LogoType: Issuer // MediaType: image/gif // Location(s): http://logo.verisign.com/vslogo.gif // // Hash(es) // // Name: sha1 // Oid: 1.3.14.3.2.26 // Bytes: // 8f e5 d3 1a 86 ac 8d 8e .�O..... // 6b c3 cf 80 6a d4 48 18 kAI.jOH. // 2c 7b 19 2e ,{.. // public override string ToString() { #if DEBUG StringBuilder sb = new StringBuilder(); sb.AppendFormat( "LogoType:\t{0}\n", LogoType.ToString() ); sb.AppendFormat( "MediaType:\t{0}\n", MediaType ); sb.Append( "Location(s):" ); if( 1 == FileLocations.Count ) { sb.AppendFormat( "\t{0}\n", FileLocations[ 0 ] ); } else { sb.Append( "\n" ); foreach( string s in FileLocations ) { sb.AppendFormat( "{0}\n", s ); } } sb.Append( "\nHash(es)\n" ); foreach( Oid oid in Hashes.Keys ) { sb.AppendFormat( "\nName:\t{0}\nOid:\t{1}\nBytes:\n{2}\n", oid.FriendlyName, oid.Value, Asn1Utilities.ToHexDump( Hashes[ oid ] ) ); } return sb.ToString(); #else return base.ToString(); #endif } protected virtual void OnSerialize( BinaryWriter writer ) { } public void Serialize( BinaryWriter writer ) { writer.Write( (byte)LogoType ); Utility.SerializeString( writer, MediaType ); // // Write the count of hashes. // writer.Write( Hashes.Count ); // // Write each hash. // foreach( Oid hashAlg in Hashes.Keys ) { Utility.SerializeString( writer, hashAlg.Value ); Utility.SerializeBytes( writer, m_fileHashes[ hashAlg ] ); } // // Write the count of file locations. // writer.Write( FileLocations.Count ); // // Write each location. // foreach( string location in FileLocations ) { Utility.SerializeString( writer, location ); } OnSerialize( writer ); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableParaClient.cs
- StringCollectionEditor.cs
- XmlComment.cs
- InternalBufferOverflowException.cs
- EncodingInfo.cs
- FilterQueryOptionExpression.cs
- RegexGroupCollection.cs
- ColumnWidthChangedEvent.cs
- ISFClipboardData.cs
- BidOverLoads.cs
- DataServiceQueryOfT.cs
- EllipseGeometry.cs
- XpsFilter.cs
- DtrList.cs
- ButtonStandardAdapter.cs
- EmbeddedMailObject.cs
- OciLobLocator.cs
- GridProviderWrapper.cs
- CommandEventArgs.cs
- ExceptionList.cs
- XmlChildNodes.cs
- XmlExpressionDumper.cs
- SingleTagSectionHandler.cs
- WebBrowserNavigatedEventHandler.cs
- DrawingVisual.cs
- UInt16Converter.cs
- XmlTextEncoder.cs
- SchemaElement.cs
- SafeHandles.cs
- DataRecordInternal.cs
- PropertyDescriptor.cs
- TabRenderer.cs
- SqlDataSourceFilteringEventArgs.cs
- LinearGradientBrush.cs
- LayoutTable.cs
- ScopedKnownTypes.cs
- Matrix.cs
- ComponentEditorPage.cs
- FileSecurity.cs
- ImportCatalogPart.cs
- SoapIncludeAttribute.cs
- TextEditorCharacters.cs
- DynamicAttribute.cs
- unsafeIndexingFilterStream.cs
- PrintController.cs
- Quaternion.cs
- SchemaSetCompiler.cs
- TriggerAction.cs
- RuntimeWrappedException.cs
- DelegateTypeInfo.cs
- WeakReference.cs
- PropertyFilterAttribute.cs
- CodeVariableReferenceExpression.cs
- returneventsaver.cs
- Decimal.cs
- Stylesheet.cs
- CodeDomConfigurationHandler.cs
- ActivityDesigner.cs
- TextInfo.cs
- TagNameToTypeMapper.cs
- GlyphCache.cs
- IndexingContentUnit.cs
- ClientClassGenerator.cs
- ImagingCache.cs
- DataGridViewRowsRemovedEventArgs.cs
- HopperCache.cs
- SolidColorBrush.cs
- PopupRootAutomationPeer.cs
- ToolBarTray.cs
- ScriptResourceAttribute.cs
- DefaultProxySection.cs
- OleCmdHelper.cs
- EmptyImpersonationContext.cs
- PenLineCapValidation.cs
- DecoratedNameAttribute.cs
- PrintPageEvent.cs
- AuthenticationException.cs
- ToolStripTextBox.cs
- Helpers.cs
- RtType.cs
- RegexTree.cs
- RegexCaptureCollection.cs
- MD5.cs
- FileDialogCustomPlaces.cs
- TextBoxBase.cs
- XappLauncher.cs
- TextOptionsInternal.cs
- StorageScalarPropertyMapping.cs
- basevalidator.cs
- RoleServiceManager.cs
- StorageBasedPackageProperties.cs
- GetPageNumberCompletedEventArgs.cs
- TextEndOfSegment.cs
- CodeTypeMemberCollection.cs
- TextChange.cs
- PartitionResolver.cs
- LayoutManager.cs
- XmlMapping.cs
- EventLogTraceListener.cs
- HitTestParameters.cs