summary refs log tree commit diff
path: root/crypto/src/asn1/x9/X9ECParametersHolder.cs
blob: 535dad9f7e7a4236da68a8bf653f3a9fce48ac7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using Org.BouncyCastle.Math.EC;
using Org.BouncyCastle.Utilities;

namespace Org.BouncyCastle.Asn1.X9
{
	public abstract class X9ECParametersHolder
	{
        private ECCurve m_curve;
        private X9ECParameters m_parameters;

        public ECCurve Curve => Objects.EnsureSingletonInitialized(ref m_curve, this, self => self.CreateCurve());

        public X9ECParameters Parameters =>
            Objects.EnsureSingletonInitialized(ref m_parameters, this, self => self.CreateParameters());

        protected virtual ECCurve CreateCurve() => Parameters.Curve;

        protected abstract X9ECParameters CreateParameters();
	}
}