Hi Alexei,

 I guess you use SuSe :) What I'm interested in is line 45 of
your signForm.js like this: "theForm.signature.value = signedText;".
Because on my debian woody machine, mozilla v.1.5 complains about that
line, it accept it only in this form: "theForm.signature = signedText;",
but in this case, approveCSR command receives no signature field. I'll
try to backoff to mozilla v.1.0 which is default in Woody.

Try to install Mozilla from the Mozilla.org webpage - I did so and I dont think that mozillas behaviour is different on Suse and Deb...

What version of OpenCa do you use ? Perhaps there is a Bug in the form itself, I use 0.9.1-1 but I think I modified the HTML page a little bit.

Can u give ma access to your RA - then I will try it

Oliver

here is my signForm:

<!--

function signForm(theForm, theWindow){
        if (navigator.appName == "Netscape"){
                signFormN(theForm, theWindow);
        } else {
                signFormIE(theForm,theWindow);
        }
        theForm.submit();
}

function signFormN(theForm, theWindow) {
  var signedText;

var sObject;
var result;
try {
alert ('Testing for SecCLAB Plugin.');
sObject = new CLABSignString();
alert ('Using SecCLAB Plugin.');
if (sObject == undefined) alert('SecCLAB Plugin failed.');
var status = {value:0};
var len = {value:0};
try {
result = sObject.signString(window,theForm.text.value,theForm.text.value.length,status,len);
if (status.value != sObject.STATUS_OK) {
alert("Aborted by user or no valid user certificate");
return false;
}
} catch(ex) {
alert("Aborted by user or no valid user certificate");
return false;
}
signedText = base64_2_pem (String2Base64(result)); //String2Hex(result);
} catch(ex) {
alert ('Using integrated Javascript object crypto.');
signedText = theWindow.crypto.signText(theForm.text.value, "ask");
}

  if ( signedText.length < 100 ) {
    alert( "Sign is needed to proceed!" );
    return false;
  }

  theForm.signature.value = signedText;
}

function base64_2_pem (base64)
{
  var pem = "";
  for (var i=0;i < base64.length;i++)
  {
    pem = pem + base64.charAt(i);
    if (63 == (i % 64))
    {
        pem = pem + "\n";
    }
  }
  return pem;
}

function Hex(v)
{
  var hexstring="0123456789ABCDEF";
  return hexstring[v];
}

function String2Hex(str){
  var s = "";
  var hnible;
  var lnible;
  for (var i=0;i < str.length;i++){
    hnible = Hex(str.charCodeAt(i) >> 4);
    lnible = Hex(str.charCodeAt(i) & 0x0f);
    s = s + hnible + lnible;
  }
  return s;
}

function base64ToAscii(c)
{
        var theChar = 0;
        
        if (0 <= c && c <= 25)
        {
                theChar = String.fromCharCode(c + 65);
        }
        else if (26 <= c && c <= 51)
        {
                theChar = String.fromCharCode(c - 26 + 97);
        }
        else if (52 <= c && c <= 61)
        {
                theChar = String.fromCharCode(c - 52 + 48);
        }
        else if (c == 62)
        {
                theChar = '+';
        }
        else if( c == 63 )
        {
                theChar = '/';
        }
        else
        {
                theChar = String.fromCharCode(0xFF);
        }

        return theChar;
}


function String2Base64(str) { var result = ""; var i = 0; var sextet = 0; var leftovers = 0; var octet = 0;

        for (i=0; i < str.length; i++) {
                octet = str.charCodeAt(i);
                switch( i % 3 )
                {
                        case 0:
                        {
                                sextet = ( octet & 0xFC ) >> 2 ;
                                leftovers = octet & 0x03 ;

                                // sextet contains first character in quadruple
                                break;
                        }

                        case 1:
                        {
                                sextet = ( leftovers << 4 ) | ( ( octet & 0xF0 ) >> 4 
);
                                leftovers = octet & 0x0F ;

                                // sextet contains 2nd character in quadruple
                                break;
                        }

                        case 2:
                        {
                                sextet = ( leftovers << 2 ) | ( ( octet & 0xC0 ) >> 6 
) ;
                                leftovers = ( octet & 0x3F ) ;

                                // sextet contains third character in quadruple
                                // leftovers contains fourth character in quadruple
                                break;
                        }
                }

result = result + base64ToAscii(sextet);

                // don't forget about the fourth character if it is there
                if( (i % 3) == 2 )
                {
                        result = result + base64ToAscii(leftovers);
                }

}

        // figure out what to do with leftovers and padding
        switch( str.length % 3 )
        {
                case 0:
                {
                        // an even multiple of 3, nothing left to do
                        break ;
                }
                case 1:
                {
                        // one 6-bit chars plus 2 leftover bits
                        leftovers =  leftovers << 4 ;
                        result = result + base64ToAscii(leftovers);
                        result = result + "==";
                        break ;
                }
                case 2:
                {
                        // two 6-bit chars plus 4 leftover bits
                        leftovers = leftovers << 2 ;
                        result = result + base64ToAscii(leftovers);
                        result = result + "=";
                        break ;
                }
        }

        return result;
}

// -->




-- Diese Nachricht wurde digital unterschrieben oliwel's public key: http://www.oliwel.de/oliwel.crt Basiszertifikat: http://www.ldv.ei.tum.de/page72

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to