@@ -611,6 +611,8 @@ public PubArea(byte[] pubArea)
611
611
Exponent = Convert . ToUInt32 ( Math . Pow ( 2 , 16 ) + 1 ) ;
612
612
}
613
613
}
614
+ // TPM2B_PUBLIC_KEY_RSA
615
+ Unique = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset ) ;
614
616
}
615
617
616
618
// TPMI_ECC_CURVE
@@ -625,10 +627,15 @@ public PubArea(byte[] pubArea)
625
627
{
626
628
CurveID = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset , 2 ) ;
627
629
KDF = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset , 2 ) ;
628
- }
629
630
630
- // TPMU_PUBLIC_ID
631
- Unique = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset ) ;
631
+ // TPMS_ECC_POINT
632
+ ECPoint = new ( )
633
+ {
634
+ X = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset ) ,
635
+ Y = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset ) ,
636
+ } ;
637
+ Unique = DataHelper . Concat ( ECPoint . X , ECPoint . Y ) ;
638
+ }
632
639
633
640
if ( pubArea . Length != offset )
634
641
throw new Fido2VerificationException ( "Leftover bytes decoding pubArea" ) ;
@@ -645,21 +652,8 @@ public PubArea(byte[] pubArea)
645
652
public uint Exponent { get ; private set ; }
646
653
public byte [ ] ? CurveID { get ; private set ; }
647
654
public byte [ ] ? KDF { get ; private set ; }
648
- public byte [ ] Unique { get ; private set ; }
655
+ public byte [ ] ? Unique { get ; private set ; }
649
656
public TpmEccCurve EccCurve => ( TpmEccCurve ) Enum . ToObject ( typeof ( TpmEccCurve ) , BinaryPrimitives . ReadUInt16BigEndian ( CurveID ) ) ;
650
-
651
- public ECPoint ECPoint
652
- {
653
- get
654
- {
655
- var point = new ECPoint ( ) ;
656
- var uniqueOffset = 0 ;
657
- var size = AuthDataHelper . GetSizedByteArray ( Unique , ref uniqueOffset , 2 ) ;
658
- point . X = AuthDataHelper . GetSizedByteArray ( Unique , ref uniqueOffset , BinaryPrimitives . ReadUInt16BigEndian ( size ) ) ;
659
- size = AuthDataHelper . GetSizedByteArray ( Unique , ref uniqueOffset , 2 ) ;
660
- point . Y = AuthDataHelper . GetSizedByteArray ( Unique , ref uniqueOffset , BinaryPrimitives . ReadUInt16BigEndian ( size ) ) ;
661
- return point ;
662
- }
663
- }
657
+ public ECPoint ECPoint { get ; private set ; }
664
658
}
665
659
}
0 commit comments