aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src/asn1ct_gen_per.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-01-21 16:12:46 +0100
committerBjörn Gustavsson <[email protected]>2014-01-24 16:24:56 +0100
commitaaa4ea283b2b7dad74fdcdd5963558e9d03d80b0 (patch)
tree765382e19e86d86a897daec07e7335571285966d /lib/asn1/src/asn1ct_gen_per.erl
parent4bda9201055daf3abbdb5ef48bbdd0efacfd1fbc (diff)
downloadotp-aaa4ea283b2b7dad74fdcdd5963558e9d03d80b0.tar.gz
otp-aaa4ea283b2b7dad74fdcdd5963558e9d03d80b0.tar.bz2
otp-aaa4ea283b2b7dad74fdcdd5963558e9d03d80b0.zip
Fix OCTET STRING
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r--lib/asn1/src/asn1ct_gen_per.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl
index 1885f782bd..519ce9f054 100644
--- a/lib/asn1/src/asn1ct_gen_per.erl
+++ b/lib/asn1/src/asn1ct_gen_per.erl
@@ -151,7 +151,13 @@ gen_encode_prim_imm(Val, #type{def=Type0,constraint=Constraint}, Aligned) ->
'BOOLEAN' ->
asn1ct_imm:per_enc_boolean(Val, Aligned);
'OCTET STRING' ->
- asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned);
+ case asn1ct:use_legacy_types() of
+ false ->
+ asn1ct_imm:per_enc_octet_string(Val, Constraint, Aligned);
+ true ->
+ asn1ct_imm:per_enc_legacy_octet_string(Val, Constraint,
+ Aligned)
+ end;
'ASN1_OPEN_TYPE' ->
case Constraint of
[#'Externaltypereference'{type=Tname}] ->
@@ -332,7 +338,10 @@ gen_dec_imm_1('GeneralizedTime', Constraint, Aligned) ->
gen_dec_imm_1('OCTET STRING', Constraint, Aligned) ->
SzConstr = asn1ct_imm:effective_constraint(bitstring, Constraint),
Imm = asn1ct_imm:per_dec_octet_string(SzConstr, Aligned),
- {convert,binary_to_list,Imm};
+ case asn1ct:use_legacy_types() of
+ false -> {convert,{binary,copy},Imm};
+ true -> {convert,binary_to_list,Imm}
+ end;
gen_dec_imm_1('TeletexString', _Constraint, Aligned) ->
gen_dec_restricted_string(Aligned);
gen_dec_imm_1('T61String', _Constraint, Aligned) ->