<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />

Org.BouncyCastle.Crypto.Agreement.JPake.JPakeUtilities

public abstract class JPakeUtilities
Primitives needed for a J-PAKE exchange. The recommended way to perform a J-PAKE exchange is by using two JPAKEParticipants. Internally, those participants call these primitive operations in JPakeUtilities. The primitives, however, can be used without a JPAKEParticipant if needed.
namespace Org.BouncyCastle.Crypto.Agreement.JPake { public abstract class JPakeUtilities { public static readonly BigInteger Zero; public static readonly BigInteger One; public static BigInteger GenerateX1(BigInteger q, SecureRandom random); public static BigInteger GenerateX2(BigInteger q, SecureRandom random); public static BigInteger CalculateS(char[] password); public static BigInteger CalculateS(BigInteger q, byte[] password); public static BigInteger CalculateS(BigInteger q, char[] password); public static BigInteger CalculateS(BigInteger q, ReadOnlySpan<char> password); public static BigInteger CalculateGx(BigInteger p, BigInteger g, BigInteger x); public static BigInteger CalculateGA(BigInteger p, BigInteger gx1, BigInteger gx3, BigInteger gx4); public static BigInteger CalculateX2s(BigInteger q, BigInteger x2, BigInteger s); public static BigInteger CalculateA(BigInteger p, BigInteger q, BigInteger gA, BigInteger x2s); public static BigInteger[] CalculateZeroKnowledgeProof(BigInteger p, BigInteger q, BigInteger g, BigInteger gx, BigInteger x, string participantId, IDigest digest, SecureRandom random); public static void ValidateGx4(BigInteger gx4); public static void ValidateGa(BigInteger ga); public static void ValidateZeroKnowledgeProof(BigInteger p, BigInteger q, BigInteger g, BigInteger gx, BigInteger[] zeroKnowledgeProof, string participantId, IDigest digest); public static BigInteger CalculateKeyingMaterial(BigInteger p, BigInteger q, BigInteger gx4, BigInteger x2, BigInteger s, BigInteger B); public static void ValidateParticipantIdsDiffer(string participantId1, string participantId2); public static void ValidateParticipantIdsEqual(string expectedParticipantId, string actualParticipantId); public static void ValidateNotNull(object obj, string description); public static BigInteger CalculateMacTag(string participantId, string partnerParticipantId, BigInteger gx1, BigInteger gx2, BigInteger gx3, BigInteger gx4, BigInteger keyingMaterial, IDigest digest); public static void ValidateMacTag(string participantId, string partnerParticipantId, BigInteger gx1, BigInteger gx2, BigInteger gx3, BigInteger gx4, BigInteger keyingMaterial, IDigest digest, BigInteger partnerMacTag); protected JPakeUtilities(); } }