Loading ttcn/Security/LibItsSecurity_Functions.ttcn +51 −22 Original line number Diff line number Diff line Loading @@ -123,18 +123,27 @@ module LibItsSecurity_Functions { return false; } /*if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256)) { var octetstring v_encryptedSecuredMessage; if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256)) { var octetstring v_decryptedSecuredMessage; var SymmetricCiphertext v_ciphertext := p_encrypedSecuredMessage.content.encryptedData.ciphertext; f_decryptWithEciesNistp256WithSha256( // FIXME Add the private encryption key /*v_decryptedSecuredMessage := f_decryptWithEciesNistp256WithSha256( v_ciphertext.aes128ccm.ccmCiphertext, , , v_pKRecipientInfo.encKey.eciesNistP256.v.uncompressedP256.x, v_pKRecipientInfo.encKey.eciesNistP256.v.uncompressedP256.y, v_pKRecipientInfo.encKey.eciesNistP256.c, v_ciphertext.aes128ccm.nonce, v_pKRecipientInfo.encKey.eciesNistP256.t); } else if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1)) { v_pKRecipientInfo.encKey.eciesNistP256.t, v_ciphertext.aes128ccm.nonce ); if (isbound(v_decryptedSecuredMessage)) { var bitstring v_decode := oct2bit(v_decryptedSecuredMessage); if (decvalue(v_decode, p_decrypedSecuredMessage) == 0) { return true; } }*/ } else if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1)) { // TODO } } return false; Loading @@ -143,7 +152,14 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) encryption * @param p_toBeEncryptedSecuredMessage The data to be encrypted * @return The encrypted value * @param p_recipientsPublicKeyX The Recipient's public encryption key X-coordinate * @param p_recipientsPublicKeyY The Recipient's public encryption key Y-coordinate * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The encrypted message */ function f_encryptWithEciesNistp256WithSha256( in octetstring p_toBeEncryptedSecuredMessage, Loading @@ -170,7 +186,12 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption * @param p_encryptedSecuredMessage The data to be decrypted * @return The decrypted value * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The decrypted message */ function f_decryptWithEciesNistp256WithSha256( in octetstring p_encryptedSecuredMessage, Loading Loading @@ -1782,18 +1803,26 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) encryption * @param p_toBeEncryptedSecuredMessage The data to be encrypted * @param p_publicKeyX The public key (X coordonate) * @param p_publicKeyY The public key (Y coordonate) * @return The encrypted value * @param p_recipientsPublicKeyX The Recipient's public encryption key X-coordinate * @param p_recipientsPublicKeyY The Recipient's public encryption key Y-coordinate * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @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_recipientsPublicKeyX, in Oct32 p_recipientsPublicKeyY, 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; /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption * @param p_encryptedSecuredMessage The data to be decrypted * @param p_publicKeyX The public key (X coordonate) * @param p_publicKeyY The public key (Y coordonate) * @return The decrypted value * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The decrypted message */ external function fx_decryptWithEciesNistp256WithSha256(in octetstring p_encryptedSecuredMessage, in Oct32 p_privateEncKey, in Oct32 p_publicEphemeralKeyX, in Oct32 p_publicEphemeralKeyY, in Oct16 p_encrypted_sym_key, in Oct16 p_authentication_vector, in Oct12 p_nonce) return octetstring; Loading Loading
ttcn/Security/LibItsSecurity_Functions.ttcn +51 −22 Original line number Diff line number Diff line Loading @@ -123,18 +123,27 @@ module LibItsSecurity_Functions { return false; } /*if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256)) { var octetstring v_encryptedSecuredMessage; if (ischosen(v_pKRecipientInfo.encKey.eciesNistP256)) { var octetstring v_decryptedSecuredMessage; var SymmetricCiphertext v_ciphertext := p_encrypedSecuredMessage.content.encryptedData.ciphertext; f_decryptWithEciesNistp256WithSha256( // FIXME Add the private encryption key /*v_decryptedSecuredMessage := f_decryptWithEciesNistp256WithSha256( v_ciphertext.aes128ccm.ccmCiphertext, , , v_pKRecipientInfo.encKey.eciesNistP256.v.uncompressedP256.x, v_pKRecipientInfo.encKey.eciesNistP256.v.uncompressedP256.y, v_pKRecipientInfo.encKey.eciesNistP256.c, v_ciphertext.aes128ccm.nonce, v_pKRecipientInfo.encKey.eciesNistP256.t); } else if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1)) { v_pKRecipientInfo.encKey.eciesNistP256.t, v_ciphertext.aes128ccm.nonce ); if (isbound(v_decryptedSecuredMessage)) { var bitstring v_decode := oct2bit(v_decryptedSecuredMessage); if (decvalue(v_decode, p_decrypedSecuredMessage) == 0) { return true; } }*/ } else if (ischosen(v_pKRecipientInfo.encKey.eciesBrainpoolP256r1)) { // TODO } } return false; Loading @@ -143,7 +152,14 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) encryption * @param p_toBeEncryptedSecuredMessage The data to be encrypted * @return The encrypted value * @param p_recipientsPublicKeyX The Recipient's public encryption key X-coordinate * @param p_recipientsPublicKeyY The Recipient's public encryption key Y-coordinate * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The encrypted message */ function f_encryptWithEciesNistp256WithSha256( in octetstring p_toBeEncryptedSecuredMessage, Loading @@ -170,7 +186,12 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption * @param p_encryptedSecuredMessage The data to be decrypted * @return The decrypted value * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The decrypted message */ function f_decryptWithEciesNistp256WithSha256( in octetstring p_encryptedSecuredMessage, Loading Loading @@ -1782,18 +1803,26 @@ module LibItsSecurity_Functions { /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) encryption * @param p_toBeEncryptedSecuredMessage The data to be encrypted * @param p_publicKeyX The public key (X coordonate) * @param p_publicKeyY The public key (Y coordonate) * @return The encrypted value * @param p_recipientsPublicKeyX The Recipient's public encryption key X-coordinate * @param p_recipientsPublicKeyY The Recipient's public encryption key Y-coordinate * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @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_recipientsPublicKeyX, in Oct32 p_recipientsPublicKeyY, 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; /** * @desc Produces a Elliptic Curve Digital Encrytion Algorithm (ECIES) decryption * @param p_encryptedSecuredMessage The data to be decrypted * @param p_publicKeyX The public key (X coordonate) * @param p_publicKeyY The public key (Y coordonate) * @return The decrypted value * @param p_publicEphemeralKeyX The generated ephemeral key X-coordinate * @param p_publicEphemeralKeyY The generated ephemeral key Y-coordinate * @param p_encrypted_sym_key The encrypted AES 128 CCM symmetric key * @param p_authentication_vector The tag of the AES 128 CCM symmetric key encryption * @param p_nonce The nonce vector of the AES 128 CCM symmetric key encryption * @return The decrypted message */ external function fx_decryptWithEciesNistp256WithSha256(in octetstring p_encryptedSecuredMessage, in Oct32 p_privateEncKey, in Oct32 p_publicEphemeralKeyX, in Oct32 p_publicEphemeralKeyY, in Oct16 p_encrypted_sym_key, in Oct16 p_authentication_vector, in Oct12 p_nonce) return octetstring; Loading