この質問はすでにインテル フォーラムに投稿しましたが、スケジュールが限られているため、すぐに回答が必要なため、利用可能なすべてのメディアに連絡しています。
Android サービス プロバイダーでリモート認証を行う小さな Intel SGX アプリケーションを開発しています。Intel に登録した証明書を使用して IAS に HTTPS 要求を行う方法を理解するために、あなたの助けが必要です (ドキュメントで参照されているように)。
単純な Retreive SigRL GET リクエストを IAS に送信する小さなテスト Java プログラムを用意して、それがまったく機能するかどうかをテストします。しかし、HTTPS リクエストを実行しようとすると、SSLHandshakeException が発生し続けます。
Java コード:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
public class Prog {
public static void main(String[] args) throws Exception {
makeRequest();
}
public static void makeRequest() throws Exception {
String url = "https://test-as.sgx.trustedservices.intel.com:443/attestation/sgx/v2/sigrl/00000010";
URL target = new URL(url);
/* Force TLSv1.2 */
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, null, new java.security.SecureRandom());
/* Set up HTTP properties. */
HttpsURLConnection connection = (HttpsURLConnection) target.openConnection();
connection.setSSLSocketFactory(sc.getSocketFactory());
connection.setRequestMethod("GET");
connection.setDoOutput(true);
/* Obtain and check response status quote. */
int responseCode = connection.getResponseCode();
/* Read response body into a String */
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer responseBuffer = new StringBuffer();
while((inputLine = in.readLine()) != null){
responseBuffer.append(inputLine);
}
in.close();
String response = responseBuffer.toString();
/* Evaluate result and print messages. */
System.out.println("HTTP response status code: " + responseCode + "\n");
System.out.println(response);
}
}
コンソール出力:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2038)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1135)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
at Prog.makeRequest(Prog.java:32)
at Prog.main(Prog.java:13)
このチュートリアルでは、証明書を他のプラットフォームにインポートするために使用できる client.pfx ファイルを生成します。このファイルを Java プログラムを実行する Ubuntu システムにコピーし、ダブルクリックしてインポートしました。すべてが成功したように見えましたが、プログラムを実行すると、これらの例外が引き続き発生します。
また、(設定) > (ロック画面とセキュリティ) > (その他のセキュリティ設定) > (資格情報ストレージ/デバイス ストレージからインストール) のオプションを使用して、client.crt ファイルを Android にインストールしました。Android アクティビティからこのコードを実行しようとすると (メソッドをコピーペーストするだけで)、まったく同じエラーが発生します。
Ubuntu と Android (7.0、API 24) の両方から IAS リクエストを作成できる必要があります。このチュートリアルを使用して生成した証明書は、既に Intel に登録されています (Intel Developer Services から電子メールの確認とサービス プロバイダー ID を受け取りました)。
原則として、私が知る必要があるのは、Ubuntu と Android の両方で生成した証明書を適切に使用/インストールする方法と、プログラムで HTTP 要求を適切に発行しているかどうかだけです。私はまだ学生で、プロジェクトのために SGX を使用する必要があるため、知識が限られていることにご容赦ください。回答をいただければ幸いです。