Commits (2)
......@@ -25,6 +25,7 @@ module LibItsHttp_TestSystem {
type component HttpComponent extends SelfSyncComp { // FIXME To be rename into HttpTest
port HttpPort httpPort;
timer tc_ac := PX_TAC;
timer tc_noac := PX_TNOAC;
} // End of component HttpComponent
type component HttpTestAdapter { // FIXME To be rename into HttpTestSystem
......
This diff is collapsed.
......@@ -38,7 +38,7 @@ module LibItsPki_Pics {
/**
* @desc Certificate used by the Test System acting as EA
*/
modulepar charstring PICS_TS_EA_CERTIFICATE_ID := "CERT_TS_A_EA";
modulepar charstring PICS_TS_EA_CERTIFICATE_ID := "CERT_EA";
/**
* @desc Certificate used by the Test System acting as AA
......
......@@ -124,6 +124,7 @@ module LibItsSecurity_Functions {
if (ischosen(p_encrypedSecuredMessage.content.encryptedData)) {
var PKRecipientInfo v_pKRecipientInfo;
var RecipientInfo v_recipientInfo := p_encrypedSecuredMessage.content.encryptedData.recipients[0];
var octetstring v_decryptedSecuredMessage;
// Check the private encryption key
if (not(isbound(p_encryptPrivateKey))) {
......@@ -142,8 +143,8 @@ module LibItsSecurity_Functions {
return false;
}
if (isbound(v_pKRecipientInfo)) {
if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256)) {
var octetstring v_decryptedSecuredMessage;
var SymmetricCiphertext v_ciphertext := p_encrypedSecuredMessage.content.encryptedData.ciphertext;
if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256.v.compressed_y_0)) {
v_decryptedSecuredMessage := f_decryptWithEciesNistp256WithSha256(
......@@ -180,7 +181,6 @@ module LibItsSecurity_Functions {
}
}
} else if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1)) {
var octetstring v_decryptedSecuredMessage;
var SymmetricCiphertext v_ciphertext := p_encrypedSecuredMessage.content.encryptedData.ciphertext;
if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1.v.compressed_y_0)) {
v_decryptedSecuredMessage := f_decryptWithEciesBrainpoolp256WithSha256(
......@@ -206,6 +206,15 @@ module LibItsSecurity_Functions {
log("*** " & testcasename() & ":ERROR: Non canonical ephemeral encryption keys ***");
return false;
}
} else {
log("*** " & testcasename() & ":ERROR: Non canonical ephemeral encryption keys ***");
return false;
}
// TODO else, other variants shall be processed here if
} else {
log("*** " & testcasename() & ":ERROR: Invalid recipient info ***");
return false;
}
if (isbound(v_decryptedSecuredMessage)) {
var bitstring v_decode := oct2bit(v_decryptedSecuredMessage);
if (decvalue(v_decode, p_decrypedSecuredMessage) == 0) {
......@@ -214,7 +223,6 @@ module LibItsSecurity_Functions {
log("*** " & testcasename() & ":ERROR: Faild to decode secured message ***");
}
}
}
} else {
log("*** " & testcasename() & ":ERROR: Message not encrypted ***");
}
......@@ -244,9 +252,11 @@ module LibItsSecurity_Functions {
in octetstring p_salt,
out Oct32 p_publicEphemeralKeyCompressed,
out integer p_ephemeralKeyModeCompressed,
out Oct16 p_aes_sym_key,
out Oct16 p_encrypted_sym_key,
out Oct16 p_authentication_vector,
out Oct12 p_nonce
out Oct12 p_nonce,
in boolean p_use_hardcoded_values := false
) return octetstring {
return fx_encryptWithEciesNistp256WithSha256(
p_toBeEncryptedSecuredMessage,
......@@ -255,9 +265,11 @@ module LibItsSecurity_Functions {
p_salt,
p_publicEphemeralKeyCompressed,
p_ephemeralKeyModeCompressed,
p_aes_sym_key,
p_encrypted_sym_key,
p_authentication_vector,
p_nonce
p_nonce,
p_use_hardcoded_values
);
} // End of function f_encryptWithEciesNistp256WithSha256
......@@ -317,6 +329,7 @@ module LibItsSecurity_Functions {
in integer p_compressedMode,
out Oct32 p_publicEphemeralKeyCompressed,
out integer p_ephemeralKeyModeCompressed,
out Oct16 p_aes_sym_key,
out Oct16 p_encrypted_sym_key,
out Oct16 p_authentication_vector,
out Oct12 p_nonce
......@@ -327,6 +340,7 @@ module LibItsSecurity_Functions {
p_compressedMode,
p_publicEphemeralKeyCompressed,
p_ephemeralKeyModeCompressed,
p_aes_sym_key,
p_encrypted_sym_key,
p_authentication_vector,
p_nonce
......@@ -595,11 +609,11 @@ module LibItsSecurity_Functions {
out integer p_compressedMode
) return boolean {
if (PICS_SEC_FIXED_KEYS) {
p_privateKey := 'F8EB15C001A03623A5B5E44D73869621877710712A498C98FF9E60EE10F390F8'O;
p_publicKeyX := '7029A9B20D22AE37B1344B7FCC2322C8F1E5ECE09C39CC289E500A9487298B9B'O;
p_publicKeyY := 'F9EFA8BCC4129BC43B640566A59AE5CED7106BBA76E5DC828AF37D315634D3DC'O;
p_publicKeyCompressed := '7029A9B20D22AE37B1344B7FCC2322C8F1E5ECE09C39CC289E500A9487298B9B'O;
p_compressedMode := 0;
p_privateKey := 'D418760F0CB2DCB856BC3C7217AD3AA36DB6742AE1DB655A3D28DF88CBBF84E1'O;
p_publicKeyX := 'EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818'O;
p_publicKeyY := '5AE3C8D9FE0B1FC7438F29417C240F8BF81C358EC1A4D0C6E98D8EDBCC714017'O;
p_publicKeyCompressed := 'EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818'O;
p_compressedMode := 1;
return true;
}
......@@ -2332,9 +2346,9 @@ module LibItsSecurity_Functions {
* @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption
* @return The encrypted message
*/
external function fx_encryptWithEciesNistp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_recipientsPublicKeyCompressed, in integer p_compressedMode, in octetstring p_salt, out Oct32 p_publicEphemeralKeyCompressed, out integer p_ephemeralKeyModeCompressed, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce) return octetstring;
external function fx_encryptWithEciesNistp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_recipientsPublicKeyCompressed, in integer p_compressedMode, in octetstring p_salt, out Oct32 p_publicEphemeralKeyCompressed, out integer p_ephemeralKeyModeCompressed, out Oct16 p_aes_sym_key, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce, in boolean p_use_hardcoded_values := false) return octetstring;
external function fx_test_encryptWithEciesNistp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_privateEphemeralKey, in Oct32 p_recipientPublicKeyX, in Oct32 p_recipientPublicKeyY, in octetstring p_salt, out Oct32 p_publicEphemeralKeyX, out Oct32 p_publicEphemeralKeyY, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce) return octetstring;
external function fx_test_encryptWithEciesNistp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_privateEphemeralKey, in Oct32 p_recipientPublicKeyX, in Oct32 p_recipientPublicKeyY, in octetstring p_salt, out Oct32 p_publicEphemeralKeyX, out Oct32 p_publicEphemeralKeyY, out Oct16 p_aes_sym_key, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce) return octetstring;
/**
* @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption using Nist-P256 algorithm
* @param p_encryptedSecuredMessage The data to be decrypted
......@@ -2359,7 +2373,7 @@ module LibItsSecurity_Functions {
* @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption
* @return The encrypted message
*/
external function fx_encryptWithEciesBrainpoolp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_recipientsPublicKeyCompressed, in integer p_compressedMode, out Oct32 p_publicEphemeralKeyCompressed, out integer p_ephemeralKeyModeCompressed, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce) return octetstring;
external function fx_encryptWithEciesBrainpoolp256WithSha256(in octetstring p_toBeEncryptedSecuredMessage, in Oct32 p_recipientsPublicKeyCompressed, in integer p_compressedMode, out Oct32 p_publicEphemeralKeyCompressed, out integer p_ephemeralKeyModeCompressed, out Oct16 p_aes_sym_key, out Oct16 p_encrypted_sym_key, out Oct16 p_authentication_vector, out Oct12 p_nonce) return octetstring;
/**
* @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption using Brainpool-P256 algorithm
......
......@@ -665,6 +665,12 @@ module LibItsSecurity_Templates {
pskRecipInfo := p_pskRecipInfo
} // End of template m_recipientInfo_pskRecipInfo
template (present) RecipientInfo mw_recipientInfo_pskRecipInfo(
template (present) PreSharedKeyRecipientInfo p_pskRecipInfo := ?
) := {
pskRecipInfo := p_pskRecipInfo
} // End of template mw_recipientInfo_pskRecipInfo
template (value) RecipientInfo m_recipientInfo_symmRecipInfo(
in template (value) SymmRecipientInfo p_symmRecipInfo
) := {
......