internal ECKey(ISystemClock clock, ICKBinaryReader r)
            : base(clock, r)
        {
            r.ReadByte();
            Oid?curveName = HelperAndExtensions.ReadNullableOid(r);

            Debug.Assert(curveName != null);
            _parameters = new ECParameters()
            {
                Curve = ECCurve.CreateFromOid(curveName),
                D     = ReadBytes(r),
                Q     = new ECPoint()
                {
                    X = ReadBytes(r), Y = ReadBytes(r)
                }
            };
            if (r.ReadBoolean())
            {
                _ecdh = ECDiffieHellman.Create(_parameters);
            }
            else
            {
                _ec = ECDsa.Create(_parameters);
            }
            JWKCurveName = GetJWKCurveName(_parameters.Curve.Oid);
示例#2
0
 public KeyRequirement(ICKBinaryReader r)
 {
     r.ReadByte(); // Version.
     KeyType       = r.ReadEnum <KeyType>();
     Operations    = r.ReadEnum <KeyOperations>();
     KeySizeInBits = r.ReadNullableInt32(  );
     CurveName     = HelperAndExtensions.ReadNullableOid(r);
     if (r.ReadBoolean())
     {
         InitiatorAlgorithmName = r.ReadString();
     }
 }