Commit f15015da authored by Yann Garcia's avatar Yann Garcia

Merge branch 'STF525' of https://forge.etsi.org/gitlab/ITS/ITS into STF525

parents 6f3c1eb9 b8076111
......@@ -1046,7 +1046,7 @@ namespace LibItsSecurity__Functions
p__publicKeyY = k.public_key_y();
p__publicKeyCompressed = k.public_key_compressed();
p__compressedMode = INTEGER((int)k.public_key_compressed_mode());
return TRUE;
}
......
......@@ -680,7 +680,11 @@ int security_ecc::encrypt(const encryption_algotithm p_enc_algorithm, const OCTE
}
int security_ecc::decrypt(const encryption_algotithm p_enc_algorithm, const OCTETSTRING& p_key, const OCTETSTRING& p_nonce, const OCTETSTRING& p_tag, const OCTETSTRING& p_enc_message, OCTETSTRING& p_message) {
loggers::get_instance().log(">>> security_ecc::decrypt: %d", p_enc_algorithm);
loggers::get_instance().log(">>> security_ecc::decrypt: p_enc_algorithm=%d", p_enc_algorithm);
loggers::get_instance().log_msg(">>> security_ecc::decrypt: p_key=", p_key);
loggers::get_instance().log_msg(">>> security_ecc::decrypt: p_nonce", p_nonce);
loggers::get_instance().log_msg(">>> security_ecc::decrypt: p_tag", p_tag);
loggers::get_instance().log_msg(">>> security_ecc::decrypt: p_enc_message", p_enc_message);
_encryption_algotithm = p_enc_algorithm;
_sym_key = p_key;
......
......@@ -108,6 +108,10 @@ RUN cd /home/etsi/dev \
&& cd /home/etsi/dev/STF525_Its/scripts \
&& ./build_titan.bash \
&& . /home/etsi/devenv.bash \
&& cp /home/etsi/dev/STF525_Its/data/v3/asn1c_cert.tar.bz2 /home/etsi/tmp \
&& cd /home/etsi/tmp \
&& tar xvjf ./asn1c_cert.tar.bz2 \
&& cd /home/etsi/dev/STF525_Its/scripts \
&& ./update_its_project.bash \
&& cd ${HOME}/dev/etsi_its/src/AtsPki/objs \
&& ../bin/pki_generate_makefile.bash \
......
......@@ -19,12 +19,14 @@ LibItsPki_Pics.PICS_HEADER_HOST_EC := "ea.utopia.plugtests2019.innovation.ke
LibItsPki_Pics.PICS_HEADER_HOST_ATV := "ea.utopia.plugtests2019.innovation.keynectis.net"
LibItsPki_Pics.PICS_HEADER_HOST_AT := "aa.utopia.plugtests2019.innovation.keynectis.net"
LibItsPki_Pics.PICS_HEADER_HOST_CA := "dc.plugtests2019.innovation.keynectis.net"
LibItsPki_Pics.PICS_HEADER_HOST_TLM := "cpoc.jrc.ec.europa.eu"
LibItsPki_Pics.PICS_HTTP_POST_URI_EC := "/"
LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/"
LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/"
LibItsPki_Pics.PICS_HTTP_GET_URI_CTL := "/getctl/1D3C7B499A054F8C";
LibItsPki_Pics.PICS_HTTP_GET_URI_CRL := "/getcrl/1D3C7B499A054F8C";
LibItsPki_Pics.PICS_HTTP_GET_URI_ECTL := "/data/certificates/ectl/ECTL_TEST_ETSI-PLUGTEST_6.0_2019-11-07.oer"
LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := '5C25F97607DFC62972A147FAD8B7A7C939569F0F95ECD4C641724A68B51836E5'O
LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '020144E5174B0AFDA86BDB8B643B68D40030F5BDB9A9F090C64852CC3C20C9D5AD'O
......@@ -72,11 +74,11 @@ system.httpAtVPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)
#system.httpAtVPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server_mode=1,server=192.168.1.41,local_port=80)" # Multiple HTTP component ports specific to TC_SECPKI_AA_AUTHVAL_xx
system.httpAtPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(server=aa.utopia.plugtests2019.innovation.keynectis.net)"
system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(server=dc.plugtests2019.innovation.keynectis.net)"
system.httpTlmPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=cpoc.jrc.ec.europa.eu,use_ssl=1)"
[EXECUTE]
# The EnrolmentResponse message shall be sent by the EA to the ITS-S across the interface at reference point S3 in response to a received EnrolmentRequest message
#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV
ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_01_BV
# Check that EA doesn't accept Enrolment rekeying request when enrolment is not permitted by signing certificate (not containing an item of type PsidSsp)
#ItsPki_TestCases.TC_SECPKI_EA_ENR_RCV_02_BI_01
......@@ -184,9 +186,12 @@ system.httpCaPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/
#ItsPki_TestCases.TC_SECPKI_AA_AUTHVAL_01_BV
# Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL
ItsPki_TestCases.TC_RCA_CTLGEN_01_BV
#ItsPki_TestCases.TC_RCA_CTLGEN_01_BV
# Check that the RootCA generates the CRL when CA certificate is about to be revoked
ItsPki_TestCases.TC_RCA_CRLGEN_02_BV
#ItsPki_TestCases.TC_RCA_CRLGEN_02_BV
# Check that the TLM generates the ECTL when new RootCA is about to be added
#ItsPki_TestCases.TC_TLM_ECTLGEN_01_BV
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
......@@ -71,7 +71,7 @@ LibItsPki_Pics.PICS_HTTP_POST_URI_AT := "/aa/authorization"
LibItsPki_Pics.PICS_HTTP_POST_URI_ATV := "/ea/authval"
LibItsPki_Pics.PICS_ITS_S_SIGN_NITSP256_PRIVATE_KEY := '5C25F97607DFC62972A147FAD8B7A7C939569F0F95ECD4C641724A68B51836E5'O
LibItsPki_Pics.PICS_ITS_S_SIGN_NISTP256_PUBLIC_KEY := '020144E5174B0AFDA86BDB8B643B68D40030F5BDB9A9F090C64852CC3C20C9D5AD'O
LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '1B4CA1210123AE900BBE6C3EBAE7E87DA20DBDAB1E7B2EC0691C51C1021900AA'O
LibItsPki_Pics.PICS_ITS_S_CANONICAL_ID := '455453492D4954532D303031'O
LibItsPki_Pics.PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA"
LibItsPki_Pics.PICS_TS_AA_CERTIFICATE_ID := "CERT_TS_A_AA"
......
......@@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_its_security", "lib_its
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_its_security_tests_unit", "test\lib_its_security_tests_unit.vcxproj", "{5151573E-B7B3-44B4-BA0B-5410831C3D9D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "org_etsi_its_security", "org_etsi_its_security\org_etsi_its_security.vcxproj", "{B5C77DAC-BC05-426F-8E13-E60BD2732A02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
......@@ -31,14 +33,14 @@ Global
{5151573E-B7B3-44B4-BA0B-5410831C3D9D}.Release|x64.Build.0 = Release|x64
{5151573E-B7B3-44B4-BA0B-5410831C3D9D}.Release|x86.ActiveCfg = Release|Win32
{5151573E-B7B3-44B4-BA0B-5410831C3D9D}.Release|x86.Build.0 = Release|Win32
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Debug|x64.ActiveCfg = Debug|x64
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Debug|x64.Build.0 = Debug|x64
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Debug|x86.ActiveCfg = Debug|Win32
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Debug|x86.Build.0 = Debug|Win32
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Release|x64.ActiveCfg = Release|x64
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Release|x64.Build.0 = Release|x64
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Release|x86.ActiveCfg = Release|Win32
{A5E5C89A-7B89-443A-9972-E0145DBA3B7E}.Release|x86.Build.0 = Release|Win32
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Debug|x64.ActiveCfg = Debug|x64
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Debug|x64.Build.0 = Debug|x64
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Debug|x86.ActiveCfg = Debug|Win32
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Debug|x86.Build.0 = Debug|Win32
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Release|x64.ActiveCfg = Release|x64
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Release|x64.Build.0 = Release|x64
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Release|x86.ActiveCfg = Release|Win32
{B5C77DAC-BC05-426F-8E13-E60BD2732A02}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -160,7 +160,7 @@
<AdditionalDependencies>libcrypto64MDd.lib;libssl64MDd.lib;Ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>cp "$(TargetPath)" "$(MSBuildProjectDirectory)\..\..\..\tt3plugins\TT_TestSystem\itssecurity\win32\x86_64"</Command>
<Command>cp "$(TargetPath)" "$(MSBuildProjectDirectory)\..\..\..\javasrc\nativeLibs\win32\x86_64"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
......
PROJECTROOT = ..
BUILDROOT = ../../build
PROJECT = org_etsi_its_security
DEBUG = yes
testdir =
alibs = $(PROJECT)
solibs = $(PROJECT)
sources := org_etsi_its_security_NativeSecurity.c
sources-WIN32 :=
headers := org_etsi_its_security_NativeSecurity.h
cflags += -Werror
packages += openssl
includes += ../../lib_its_security /usr/lib/jvm/java-11-openjdk-amd64/include /usr/lib/jvm/java-11-openjdk-amd64/include/linux
libs += $(outdir)/libItsSecurity.a
include ../../common.mk
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{B5C77DAC-BC05-426F-8E13-E60BD2732A02}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>orgetsiitssecurity</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_Win64;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\OpenSSL-Win64\include;C:\Program Files\Java\jdk1.8.0_241\include;C:\Program Files\Java\jdk1.8.0_241\include\win32;$(ProjectDir)../lib_its_security;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(ProjectDir)..\x64\Release;C:\Program Files\OpenSSL-Win64\lib\VC</AdditionalLibraryDirectories>
<AdditionalDependencies>lib_its_security.lib;libcrypto64MDd.lib;libssl64MDd.lib;Ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>cp "$(TargetPath)" "$(MSBuildProjectDirectory)\..\..\..\javasrc\nativeLibs\win32\x86_64"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_Win64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\OpenSSL-Win64\include;C:\Program Files\Java\jdk1.8.0_241\include;C:\Program Files\Java\jdk1.8.0_241\include\win32;$(ProjectDir)../lib_its_security;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>lib_its_security.lib;libcrypto64MDd.lib;libssl64MDd.lib;Ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Lib>
<AdditionalLibraryDirectories>$(ProjectDir)..\x64\Debug;C:\Program Files\OpenSSL-Win64\lib\VC</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="org_etsi_its_security_NativeSecurity.c" />
<ClCompile Include="org_etsi_its_security_NativeSecurity.h">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
\ No newline at end of file
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_etsi_its_security_NativeSecurity */
#ifndef _Included_org_etsi_its_security_NativeSecurity
#define _Included_org_etsi_its_security_NativeSecurity
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: hashWithSha256
* Signature: ([B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_hashWithSha256
(JNIEnv*, jobject, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: hashWithSha384
* Signature: ([B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_hashWithSha384
(JNIEnv*, jobject, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: hmacWithSha256
* Signature: ([B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_hmacWithSha256
(JNIEnv*, jobject, jbyteArray, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: signWithEcdsaNistp256WithSha256
* Signature: ([B[B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_signWithEcdsaNistp256WithSha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: signWithEcdsaBrainpoolp256r1WithSha256
* Signature: ([B[B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_signWithEcdsaBrainpoolp256r1WithSha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: signWithEcdsaBrainpoolp384r1WithSha384
* Signature: ([B[B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_signWithEcdsaBrainpoolp384r1WithSha384
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: verifyWithEcdsaNistp256WithSha256
* Signature: ([B[B[B[BI)I
*/
JNIEXPORT jint JNICALL Java_org_etsi_its_security_NativeSecurity_verifyWithEcdsaNistp256WithSha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jint);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: verifyWithEcdsaBrainpoolp256r1WithSha256
* Signature: ([B[B[B[BI)I
*/
JNIEXPORT jint JNICALL Java_org_etsi_its_security_NativeSecurity_verifyWithEcdsaBrainpoolp256r1WithSha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jint);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: verifyWithEcdsaBrainpoolp384r1WithSha384
* Signature: ([B[B[B[BI)I
*/
JNIEXPORT jint JNICALL Java_org_etsi_its_security_NativeSecurity_verifyWithEcdsaBrainpoolp384r1WithSha384
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jint);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: generate_key_pair
* Signature: (ILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
*/
JNIEXPORT jint JNICALL Java_org_etsi_its_security_NativeSecurity_generate_1key_1pair
(JNIEnv*, jobject, jint, jobject, jobject, jobject, jobject);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: encrypt_with_ecies_nistp256_with_sha256
* Signature: ([B[B[BLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_encrypt_1with_1ecies_1nistp256_1with_1sha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jobject, jobject, jobject, jobject, jobject);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: encrypt_with_ecies_brainpoolp256r1_with_sha256
* Signature: ([B[B[BLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_encrypt_1with_1ecies_1brainpoolp256r1_1with_1sha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jobject, jobject, jobject, jobject, jobject);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: decrypt_with_ecies_nistp256_with_sha256
* Signature: ([B[B[B[B[B[B[BLjava/nio/ByteBuffer;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_decrypt_1with_1ecies_1nistp256_1with_1sha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jobject);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: decrypt_with_ecies_brainpoolp256r1_with_sha256
* Signature: ([B[B[B[B[B[B[BLjava/nio/ByteBuffer;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_decrypt_1with_1ecies_1brainpoolp256r1_1with_1sha256
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jobject);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: encrypt_aes_128_ccm_test
* Signature: ([B[B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_encrypt_1aes_1128_1ccm_1test
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray);
/*
* Class: org_etsi_its_security_NativeSecurity
* Method: decrypt_aes_128_ccm_test
* Signature: ([B[B[B)[B
*/
JNIEXPORT jbyteArray JNICALL Java_org_etsi_its_security_NativeSecurity_decrypt_1aes_1128_1ccm_1test
(JNIEnv*, jobject, jbyteArray, jbyteArray, jbyteArray);
#ifdef __cplusplus
}
#endif
#endif
......@@ -3,7 +3,7 @@
extern "C" {
#include "lib_its_security.h"
#ifndef _Win64
uint8_t* hex_to_bin(const int8_t* p_buffer, size_t* p_buffer_length);
uint8_t* hex_to_bin(const int8_t* p_buffer, size_t* p_buffer_length);
#endif
}
......@@ -19,7 +19,7 @@ uint8_t* hex_to_bin(const int8_t* p_buffer, size_t* p_buffer_length) {
}
if ((len = strlen((const char*)p_buffer)) & 1) {
return NULL;
}
}
retval = (uint8_t*)malloc(len >> 1);
for (i = 0; i < len; i++) {
......@@ -427,7 +427,7 @@ TEST(lib_its_security_test_suite, sign_with_ecdsa_nistp256_with_sha256_2) {
// Test body
EXPECT_TRUE(verify_with_ecdsa_nistp256_with_sha256(lib_its_security_context, public_key_y, 32, issuer, sig, public_key_compressed, public_key_compressed_mode) == 0);
// Postamble
free(sig);
free(private_key);
......@@ -978,7 +978,7 @@ TEST(lib_its_security_test_suite, decrypt_aes_ccm_4) {
EXPECT_TRUE(decrypt(lib_its_security_context, encrypted_secured_message, encrypted_secured_message_length, &new_plain_text_message, &new_plain_text_message_length) == 0);
EXPECT_TRUE(new_plain_text_message != NULL);
EXPECT_TRUE(plain_text_message_length == new_plain_text_message_length);
for(size_t i = 0; i < new_plain_text_message_length; i++) {
for (size_t i = 0; i < new_plain_text_message_length; i++) {
EXPECT_TRUE(*(new_plain_text_message + i) == *(plain_text_message + i));
}
......@@ -1047,7 +1047,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_2) {
uint8_t* encrypted_secured_message = NULL;
size_t encrypted_secured_message_length = 0;
EXPECT_TRUE(encrypt_with_ecies_nistp256_with_sha256(lib_its_security_context/*recipient's public keys*/, plain_text_message, plain_text_message_length, lib_its_security_context->public_key_c, lib_its_security_context->compressed_mode, salt, salt_length, &ephemeral_key_compressed, &ephemeral_compressed_mode, &aes_sym_key, &encrypted_sym_key, &authentication_vector, &nonce, &encrypted_secured_message, &encrypted_secured_message_length) == 0);
// Test body
size_t new_plain_text_message_length = 0;
uint8_t* new_plain_text_message = NULL;
......@@ -1062,7 +1062,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_2) {
}
free(new_plain_text_message);
free(new_aes_enc_sym_key);
// Postamble
free(plain_text_message);
free(salt);
......@@ -1097,7 +1097,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_3) {
uint8_t* encrypted_secured_message = NULL;
size_t encrypted_secured_message_length = 0;
EXPECT_TRUE(encrypt_with_ecies_nistp256_with_sha256(lib_its_security_context/*recipient's public keys*/, plain_text_message, plain_text_message_length, lib_its_security_context->public_key_c, lib_its_security_context->compressed_mode, salt, salt_length, &ephemeral_key_compressed, &ephemeral_compressed_mode, &aes_sym_key, &encrypted_sym_key, &authentication_vector, &nonce, &encrypted_secured_message, &encrypted_secured_message_length) == 0);
// Test body
size_t new_plain_text_message_length = 0;
uint8_t* new_plain_text_message = NULL;
......@@ -1106,7 +1106,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_3) {
EXPECT_TRUE(decrypt_with_ecies_nistp256_with_sha256(lib_its_security_context, encrypted_secured_message, encrypted_secured_message_length, lib_its_security_context->private_key, ephemeral_key_compressed, ephemeral_compressed_mode, encrypted_sym_key, authentication_vector, nonce, salt, salt_length, &new_aes_enc_sym_key, &new_plain_text_message, &new_plain_text_message_length) == -1);
free(new_plain_text_message);
free(new_aes_enc_sym_key);
// Postamble
free(plain_text_message);
free(salt);
......@@ -1141,7 +1141,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_4) {
uint8_t* encrypted_secured_message = NULL;
size_t encrypted_secured_message_length = 0;
EXPECT_TRUE(encrypt_with_ecies_nistp256_with_sha256(lib_its_security_context/*recipient's public keys*/, plain_text_message, plain_text_message_length, lib_its_security_context->public_key_c, lib_its_security_context->compressed_mode, salt, salt_length, &ephemeral_key_compressed, &ephemeral_compressed_mode, &aes_sym_key, &encrypted_sym_key, &authentication_vector, &nonce, &encrypted_secured_message, &encrypted_secured_message_length) == 0);
// Test body
size_t new_plain_text_message_length = 0;
uint8_t* new_plain_text_message = NULL;
......@@ -1150,7 +1150,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_4) {
EXPECT_TRUE(decrypt_with_ecies_nistp256_with_sha256(lib_its_security_context, encrypted_secured_message, encrypted_secured_message_length, lib_its_security_context->private_key, ephemeral_key_compressed, ephemeral_compressed_mode, encrypted_sym_key, authentication_vector, nonce, salt, salt_length, &new_aes_enc_sym_key, &new_plain_text_message, &new_plain_text_message_length) == -1);
free(new_plain_text_message);
free(new_aes_enc_sym_key);
// Postamble
free(plain_text_message);
free(salt);
......@@ -1185,7 +1185,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_5) {
uint8_t* encrypted_secured_message = NULL;
size_t encrypted_secured_message_length = 0;
EXPECT_TRUE(encrypt_with_ecies_nistp256_with_sha256(lib_its_security_context/*recipient's public keys*/, plain_text_message, plain_text_message_length, lib_its_security_context->public_key_c, lib_its_security_context->compressed_mode, salt, salt_length, &ephemeral_key_compressed, &ephemeral_compressed_mode, &aes_sym_key, &encrypted_sym_key, &authentication_vector, &nonce, &encrypted_secured_message, &encrypted_secured_message_length) == 0);
// Test body
size_t new_plain_text_message_length = 0;
uint8_t* new_plain_text_message = NULL;
......@@ -1194,7 +1194,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_5) {
EXPECT_TRUE(decrypt_with_ecies_nistp256_with_sha256(lib_its_security_context, encrypted_secured_message, encrypted_secured_message_length, lib_its_security_context->private_key, ephemeral_key_compressed, ephemeral_compressed_mode, encrypted_sym_key, authentication_vector, nonce, salt, salt_length, &new_aes_enc_sym_key, &new_plain_text_message, &new_plain_text_message_length) == -1);
free(new_plain_text_message);
free(new_aes_enc_sym_key);
// Postamble
free(plain_text_message);
free(salt);
......@@ -1229,7 +1229,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_6) {
uint8_t* encrypted_secured_message = NULL;
size_t encrypted_secured_message_length = 0;
EXPECT_TRUE(encrypt_with_ecies_nistp256_with_sha256(lib_its_security_context/*recipient's public keys*/, plain_text_message, plain_text_message_length, lib_its_security_context->public_key_c, lib_its_security_context->compressed_mode, salt, salt_length, &ephemeral_key_compressed, &ephemeral_compressed_mode, &aes_sym_key, &encrypted_sym_key, &authentication_vector, &nonce, &encrypted_secured_message, &encrypted_secured_message_length) == 0);
// Test body
size_t new_plain_text_message_length = 0;
uint8_t* new_plain_text_message = NULL;
......@@ -1238,7 +1238,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_nistp256_with_sha256_6) {
EXPECT_TRUE(decrypt_with_ecies_nistp256_with_sha256(lib_its_security_context, encrypted_secured_message, encrypted_secured_message_length, lib_its_security_context->private_key, ephemeral_key_compressed, ephemeral_compressed_mode, encrypted_sym_key, authentication_vector, nonce, salt, salt_length, &new_aes_enc_sym_key, &new_plain_text_message, &new_plain_text_message_length) == -1);
free(new_plain_text_message);
free(new_aes_enc_sym_key);
// Postamble
free(plain_text_message);
free(salt);
......@@ -1520,8 +1520,7 @@ TEST(lib_its_security_test_suite, encrypt_with_ecies_brainpoolp256r1_with_sha256
* @param[in] p_argc Number of argumrnt
* @param[in] p_argv List of the arguments
*/
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
......@@ -58,6 +58,7 @@ module ItsPki_TestCases {
import from LibItsHttp_BinaryTemplates all;
import from LibItsHttp_Functions all;
import from LibItsHttp_TestSystem all;
import from LibItsHttp_Pics all;
// LibItsPki
import from LibItsPki_TypesAndValues all;
......@@ -8902,7 +8903,7 @@ module ItsPki_TestCases {
group ca_behavior {
group ctl {
/**
* @desc Check that the RootCA generates the Full CTL when new EA is about to be added to the Root CTL
* <pre>
......@@ -8949,7 +8950,7 @@ module ItsPki_TestCases {
// Test adapter configuration
// Preamble
f_init_default_headers_list(-, "ca_request", v_headers);
f_init_default_headers_list(PICS_HEADER_CTL_CONTENT_TYPE, "ca_request", v_headers);
action("The RootCA is triggered to add new EA certificate (CERT_EA) in the CTL");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
......@@ -9047,7 +9048,7 @@ module ItsPki_TestCases {
// Test adapter configuration
// Preamble
f_init_default_headers_list(-, "ca_request", v_headers);
f_init_default_headers_list(PICS_HEADER_CRL_CONTENT_TYPE, "ca_request", v_headers);
action("the RootCA is triggered to add new CA certificate (CERT_CA) to the revocation list");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
......@@ -9104,4 +9105,111 @@ module ItsPki_TestCases {
} // End of group ca_behavior
group tlm_behavior {
group ctl {
/**
* @desc Check that the TLM generates the ECTL when new RootCA is about to be added
* <pre>
* Pics Selection: PICS_IUT_CA_ROLE
* Initial conditions:
* }
* Expected behaviour:
* ensure that {
* when {
* the TLM is triggered to add new RootCA certificate (CERT_RCA) in the CTL
* }
* then {
* the IUT issue a new CTL of type CtlFormat
* containing isFullCtl
* indicating TRUE
* and containing ctlCommands
* containing CtlCommand
* containing add
* containing rca
* containing selfsignedRootCa
* indicating CERT_RCA
* }
* }
* </pre>
*
* @see ETSI TS 103 525-2 TP TLM_ECTLGEN_01_BV
* @reference ETSI TS 102 941, clause 6.3.1
*/
testcase TC_TLM_ECTLGEN_01_BV() runs on ItsPkiHttp system ItsPkiHttpSystem {