Commit ad97b4ed authored by garciay's avatar garciay
Browse files

Add certificates loader

parent a4f28dc5
......@@ -2138,23 +2138,6 @@ module ItsSecurity_TestCases {
)
)
);
f_sleep(0.1);
f_sendSecuredCam(
cc_taCert_A,
valueof(
m_headerInfo_cam(
-,
f_computeGnTimestamp(),
-,
-,
v_aa_certificate
)),
valueof(
m_signerIdentifier_digest(
v_hashedId8
)
)
);
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
[] tc_ac.timeout {
......@@ -56,8 +56,6 @@ module TestCodec_Certificates {
// Generate Private/Public keys
f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
v_cert := m_etsiTs103097Certificate(
m_issuerIdentifier_self(v_self),
......@@ -143,8 +141,6 @@ module TestCodec_Certificates {
// Generate Private/Public keys
f_generate_key_pair_brainpoolp256(v_private_key, v_publicKeyX, v_publicKeyY);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
v_cert := m_etsiTs103097Certificate(
m_issuerIdentifier_self(v_self),
......@@ -229,8 +225,6 @@ module TestCodec_Certificates {
// Generate Private/Public keys
f_generate_key_pair_brainpoolp384(v_private_key, v_publicKeyX, v_publicKeyY);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
v_cert := m_etsiTs103097Certificate(
m_issuerIdentifier_self(v_self),
......@@ -311,8 +305,6 @@ module TestCodec_Certificates {
// Generate Private/Public keys
f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
v_cert := m_etsiTs103097Certificate(
m_issuerIdentifier_sha256AndDigest(v_sha256AndDigest),
......@@ -545,8 +537,6 @@ module TestCodec_Certificates {
// Generate Private/Public keys
f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
v_cert := m_etsiTs103097Certificate(
m_issuerIdentifier_sha256AndDigest('AF232618BE5E6F55'O),
......
......@@ -25,11 +25,13 @@ module TestCodec_ChainOfCertificates {
import from TestCodec_TestAndSystem all;
type record sec_info {
EtsiTs103097Certificate cert,
EtsiTs103097Certificate cert,
octetstring enc_cert,
Oct32 private_key,
Oct32 public_key_x,
Oct32 public_key_y,
HashedId8 hashid8
HashedId8 hashid8,
HashedId8 issuer
}
type record chain_sec_info {
......@@ -48,7 +50,9 @@ module TestCodec_ChainOfCertificates {
// Generate CA certificate
v_chain_sec_info.ca.cert := f_create_ca_certificate_nistP256_1(v_chain_sec_info.ca);
v_enc_msg := encvalue(v_chain_sec_info.ca.cert);
v_chain_sec_info.ca.hashid8 := f_HashedId8FromSha256(f_hashWithSha256(bit2oct(v_enc_msg)));
v_chain_sec_info.ca.enc_cert := bit2oct(v_enc_msg);
v_chain_sec_info.ca.hashid8 := f_HashedId8FromSha256(v_chain_sec_info.ca.enc_cert);
v_chain_sec_info.ca.issuer := v_chain_sec_info.ca.hashid8;
// Verify signature of CA certificate by itself
v_enc_msg := encvalue(v_chain_sec_info.ca.cert.toBeSigned);
if (f_verifyWithEcdsaNistp256WithSha256(
......@@ -67,7 +71,9 @@ module TestCodec_ChainOfCertificates {
// Generate AA certificate
v_chain_sec_info.aa.cert := f_create_aa_certificate_nistP256_1(v_chain_sec_info.ca, v_chain_sec_info.aa);
v_enc_msg := encvalue(v_chain_sec_info.aa.cert);
v_chain_sec_info.aa.hashid8 := f_HashedId8FromSha256(f_hashWithSha256(bit2oct(v_enc_msg)));
v_chain_sec_info.aa.enc_cert := bit2oct(v_enc_msg);
v_chain_sec_info.aa.hashid8 := f_HashedId8FromSha256(v_chain_sec_info.aa.enc_cert);
v_chain_sec_info.aa.issuer := v_chain_sec_info.ca.hashid8;
// Verify signature of AA certificate by CA certificate
v_enc_msg := encvalue(v_chain_sec_info.aa.cert.toBeSigned);
if (f_verifyWithEcdsaNistp256WithSha256(
......@@ -86,7 +92,9 @@ module TestCodec_ChainOfCertificates {
// Generate AT certificate
v_chain_sec_info.at.cert := f_create_at_certificate_nistP256_1(v_chain_sec_info.aa, v_chain_sec_info.at);
v_enc_msg := encvalue(v_chain_sec_info.at.cert);
v_chain_sec_info.at.hashid8 := f_HashedId8FromSha256(f_hashWithSha256(bit2oct(v_enc_msg)));
v_chain_sec_info.at.enc_cert := bit2oct(v_enc_msg);
v_chain_sec_info.at.hashid8 := f_HashedId8FromSha256(v_chain_sec_info.at.enc_cert);
v_chain_sec_info.at.issuer := v_chain_sec_info.aa.hashid8;
// Verify signature of AT certificate by AA certificate
v_enc_msg := encvalue(v_chain_sec_info.at.cert.toBeSigned);
if (f_verifyWithEcdsaNistp256WithSha256(
......@@ -104,6 +112,11 @@ module TestCodec_ChainOfCertificates {
log("tc_full_check_certificate_1: Final chain = ", v_chain_sec_info);
// Store Private key in binary format
fx_store_certificate("CERT_TEST_ROOT", v_chain_sec_info.ca.enc_cert, v_chain_sec_info.ca.private_key, v_chain_sec_info.ca.public_key_x, v_chain_sec_info.ca.public_key_y, v_chain_sec_info.ca.hashid8, v_chain_sec_info.ca.issuer);
fx_store_certificate("CERT_TS_A_AA", v_chain_sec_info.ca.enc_cert, v_chain_sec_info.ca.private_key, v_chain_sec_info.ca.public_key_x, v_chain_sec_info.ca.public_key_y, v_chain_sec_info.ca.hashid8, v_chain_sec_info.ca.issuer);
fx_store_certificate("CERT_TS_A_AT", v_chain_sec_info.ca.enc_cert, v_chain_sec_info.ca.private_key, v_chain_sec_info.ca.public_key_x, v_chain_sec_info.ca.public_key_y, v_chain_sec_info.ca.hashid8, v_chain_sec_info.ca.issuer);
// Create a basic GeoNetworking message
v_gnNonSecuredPacket := m_geoNwShbPacket(
LongPosVector: {
......
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