From: Graham B. <gb...@us...> - 2003-05-06 12:40:36
|
Update of /cvsroot/perl-ldap/asn/lib/Convert/ASN1 In directory sc8-pr-cvs1:/tmp/cvs-serv12187/lib/Convert/ASN1 Modified Files: parser.pm Log Message: CER and DER SET encoding Index: parser.pm =================================================================== RCS file: /cvsroot/perl-ldap/asn/lib/Convert/ASN1/parser.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- parser.pm 19 Aug 2002 23:51:38 -0000 1.9 +++ parser.pm 6 May 2003 12:40:32 -0000 1.10 @@ -706,6 +706,17 @@ ;# Here we need to flatten CHOICEs and check that SET and CHOICE ;# do not contain duplicate tags ;#} + if ($op->[cTYPE] == opSET) { + ;# In case we do CER encoding we order the SET elements by thier tags + my @tags = map { + length($_->[cTAG]) + ? $_->[cTAG] + : $_->[cTYPE] == opCHOICE + ? (sort map { $_->[cTAG] } $_->[cCHILD])[0] + : '' + } @{$op->[cCHILD]}; + @{$op->[cCHILD]} = @{$op->[cCHILD]}[sort { $tags[$a] cmp $tags[$b] } 0..$#tags]; + } } else { ;# A SET of one element can be treated the same as a SEQUENCE |