summary refs log tree commit diff
path: root/crypto/src/asn1/x9/X9ECParametersHolder.cs
blob: ea72cc6ac1c50e38147b57983e68e542072b10d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Org.BouncyCastle.Math.EC;

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

        public ECCurve Curve
        {
            get
            {
                lock (this)
                {
                    if (m_curve == null)
                    {
                        m_curve = CreateCurve();
                    }

                    return m_curve;
                }
            }
        }

        public X9ECParameters Parameters
		{
			get
			{
                lock (this)
                {
                    if (m_parameters == null)
                    {
                        m_parameters = CreateParameters();
                    }

                    return m_parameters;
                }
            }
        }

        protected virtual ECCurve CreateCurve()
        {
            return CreateParameters().Curve;
        }

        protected abstract X9ECParameters CreateParameters();
	}
}