dexter has uploaded this change for review.
SGP23_Constants: use a reasonable default for sm_dp_oid
The function f_SGP23_ACTIVATION_CODE_2 takes a paramter sm_dp_oid,
which currently has no reasonable default value. Let's use the
default as defined in SGP.23.
Since the Activation Code requires the SM-DP+ OID in its human
readable form, this patch also adds a converter function that
converts an objid into a charstring.
Change-Id: Iadf45954f18685c96d46b7df37c103eac3654332
Related: SYS#8203
---
M library/Misc_Helpers.ttcn
M library/euicc/SGP23_Constants.ttcn
2 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/30/43930/1
diff --git a/library/Misc_Helpers.ttcn b/library/Misc_Helpers.ttcn
index eb63a2c..5b2ec2e 100644
--- a/library/Misc_Helpers.ttcn
+++ b/library/Misc_Helpers.ttcn
@@ -162,4 +162,21 @@
return parts;
}
+/* Convert an ASN.1 object identifier to a printable string (e.g. "2.999.10") */
+function objid2char(objid oid) return charstring {
+ var charstring oid_str := log2str(oid);
+ var integer left := f_strstr(oid_str, "{ ", 0);
+ var integer right := f_strstr(oid_str, " }", 0);
+ if (left < 0) {
+ setverdict(fail, "invalid OID");
+ return "";
+ }
+ if (right < 0) {
+ setverdict(fail, "invalid OID");
+ return "";
+ }
+ left := left + 2;
+ return f_str_replace(substr(oid_str, left, right - left), " ", ".");
+}
+
}
diff --git a/library/euicc/SGP23_Constants.ttcn b/library/euicc/SGP23_Constants.ttcn
index a1695ad..77ae0fe 100644
--- a/library/euicc/SGP23_Constants.ttcn
+++ b/library/euicc/SGP23_Constants.ttcn
@@ -17,6 +17,8 @@
module SGP23_Constants {
+import from Misc_Helpers all;
+
/* Generic Constants (see also: SGP.23, annex A, section A1) */
const octetstring SGP23_EID1 := '89049032123451234512345678901235'O;
const octetstring SGP23_EID2 := '89049032112341234012345678901375'O;
@@ -30,7 +32,7 @@
}
function f_SGP23_ACTIVATION_CODE_2(charstring test_dp_address := SGP23_TEST_DP_ADDRESS1,
charstring matching_id := SGP23_MATCHING_ID_2,
- charstring sm_dp_oid := "foo") return charstring {
+ charstring sm_dp_oid := objid2char(SGP23_S_SM_DPp_OID)) return charstring {
return "1$" & test_dp_address & "$" & matching_id & "$" & sm_dp_oid;
}
function f_SGP23_ACTIVATION_CODE_3(charstring test_dp_address := SGP23_TEST_DP_ADDRESS1,
To view, visit change 43930. To unsubscribe, or for help writing mail filters, visit settings.