Visible to Intel only — GUID: GUID-58B4696D-0584-4CC7-B1B8-CD437DE65FFF
Visible to Intel only — GUID: GUID-58B4696D-0584-4CC7-B1B8-CD437DE65FFF
Secure Time Guidelines
This page provides guidelines for how to use the Secure Time feature of the Intel® DAL environment. For an overview of what the Secure Time feature does, see Secure Time.
Initialization
- Calendar object should be instantiated with Calendar.CLOCK_SOURCE_PRTC as parameter.
- Current time should be acquired from a trusted source.
Note: The current time should be injected only once.
The current time is to be achieved in a secured way - either during the installation or a SIGMA connection with a trusted server. Time should be in UNIX timestamp format: Number of seconds elapsed since 1 January 1970.
3. Calendar.setTime() should be called. The return byte array now contains the calendar meta-data.
4. The metadata should be stored securely on HD for future uses. See Secure Storage sample as a reference.
Use
- Calendar object should be instantiated with Calendar.CLOCK_SOURCE_PRTC as parameter.
- Calendar metadata should be retrieved from the hard disk.
- Calendar.setTime() can now be called with the byte array metadata as input.
- Current time is returned in UNIX timestamp format: Number of seconds elapsed since 1 January 1970.
Code Snippet
In the head of the class, declare the following variables:
Calendar cal = null; byte[] timeInfo = null; TimerManager timerManager = null; TimerClient timerClient = null; Timer timer = null;
In the Invoke command function:
//just for test: init the time with 10/10/2013, 10:00:00 final int startTime = 1381399200; //get the calendar instance cal = Calendar.getInstance(Calendar.CLOCK_SOURCE_PRTC, new TimeZone()); timeInfo = new byte[Calendar.SET_TIME_INFO_LENGTH]; //init the instance with current time cal.setTime(startTime, timeInfo, 0); //test - call a timer timerManager = TimerManager.getInstance(); timerClient = new TimerClient() { //function should be called in 50 seconds public void onTimerTick(byte[] userData) { get calendar current time int res = cal.getTime(timeInfo, 0); //subtract it from the start time of the calendar int secondsElapsed = res - startTime; //validate times matches DebugPrint.printString("Expected 50, actual:"); DebugPrint.printInt(secondsElapsed); } }; //start the time to tick in 50 seconds timer = timerManager.createTimer(timerClient); timer.start(50000, null, 0, 0, false);
Troubleshooting
If the expected time is wrong when working in emulation then the ticks of the emulation may be slower that on a real platform. To compensate for the difference, in DALsdkDir\Platforms\YourPlatform\Emulator\RP_AMT06.INI change the Schedule_Timing from 2 to 1 and rerun the emulation.