@@ -611,6 +611,8 @@ public PubArea(byte[] pubArea)
611611 Exponent = Convert . ToUInt32 ( Math . Pow ( 2 , 16 ) + 1 ) ;
612612 }
613613 }
614+ // TPM2B_PUBLIC_KEY_RSA
615+ Unique = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset ) ;
614616 }
615617
616618 // TPMI_ECC_CURVE
@@ -625,10 +627,15 @@ public PubArea(byte[] pubArea)
625627 {
626628 CurveID = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset , 2 ) ;
627629 KDF = AuthDataHelper . GetSizedByteArray ( pubArea , ref offset , 2 ) ;
628- }
629630
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+ }
632639
633640 if ( pubArea . Length != offset )
634641 throw new Fido2VerificationException ( "Leftover bytes decoding pubArea" ) ;
@@ -645,21 +652,8 @@ public PubArea(byte[] pubArea)
645652 public uint Exponent { get ; private set ; }
646653 public byte [ ] ? CurveID { get ; private set ; }
647654 public byte [ ] ? KDF { get ; private set ; }
648- public byte [ ] Unique { get ; private set ; }
655+ public byte [ ] ? Unique { get ; private set ; }
649656 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 ; }
664658 }
665659}
0 commit comments