Commits (1)
......@@ -117,6 +117,19 @@ module LibItsCommon_Functions {
return v_timeStamp;
}
/**
* @desc Gets the current time since 01/01/1970 in UTC format
* @return The current time since 01/01/1970 in UTC format
*/
function f_getCurrentTimeUtc() return UInt64 {
var UInt64 v_time := 0;
// log("*** f_getCurrentTimeUtc: INFO: calling fx_getCurrentTimeUtc() ***");
v_time := fx_getCurrentTimeUtc();
return v_time;
}
/**
* @desc Gets the current time since 01/01/2004
* @return TimeMark - tenths of a second in the current or next hour in units of 1/10th second from UTC time
......@@ -228,6 +241,12 @@ module LibItsCommon_Functions {
*/
external function fx_getCurrentTime() return UInt64;
/**
* @desc Gets the current time since 01/01/1970 in UTC format
* @return The current time since 01/01/1970 in UTC format
*/
external function fx_getCurrentTimeUtc() return UInt64;
/**
* @desc Gets the tenths of a second in the current or next hour in units of 1/10th second from UTC time
* @return TimeMark - tenths of a second in the current or next hour in units of 1/10th second from UTC time
......
......@@ -89,6 +89,8 @@ module LibItsPki_Functions {
f_prepareCertificates(p_certificateId, vc_aaCertificate, vc_atCertificate);
f_readCertificate(p_certificateId, vc_eaCertificate);
f_readSigningKey(p_certificateId, vc_eaPrivateKey);
f_getCertificateDigest(p_certificateId, vc_eaHashedId8);
} // End of function f_cfHttpUp
/**
......@@ -210,7 +212,7 @@ module LibItsPki_Functions {
),
m_headerInfo_inner_ec_request(
c_its_aid_SCR,
f_getCurrentTime())
f_getCurrentTimeUtc())
);
// Signed the encoded InnerEcRequestSignedForPop
v_tbs_signed := f_signWithEcdsaNistp256WithSha256(bit2oct(encvalue(v_tbs)), int2oct(0, 32), p_private_key);
......@@ -239,8 +241,20 @@ module LibItsPki_Functions {
group pki_functions {
/**
* @desc Build a signed and encrypted PKI message
* @param p_private_key Private key for signature
* @param p_signer_identifier Signer identifier for signature, could be self or certificate HashedId8
* @param p_recipientId Recipient identifier to be inclued in encrypted layer.
* If value is int2oct(0. 8), the recipient id is the HashedId8 of the symmetric key used by the sender to encrypt the message to which the response is built
* @param p_publicKeyCompressed The public compressed key (canonical form) for encryption
* @param p_compressedMode The compressed mode of the public compressed key (canonical form) for encryption
* @param p_pki_message The PKI message to be secured
* @param p_ieee1609dot2_signed_and_encrypted_data The secured message
* @return true on success, false otherwise
*/
function f_build_pki_secured_message(
in Oct32 p_private_key,
in octetstring p_private_key,
in SignerIdentifier p_signer_identifier,
in HashedId8 p_recipientId,
in Oct32 p_publicKeyCompressed,
......@@ -267,7 +281,7 @@ module LibItsPki_Functions {
m_signedDataPayload(
m_etsiTs103097Data_unsecured(p_pki_message)
),
m_headerInfo_inner_ec_request(12345, f_getCurrentTime()) // TODO Use PIXIT
m_headerInfo_inner_ec_request(12345, f_getCurrentTimeUtc()) // TODO Use PIXIT
);
if (ischosen(p_signer_identifier.self_)) {
v_tbs_signed := f_signWithEcdsaNistp256WithSha256(bit2oct(encvalue(v_tbs)), int2oct(0, 32), p_private_key);
......
......@@ -72,6 +72,8 @@ module LibItsPki_TestSystem {
type component ItsPkiHttp extends ItsSecurityBaseComponent, HttpComponent {
var Certificate vc_eaCertificate; /** Test Adapter EA certificate */
var octetstring vc_eaPrivateKey; /** Test Adapter EA proivate key for signature */
var HashedId8 vc_eaHashedId8; /** Test Adapter EA HashedId8 for RecipientId */
} // End of component ItsPki
type component ItsPkiItss extends ItsGeoNetworking {
......
......@@ -1008,7 +1008,7 @@ module LibItsSecurity_Templates {
template (omit) HeaderInfo m_headerInfo_inner_ec_request(
in template (value) Psid p_psid := c_its_aid_GN,
in template (value) Time64 p_generationTime
) modifies m_ieee1609Dot2_headerInfo := {};
) modifies m_headerInfo_gn := {};
} // End of group headerFields
......