elimde bir binding dosyası var ve bu .net'in 4.7.2. sürümünde çalışır vaziyette yapılmış fakat ben .net 8.0 ve sonrasında çalışabilecek bir kod istiyorum. 

bu kodun .net 8.0 da çalışabilir halini tekrar yaz. 

using System;
using System.ServiceModel;
using System.Security.Cryptography;
using System.Text;
using System.IdentityModel.Tokens;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.Xml.Linq;

namespace osym3
{
    public class OSYMBinding : CustomBinding
    {
        public OSYMBinding()
        {
            var security = TransportSecurityBindingElement.CreateUserNameOverTransportBindingElement();
            security.IncludeTimestamp = false;
            security.DefaultAlgorithmSuite = SecurityAlgorithmSuite.Basic256;
            security.MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10;
            security.EnableUnsecuredResponse = true;

            var encoding = new TextMessageEncodingBindingElement();
            encoding.MessageVersion = MessageVersion.Soap11;

            var transport = new HttpsTransportBindingElement();
            transport.MaxReceivedMessageSize = 2000000;

            Elements.Add(security);
            Elements.Add(encoding);
            Elements.Add(transport);
        }
    }

    public class OSYMCredentials : ClientCredentials
    {
        public OSYMCredentials() { }
        protected OSYMCredentials(OSYMCredentials cc) : base(cc) { }
        public override System.IdentityModel.Selectors.SecurityTokenManager CreateSecurityTokenManager()
        {
            return new OSYMSecurityTokenManager(this);
        }
        protected override ClientCredentials CloneCore()
        {
            return new OSYMCredentials(this);
        }
    }

    public class OSYMSecurityTokenManager : ClientCredentialsSecurityTokenManager
    {
        public OSYMSecurityTokenManager(OSYMCredentials cred) : base(cred) { }
        public override System.IdentityModel.Selectors.SecurityTokenSerializer CreateSecurityTokenSerializer(System.IdentityModel.Selectors.SecurityTokenVersion version)
        {
            return new OSYMTokenSerializer(SecurityVersion.WSSecurity10);
        }
    }

    public class OSYMTokenSerializer : WSSecurityTokenSerializer
    {
        public OSYMTokenSerializer(SecurityVersion sv) : base(sv) { }

        protected override void WriteTokenCore(System.Xml.XmlWriter writer, SecurityToken token)
        {
            UserNameSecurityToken userToken = token as UserNameSecurityToken;
            string created = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
            byte[] nonce = GetNonce();
            string tokennamespace = "o";
            string stringToWrite = string.Format(@"<{0}:UsernameToken u:Id=""{1}"" xmlns:u=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
 <{0}:Username>{2}</{0}:Username>
 <{0}:Password Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"">{3}</{0}:Password>
 <{0}:Nonce EncodingType = ""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"">{4}</{0}:Nonce>
 <u:Created>{5}</u:Created>
 </{0}:UsernameToken>",
                tokennamespace,
                token.Id,
                userToken.UserName,
                CreateDigest(nonce, created, userToken.Password),
                Convert.ToBase64String(nonce),
                created);

            writer.WriteRaw(stringToWrite);
        }

        internal static string CreateDigest(byte[] nonce, string created, string password)
        {
            byte[] createdBytes = Encoding.UTF8.GetBytes(created);
            byte[] passwordBytes = Encoding.UTF8.GetBytes(password);
            byte[] combined = new byte[createdBytes.Length + nonce.Length + passwordBytes.Length];
            Buffer.BlockCopy(nonce, 0, combined, 0, nonce.Length);
            Buffer.BlockCopy(createdBytes, 0, combined, nonce.Length, createdBytes.Length);
            Buffer.BlockCopy(passwordBytes, 0, combined, nonce.Length + createdBytes.Length, passwordBytes.Length);
            return Convert.ToBase64String(SHA1.Create().ComputeHash(combined));
        }

        internal static byte[] GetNonce()
        {
            byte[] nonce = new byte[0x10];
            RandomNumberGenerator generator = new RNGCryptoServiceProvider();
            generator.GetBytes(nonce);
            return nonce;
        }
    }
}