@@ -18,6 +18,7 @@ public class ContactDiscoveryCipher
18
18
{
19
19
private const int TAG_LENGTH_BYTES = 16 ;
20
20
private const int TAG_LENGTH_BITS = TAG_LENGTH_BYTES * 8 ;
21
+ private const long SIGNATURE_BODY_VERSION = 3 ;
21
22
22
23
public DiscoveryRequest CreateDiscoveryRequest ( IList < string > addressBook , RemoteAttestation remoteAttestation )
23
24
{
@@ -104,10 +105,9 @@ public void VerifyServerQuote(Quote quote, byte[] serverPublicStatic, string mre
104
105
throw new UnauthenticatedQuoteException ( $ "The response quote has the wrong mrenclave value in it: { Hex . ToStringCondensed ( quote . Mrenclave ) } ") ;
105
106
}
106
107
107
- if ( ! quote . IsDebugQuote ( ) )
108
+ if ( quote . IsDebugQuote ( ) )
108
109
{
109
- // XXX Invert in production
110
- throw new UnauthenticatedQuoteException ( "Expecting debug quote!" ) ;
110
+ throw new UnauthenticatedQuoteException ( "Received quote for debuggable enclave" ) ;
111
111
}
112
112
}
113
113
catch ( IOException ex )
@@ -130,14 +130,17 @@ public void VerifyIasSignature(string certificates, string signatureBody, string
130
130
131
131
SignatureBodyEntity signatureBodyEntity = JsonUtil . FromJson < SignatureBodyEntity > ( signatureBody ) ;
132
132
133
+ if ( signatureBodyEntity . Version != SIGNATURE_BODY_VERSION )
134
+ {
135
+ throw new CryptographicException ( $ "Unexpected signed quote version { signatureBodyEntity . Version } ") ;
136
+ }
137
+
133
138
if ( ! Enumerable . SequenceEqual ( ByteUtil . trim ( signatureBodyEntity . IsvEnclaveQuoteBody , 432 ) , ByteUtil . trim ( quote . QuoteBytes , 432 ) ) )
134
139
{
135
140
throw new CryptographicException ( $ "Signed quote is not the same as RA quote: { Hex . ToStringCondensed ( signatureBodyEntity . IsvEnclaveQuoteBody ! ) } vs { Hex . ToStringCondensed ( quote . QuoteBytes ) } ") ;
136
141
}
137
142
138
- // TODO: "GROUP_OUT_OF_DATE" should only be allowed during testing
139
- if ( "OK" != signatureBodyEntity . IsvEnclaveQuoteStatus && "GROUP_OUT_OF_DATE" != signatureBodyEntity . IsvEnclaveQuoteStatus )
140
- //if ("OK" != signatureBodyEntity.IsvEnclaveQuoteStatus)
143
+ if ( "OK" != signatureBodyEntity . IsvEnclaveQuoteStatus )
141
144
{
142
145
throw new CryptographicException ( $ "Quote status is: { signatureBodyEntity . IsvEnclaveQuoteStatus } ") ;
143
146
}
0 commit comments