- Initial commit
This commit is contained in:
44
Runtime/3rdParty/BouncyCastle/crypto/parameters/SM2KeyExchangePublicParameters.cs
vendored
Normal file
44
Runtime/3rdParty/BouncyCastle/crypto/parameters/SM2KeyExchangePublicParameters.cs
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
|
||||
{
|
||||
/// <summary>Public parameters for an SM2 key exchange.</summary>
|
||||
/// <remarks>In this case the ephemeralPublicKey provides the random point used in the algorithm.</remarks>
|
||||
public class SM2KeyExchangePublicParameters
|
||||
: ICipherParameters
|
||||
{
|
||||
private readonly ECPublicKeyParameters mStaticPublicKey;
|
||||
private readonly ECPublicKeyParameters mEphemeralPublicKey;
|
||||
|
||||
public SM2KeyExchangePublicParameters(
|
||||
ECPublicKeyParameters staticPublicKey,
|
||||
ECPublicKeyParameters ephemeralPublicKey)
|
||||
{
|
||||
if (staticPublicKey == null)
|
||||
throw new ArgumentNullException("staticPublicKey");
|
||||
if (ephemeralPublicKey == null)
|
||||
throw new ArgumentNullException("ephemeralPublicKey");
|
||||
if (!staticPublicKey.Parameters.Equals(ephemeralPublicKey.Parameters))
|
||||
throw new ArgumentException("Static and ephemeral public keys have different domain parameters");
|
||||
|
||||
this.mStaticPublicKey = staticPublicKey;
|
||||
this.mEphemeralPublicKey = ephemeralPublicKey;
|
||||
}
|
||||
|
||||
public virtual ECPublicKeyParameters StaticPublicKey
|
||||
{
|
||||
get { return mStaticPublicKey; }
|
||||
}
|
||||
|
||||
public virtual ECPublicKeyParameters EphemeralPublicKey
|
||||
{
|
||||
get { return mEphemeralPublicKey; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user