本文整理汇总了C#中System.IdentityModel.DictionaryManager类的典型用法代码示例。如果您正苦于以下问题:C# DictionaryManager类的具体用法?C# DictionaryManager怎么用?C# DictionaryManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DictionaryManager类属于System.IdentityModel命名空间,在下文中一共展示了DictionaryManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateDictionary
// Interface to plug in external Dictionaries. The external
// dictionary should already be populated with all strings
// required by this assembly.
public void PopulateDictionary(IXmlDictionary dictionary)
{
if (dictionary == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dictionary");
this.dictionaryManager = new DictionaryManager(dictionary);
}
示例2: Process
public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager)
{
XmlTokenStream tokenStream = input as XmlTokenStream;
if (tokenStream != null)
{
tokenStream.SetElementExclusion(XmlSignatureStrings.Signature, XmlSignatureStrings.Namespace);
return tokenStream;
}
WrappedReader reader = input as WrappedReader;
if ( reader != null )
{
// The Enveloped Signature Transform is supposed to remove the
// Signature which encloses the transform element. Previous versions
// of this code stripped out all Signature elements at any depth,
// which did not allow nested signed structures. By specifying '1'
// as the depth, we narrow our range of support so that we require
// that the enveloped signature be a direct child of the element
// being signed.
reader.XmlTokens.SetElementExclusion( XmlSignatureConstants.Elements.Signature, XmlSignatureConstants.Namespace, 1 );
return reader;
}
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.GetString(SR.UnsupportedInputTypeForTransform, input.GetType())));
}
示例3: KeyInfoSerializer
public KeyInfoSerializer(
bool emitBspRequiredAttributes,
DictionaryManager dictionaryManager,
TrustDictionary trustDictionary,
SecurityTokenSerializer innerSecurityTokenSerializer ) :
this( emitBspRequiredAttributes, dictionaryManager, trustDictionary, innerSecurityTokenSerializer, null )
{
}
示例4: ReadFrom
public override void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager)
{
reader.MoveToContent();
if (XmlHelper.ReadEmptyElementAndRequiredAttribute(reader, dictionaryManager.XmlSignatureDictionary.Transform, dictionaryManager.XmlSignatureDictionary.Namespace, dictionaryManager.XmlSignatureDictionary.Algorithm, out this.prefix) != this.Algorithm)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CryptographicException(System.IdentityModel.SR.GetString("AlgorithmMismatchForTransform")));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:EnvelopedSignatureTransform.cs
示例5: TransformToDigest
public byte[] TransformToDigest(object data, SignatureResourcePool resourcePool, string digestMethod, DictionaryManager dictionaryManager)
{
for (int i = 0; i < (this.TransformCount - 1); i++)
{
data = this[i].Process(data, resourcePool, dictionaryManager);
}
return this[this.TransformCount - 1].ProcessAndDigest(data, resourcePool, digestMethod, dictionaryManager);
}
示例6: WriteTo
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Transforms, dictionaryManager.XmlSignatureDictionary.Namespace);
for (int i = 0; i < this.TransformCount; i++)
{
this[i].WriteTo(writer, dictionaryManager);
}
writer.WriteEndElement();
}
示例7: PreDigestedSignedInfo
public PreDigestedSignedInfo(DictionaryManager dictionaryManager, string canonicalizationMethod, XmlDictionaryString canonicalizationMethodDictionaryString, string digestMethod, XmlDictionaryString digestMethodDictionaryString, string signatureMethod, XmlDictionaryString signatureMethodDictionaryString) : base(dictionaryManager)
{
this.references = new ReferenceEntry[8];
base.CanonicalizationMethod = canonicalizationMethod;
base.CanonicalizationMethodDictionaryString = canonicalizationMethodDictionaryString;
this.DigestMethod = digestMethod;
this.digestMethodDictionaryString = digestMethodDictionaryString;
base.SignatureMethod = signatureMethod;
base.SignatureMethodDictionaryString = signatureMethodDictionaryString;
}
示例8: Process
public override object Process(object input, SignatureResourcePool resourcePool, DictionaryManager dictionaryManager)
{
XmlTokenStream stream = input as XmlTokenStream;
if (stream == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.IdentityModel.SR.GetString("UnsupportedInputTypeForTransform", new object[] { input.GetType() })));
}
stream.SetElementExclusion("Signature", "http://www.w3.org/2000/09/xmldsig#");
return stream;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:EnvelopedSignatureTransform.cs
示例9: WriteTo
public override void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
string prefix = "";
XmlDictionaryString namespaceUri = dictionaryManager.XmlSignatureDictionary.Namespace;
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.SignedInfo, namespaceUri);
if (base.Id != null)
{
writer.WriteAttributeString(dictionaryManager.UtilityDictionary.IdAttribute, null, base.Id);
}
base.WriteCanonicalizationMethod(writer, dictionaryManager);
base.WriteSignatureMethod(writer, dictionaryManager);
for (int i = 0; i < this.count; i++)
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Reference, namespaceUri);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.URI, null);
writer.WriteString("#");
writer.WriteString(this.references[i].id);
writer.WriteEndAttribute();
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transforms, namespaceUri);
if (this.addEnvelopedSignatureTransform)
{
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, namespaceUri);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(dictionaryManager.XmlSignatureDictionary.EnvelopedSignature);
writer.WriteEndAttribute();
writer.WriteEndElement();
}
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.Transform, namespaceUri);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
writer.WriteString(dictionaryManager.SecurityAlgorithmDictionary.ExclusiveC14n);
writer.WriteEndAttribute();
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestMethod, namespaceUri);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (this.digestMethodDictionaryString != null)
{
writer.WriteString(this.digestMethodDictionaryString);
}
else
{
writer.WriteString(this.digestMethod);
}
writer.WriteEndAttribute();
writer.WriteEndElement();
byte[] digest = this.references[i].digest;
writer.WriteStartElement(prefix, dictionaryManager.XmlSignatureDictionary.DigestValue, namespaceUri);
writer.WriteBase64(digest, 0, digest.Length);
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
示例10: EnvelopedSignatureWriter
/// <summary>
/// Initializes an instance of <see cref="EnvelopedSignatureWriter"/>. The returned writer can be directly used
/// to write the envelope. The signature will be automatically generated when
/// the envelope is completed.
/// </summary>
/// <param name="innerWriter">Writer to wrap/</param>
/// <param name="signingCredentials">SigningCredentials to be used to generate the signature.</param>
/// <param name="referenceId">The reference Id of the envelope.</param>
/// <param name="securityTokenSerializer">SecurityTokenSerializer to serialize the signature KeyInfo.</param>
/// <exception cref="ArgumentNullException">One of he input parameter is null.</exception>
/// <exception cref="ArgumentException">The string 'referenceId' is either null or empty.</exception>
public EnvelopedSignatureWriter(XmlWriter innerWriter, SigningCredentials signingCredentials, string referenceId, SecurityTokenSerializer securityTokenSerializer)
{
if (innerWriter == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("innerWriter");
}
if (signingCredentials == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("signingCredentials");
}
if (string.IsNullOrEmpty(referenceId))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.ID0006), "referenceId"));
}
if (securityTokenSerializer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("securityTokenSerializer");
}
// Remember the user's writer here. We need to finally write out the signed XML
// into this writer.
_dictionaryManager = new DictionaryManager();
_innerWriter = innerWriter;
_signingCreds = signingCredentials;
_referenceId = referenceId;
_tokenSerializer = securityTokenSerializer;
_signatureFragment = new MemoryStream();
_endFragment = new MemoryStream();
_writerStream = new MemoryStream();
XmlDictionaryWriter effectiveWriter = XmlDictionaryWriter.CreateTextWriter(_writerStream, Encoding.UTF8, false);
// Initialize the base writer to the newly created writer. The user should write the XML
// to this.
base.InitializeInnerWriter(effectiveWriter);
_hashAlgorithm = CryptoHelper.CreateHashAlgorithm(_signingCreds.DigestAlgorithm);
_hashStream = new HashStream(_hashAlgorithm);
base.InnerWriter.StartCanonicalization(_hashStream, false, null);
//
// Add tracing for the un-canonicalized bytes
//
if (DiagnosticUtility.ShouldTraceVerbose)
{
_preCanonicalTracingStream = new MemoryStream();
base.InitializeTracingWriter(new XmlTextWriter(_preCanonicalTracingStream, Encoding.UTF8));
}
}
示例11: WriteTo
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
if (this.DataReferenceCount == 0)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ReferenceListCannotBeEmpty")));
}
writer.WriteStartElement("e", ElementName, NamespaceUri);
for (int i = 0; i < this.DataReferenceCount; i++)
{
DataReference.WriteTo(writer, this.referredIds[i]);
}
writer.WriteEndElement();
}
示例12: Reference
public Reference(DictionaryManager dictionaryManager, string uri, object resolvedXmlSource)
{
this.digestValueElement = new DigestValueElement();
this.prefix = "";
this.transformChain = new System.IdentityModel.TransformChain();
if (dictionaryManager == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dictionaryManager");
}
this.dictionaryManager = dictionaryManager;
this.digestMethodElement = new ElementWithAlgorithmAttribute(dictionaryManager.XmlSignatureDictionary.DigestMethod);
this.uri = uri;
this.resolvedXmlSource = resolvedXmlSource;
}
示例13: ReadFrom
public void ReadFrom(XmlDictionaryReader reader, DictionaryManager dictionaryManager)
{
reader.MoveToStartElement(dictionaryManager.XmlSignatureDictionary.Signature, dictionaryManager.XmlSignatureDictionary.Namespace);
this.prefix = reader.Prefix;
this.Id = reader.GetAttribute(dictionaryManager.UtilityDictionary.IdAttribute, null);
reader.Read();
this.signedInfo.ReadFrom(reader, this.signedXml.TransformFactory, dictionaryManager);
this.signatureValueElement.ReadFrom(reader, dictionaryManager);
if (this.signedXml.SecurityTokenSerializer.CanReadKeyIdentifier(reader))
{
this.keyIdentifier = this.signedXml.SecurityTokenSerializer.ReadKeyIdentifier(reader);
}
reader.ReadEndElement();
}
示例14: WriteTo
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Signature, dictionaryManager.XmlSignatureDictionary.Namespace);
if (this.id != null)
{
writer.WriteAttributeString(dictionaryManager.UtilityDictionary.IdAttribute, null, this.id);
}
this.signedInfo.WriteTo(writer, dictionaryManager);
this.signatureValueElement.WriteTo(writer, dictionaryManager);
if (this.keyIdentifier != null)
{
this.signedXml.SecurityTokenSerializer.WriteKeyIdentifier(writer, this.keyIdentifier);
}
writer.WriteEndElement();
}
示例15: WriteTo
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager)
{
writer.WriteStartElement(this.prefix, this.elementName, dictionaryManager.XmlSignatureDictionary.Namespace);
writer.WriteStartAttribute(dictionaryManager.XmlSignatureDictionary.Algorithm, null);
if (this.algorithmDictionaryString != null)
{
writer.WriteString(this.algorithmDictionaryString);
}
else
{
writer.WriteString(this.algorithm);
}
writer.WriteEndAttribute();
writer.WriteEndElement();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:ElementWithAlgorithmAttribute.cs