From: Graham B. <gb...@us...> - 2003-05-06 12:40:36
|
Update of /cvsroot/perl-ldap/asn In directory sc8-pr-cvs1:/tmp/cvs-serv12187 Modified Files: parser.y Log Message: CER and DER SET encoding Index: parser.y =================================================================== RCS file: /cvsroot/perl-ldap/asn/parser.y,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- parser.y 19 Aug 2002 23:51:37 -0000 1.8 +++ parser.y 6 May 2003 12:40:32 -0000 1.9 @@ -364,6 +364,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 |