Commit 0f4704eb authored by garciay's avatar garciay
Browse files

Add functions to load certificates from files

parent c07ff371
......@@ -720,6 +720,40 @@ module LibItsSecurity_Functions {
group certificateGetters {
/**
* @desc Load in memory cache the certificates available
* @param p_rootDirectory Root directory to access to the certificates identified by the certificate ID
* @remark This method SHALL be call before any usage of certificates
* @return true on success, false otherwise
*/
function f_loadCertificates(
in charstring p_rootDirectory
) return boolean {
return fx_loadCertificates(p_rootDirectory);
}
/**
* @desc Read the specified certificate
* @param p_hashedId8 the certificate ID to read
* @param p_certificate the exoected certificate
* @return true on success, false otherwise
*/
function f_readCertificate(
in HashedId8 p_hashedId8,
out Certificate p_certificate
) return boolean {
var octetstring v_certificate;
if (fx_readCertificate(p_hashedId8, v_certificate) == true) {
var integer v_result := decvalue(oct2bit(v_certificate), p_certificate);
if (v_result == 0) {
return true;
}
}
return false;
}
function f_getCertificateValidityRestriction(
in template (value) Certificate p_cert,
in ValidityRestrictionType p_type,
......@@ -809,6 +843,26 @@ module LibItsSecurity_Functions {
} // End of group encryption
group certificatesLoader {
/**
* @desc Load in memory cache the certificates available
* @param p_rootDirectory Root directory to access to the certificates identified by the certificate ID
* @remark This method SHALL be call before any usage of certificates
* @return true on success, false otherwise
*/
external function fx_loadCertificates(in charstring p_rootDirectory) return boolean;
/**
* @desc Read the specified certificate
* @param p_hashedId8 the certificate ID to read
* @param p_certificate the exoected certificate
* @return true on success, false otherwise
*/
external function fx_readCertificate(in HashedId8 p_hashedId8, out octetstring p_certificate) return boolean;
} // End of group certificatesLoader
group geodesic {
/**
......@@ -903,7 +957,8 @@ module LibItsSecurity_Functions {
*
* @return true on success, false otherwise
*/
function f_isRectangularRegionsIntersected(in template (value) RectangularRegion p_r1,
function f_isRectangularRegionsIntersected(
in template (value) RectangularRegion p_r1,
in template (value) RectangularRegion p_r2
) return boolean {
return not ( valueof(p_r2).northwest.longitude > valueof(p_r1).southeast.longitude
......@@ -925,7 +980,8 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isRectangularRegionsInside(in template (value) RectangularRegions p_parent,
function f_isRectangularRegionsInside(
in template (value) RectangularRegions p_parent,
in template (value) RectangularRegions p_region
) return boolean {
// TODO: convert rectangular regions to polygons and check polygons
......@@ -956,7 +1012,8 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent,
function f_isPolygonalRegionInside(
in template (value) PolygonalRegion p_parent,
in template (value) PolygonalRegion p_region
) return boolean {
// Sanity check
......@@ -970,7 +1027,8 @@ module LibItsSecurity_Functions {
/**
* @desc
*/
function f_isIdentifiedRegionInside(in template (value) UInt16 p_parent,
function f_isIdentifiedRegionInside(
in template (value) UInt16 p_parent,
in template (value) UInt16 p_region
) return boolean {
return valueof(p_parent) == valueof(p_region);
......@@ -983,8 +1041,9 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsideRegion(in template (value) GeographicRegion p_region,
in template (value) ThreeDLocation p_location
function f_isLocationInsideRegion(
in template (value) GeographicRegion p_region,
in template (value) ThreeDLocation p_location
) return boolean {
var boolean v_ret := false;
......@@ -1020,7 +1079,7 @@ module LibItsSecurity_Functions {
* @verdict Unchanged
*/
function f_isLocationInsideCircularRegion(in template (value) CircularRegion p_region,
in template (value) ThreeDLocation p_location
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
if (not isbound(p_region) or not isbound(p_location)) {
......@@ -1037,7 +1096,8 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region,
function f_isLocationInsideRectangularRegion(
in template (value) RectangularRegions p_region,
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
......@@ -1057,8 +1117,9 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region,
in template (value) ThreeDLocation p_location
function f_isLocationInsidePolygonalRegion(
in template (value) PolygonalRegion p_region,
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) {
......@@ -1077,8 +1138,9 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsideIdentifiedRegion(in template (value) IdentifiedRegion p_region,
in template (value) ThreeDLocation p_location
function f_isLocationInsideIdentifiedRegion(
in template (value) IdentifiedRegion p_region,
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
if (not isbound(p_region) or not isbound(p_location)) {
......@@ -1095,8 +1157,9 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsideOtherRegion(in template (value) octetstring p_region,
in template (value) ThreeDLocation p_location
function f_isLocationInsideOtherRegion(
in template (value) octetstring p_region,
in template (value) ThreeDLocation p_location
) return boolean {
// FIXME To be removed
return false;
......@@ -1111,8 +1174,12 @@ module LibItsSecurity_Functions {
* @return The decimal coordinate on success, 0.0, otherwise
* @verdict Unchanged
*/
function f_dms2dd(in integer p_degrees, in integer p_minutes, in float p_seconds, in charstring p_latlon)
return float {
function f_dms2dd(
in integer p_degrees,
in integer p_minutes,
in float p_seconds,
in charstring p_latlon
) return float {
var Oct1 v_latlon;
// Sanity checks
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment