//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOAuth.ChannelElements { using System; using System.Collections.Generic; using System.Linq; using System.Text; using DotNetOAuth.Messaging; using DotNetOAuth.Messaging.Bindings; /// /// A binding element that signs outgoing messages and verifies the signature on incoming messages. /// internal class PlainTextSigningBindingElement : SigningBindingElementBase { /// /// Initializes a new instance of the class. /// internal PlainTextSigningBindingElement() : base("PLAINTEXT") { } /// /// Calculates a signature for a given message. /// /// The message to sign. /// The signature for the message. /// /// This method signs the message according to OAuth 1.0 section 9.4.1. /// protected override string GetSignature(ITamperResistantOAuthMessage message) { StringBuilder builder = new StringBuilder(); builder.Append(Uri.EscapeDataString(message.ConsumerSecret)); builder.Append("&"); builder.Append(Uri.EscapeDataString(message.TokenSecret)); return Uri.EscapeDataString(builder.ToString()); } } }