Skip to content

Commit

Permalink
enclaveType (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilgreenbird authored Sep 6, 2019
1 parent 6f543bf commit 0557d1a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ boolean isColumnEncryptionSettingEnabled() {

private boolean serverSupportsColumnEncryption = false;

private String enclaveType = null;

boolean getServerSupportsColumnEncryption() {
return serverSupportsColumnEncryption;
}
Expand Down Expand Up @@ -3548,12 +3550,11 @@ int writeAEFeatureRequest(boolean write, /* if false just calculates the length
int len = 6; // (1byte = featureID, 4bytes = featureData length, 1 bytes = Version)

if (write) {
tdsWriter.writeByte(TDS.TDS_FEATURE_EXT_AE); // FEATUREEXT_TC
tdsWriter.writeByte(TDS.TDS_FEATURE_EXT_AE); // FEATUREEXT_TC
tdsWriter.writeInt(1);
if (null == enclaveAttestationUrl || enclaveAttestationUrl.isEmpty()) {
tdsWriter.writeInt(TDS.AE_VERSION1);
tdsWriter.writeByte(TDS.COLUMNENCRYPTION_VERSION1);
} else {
tdsWriter.writeInt(TDS.AE_VERSION_ENCLAVE);
tdsWriter.writeByte(TDS.COLUMNENCRYPTION_VERSION2);
}
}
Expand Down Expand Up @@ -4572,6 +4573,10 @@ private void onFeatureExtAck(byte featureId, byte[] data) throws SQLServerExcept
}

serverSupportsColumnEncryption = true;
if (TDS.COLUMNENCRYPTION_VERSION2 == aeVersion) {
enclaveType = new String(data, 2, data.length-2);
}

break;
}
case TDS.TDS_FEATURE_EXT_DATACLASSIFICATION: {
Expand Down

0 comments on commit 0557d1a

Please sign in to comment.