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
- BaseComponentEditor.cs
- RNGCryptoServiceProvider.cs
- ProcessRequestArgs.cs
- SafeEventLogWriteHandle.cs
- RemoteDebugger.cs
- DataServiceHost.cs
- ObjectToken.cs
- OrderedDictionaryStateHelper.cs
- HttpValueCollection.cs
- BoolExpression.cs
- RawTextInputReport.cs
- ResourceDictionary.cs
- ListViewTableRow.cs
- Selection.cs
- UrlMappingCollection.cs
- EdgeModeValidation.cs
- altserialization.cs
- coordinatorfactory.cs
- FormatterConverter.cs
- ConnectionProviderAttribute.cs
- ToolTipService.cs
- DateTime.cs
- XPathSingletonIterator.cs
- SqlPersonalizationProvider.cs
- XPathNodeIterator.cs
- TailCallAnalyzer.cs
- X509Certificate2Collection.cs
- StringSorter.cs
- ObjectQueryExecutionPlan.cs
- Control.cs
- ObjectCloneHelper.cs
- AnnotationComponentChooser.cs
- BasicViewGenerator.cs
- StrongNameIdentityPermission.cs
- RenderContext.cs
- TypeDescriptionProvider.cs
- ValidatorCompatibilityHelper.cs
- SelectionWordBreaker.cs
- SQLInt64.cs
- GradientStopCollection.cs
- EventLogPermissionEntry.cs
- IntSecurity.cs
- DynamicDataResources.Designer.cs
- documentation.cs
- TickBar.cs
- DefaultClaimSet.cs
- SQLBinary.cs
- Sequence.cs
- CodeIdentifiers.cs
- Schema.cs
- DataPointer.cs
- ModuleBuilderData.cs
- MsdtcClusterUtils.cs
- WindowsFormsDesignerOptionService.cs
- TdsParserStaticMethods.cs
- ToolZone.cs
- Point.cs
- StreamUpgradeInitiator.cs
- MethodToken.cs
- XmlAggregates.cs
- AutomationEvent.cs
- ManualResetEventSlim.cs
- PathFigureCollection.cs
- PeerObject.cs
- WebBaseEventKeyComparer.cs
- AstTree.cs
- uribuilder.cs
- CodeTypeReference.cs
- PathGeometry.cs
- EmptyCollection.cs
- Misc.cs
- ViewCellSlot.cs
- WebMessageBodyStyleHelper.cs
- ChangePassword.cs
- DataGridCommandEventArgs.cs
- TextTreeExtractElementUndoUnit.cs
- EdmSchemaAttribute.cs
- XmlCharCheckingWriter.cs
- RunInstallerAttribute.cs
- LassoSelectionBehavior.cs
- SQLDouble.cs
- PropertyPath.cs
- PeerCollaboration.cs
- PropertyInformation.cs
- _BufferOffsetSize.cs
- SendOperation.cs
- QilReference.cs
- ArgumentValueSerializer.cs
- FontDifferentiator.cs
- EncoderBestFitFallback.cs
- ImageMap.cs
- XmlIlVisitor.cs
- NamespaceCollection.cs
- XmlSchemaGroupRef.cs
- MembershipUser.cs
- Events.cs
- DockPattern.cs
- ServiceMetadataPublishingElement.cs
- GridToolTip.cs
- PostBackOptions.cs