1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2003-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20%% 21-module(testDER). 22 23-export([test/0]). 24 25-include_lib("common_test/include/ct.hrl"). 26 27test() -> 28 Val = {'Set',12,{version,214},true}, 29 roundtrip_enc('Set', Val, <<49,12,1,1,255,2,2,0,214,161,3,2,1,12>>), 30 31 ValSof = [{version,12},{message,"PrintableString"}, 32 {message,"Print"},{version,11}], 33 ValSofSorted = [{version,11},{version,12}, 34 {message,"Print"},{message,"PrintableString"}], 35 roundtrip_enc('SetOf', ValSof, ValSofSorted, 36 <<49,30,2,1,11,2,1,12,19,5,80,114,105,110,116,19,15,80, 37 114,105,110,116,97,98,108,101,83,116,114,105,110,103>>), 38 39 ValSO = [{'Seq2',1,true},{'Seq2',120000,false},{'Seq2',3,true}], 40 roundtrip('SO', ValSO). 41 42roundtrip(T, V) -> 43 asn1_test_lib:roundtrip('DERSpec', T, V). 44 45roundtrip_enc(T, V, Enc) -> 46 Enc = asn1_test_lib:roundtrip_enc('DERSpec', T, V). 47 48roundtrip_enc(T, V, Expected, Enc) -> 49 Enc = asn1_test_lib:roundtrip_enc('DERSpec', T, V, Expected). 50