openssl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Barmala

    openssl

    Hi,

    if I feed a certificate to openssl_x509_pa rse($smimepubli ckey), the
    returned array contains
    ....
    [purposes] => Array
    ...
    [4] => Array
    (
    [0] => 1
    [1] =>
    [2] => smimesign
    )
    ....

    but when I feed the same cert to

    openssl_x509_ch eckpurpose($smi mepublickey, X509_PURPOSE_SM IME_SIGN) I
    get "0" ("false") as return value. These two results contradict each
    other, so either this is a bug in PHP or I overlooked an important
    detail. Can anyone comment?




    Here is the code to reproduce the error:

    <?php
    $smimepublickey =<<<END
    -----BEGIN CERTIFICATE-----
    GIICnzCCAgigAwI BAgIDDraxMA1GCS qGSIb3DQEBBAUAM GIxCzAJBgNVBAYT AlpD
    ....
    AQET
    -----END CERTIFICATE-----
    END;

    echo("<pre>\n") ;
    print_r(openssl _x509_parse($sm imepublickey));
    echo("</pre>\n");
    print(openssl_x 509_checkpurpos e($smimepublick ey, X509_PURPOSE_SM IME_SIGN));
    ?>

    Christian
Working...