Subversion Repositories oidplus

Rev

Rev 1400 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1400 Rev 1467
Line 30... Line 30...
30
                }
30
                }
31
 
31
 
32
 
32
 
33
                do {
33
                do {
34
                        var candidate = current_aid == "" ? "F" : current_aid; // category "F" = Unregistered Proprietary AID
34
                        var candidate = current_aid == "" ? "F" : current_aid; // category "F" = Unregistered Proprietary AID
-
 
35
                        var newStuff = "";
35
                        for ( var i = 0 ; i < aid_max_len - candidate.length ; i++ ) {
36
                        for ( var i = 0 ; i < aid_max_len - candidate.length ; i++ ) {
36
                                candidate += characters.charAt(Math.floor(Math.random() * characters.length));
37
                                newStuff += characters.charAt(Math.floor(Math.random() * characters.length));
37
                        }
38
                        }
-
 
39
                        candidate += newStuff;
38
 
40
 
39
                        var isPrefixOfExistingAIDs = false;
41
                        var isPrefixOfExistingAIDs = false;
40
                        var currentExistingAIDs = [];
42
                        var currentExistingAIDs = [];
41
                        var dummy = null;
43
                        var dummy = null;
42
                        var element = null;
44
                        var element = null;
Line 58... Line 60...
58
                                return;
60
                                return;
59
                        }
61
                        }
60
                } while (isPrefixOfExistingAIDs || ((candidate.endsWith('FF') && (candidate.length==aid_max_len))));
62
                } while (isPrefixOfExistingAIDs || ((candidate.endsWith('FF') && (candidate.length==aid_max_len))));
61
 
63
 
62
                // Note that 16 byte AIDs ending with 0xFF *were* reserved by ISO in ISO 7816-4:1994,
64
                // Note that 16 byte AIDs ending with 0xFF *were* reserved by ISO in ISO 7816-4:1994,
63
                // but modern versions of ISO 7816-4 and ISO 7816-4 do not mention this case anymore.
65
                // but modern versions of ISO 7816-4 and ISO 7816-5 do not mention this case anymore.
64
                // It can be assumed that the usage is safe, but just to be sure, we exclude 16-byte
66
                // It can be assumed that the usage is safe, but just to be sure, we exclude 16-byte
65
                // AIDs ending with 0xFF, in case there are some software implementations which
67
                // AIDs ending with 0xFF, in case there are some software implementations which
66
                // deny such AIDs.
68
                // deny such AIDs.
67
 
69
 
-
 
70
                // Absolute:
68
                $("#id").val(candidate);
71
                //$("#id").val(candidate);
-
 
72
                // Relative:
-
 
73
                $("#id").val(candidate.substring(current_aid.length));
69
        }
74
        }
70
 
75
 
71
};
76
};