From:             imm at reasoningmind dot org
Operating system: Linux
PHP version:      5.2.6
PHP Bug Type:     OpenSSL related
Bug description:  openssl_csr_new puts extraattribs in wrong place of CSR

Description:
------------
I'm trying to add extra attributes to CSR and I expect them in Attributes
section. This is req_attributes section of openssl config. But function
allways puts them into the Subject.
IMHO, this is not right becausee subject defined in first argument and
because there is no way to add extra attributes.


Reproduce code:
---------------
$csr = openssl_csr_new(
    $this->dn,
    $this->pkey_bin,
    array(
        "digest_alg" => "sha1",
        "private_key_bits" => 2048,
        "req_extensions" => "v3_req",
        "x509_extensions" => "usr_cert",
    );
    array(
        'challengePassword' => 'passwd',
        'principalName' => 'DER:65726e6573744077696e2e6365726e2e6368',
    )
);


Expected result:
----------------
Certificate Request:
    Data:
        Version: 0 (0x0)
        Subject: C=US, ST=Texas, L=Houston, O=Example Inc, OU=RMStuff,
CN=Test User/[EMAIL PROTECTED]
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (2048 bit)
                Modulus (2048 bit):
                    00:cc:15:67:32:6a:2b:ad:5e:71:e6:48:22:f9:76:
                    <...skip...>
                    eb:5e:9e:e0:1b:13:b0:93:cf:d5:02:c2:6d:f2:1e:
                    e2:83
                Exponent: 65537 (0x10001)
        Attributes:
            chalengePassword  passwd
            principalName :DER:65726e6573744077696e2e6365726e2e6368
        Requested Extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            X509v3 Key Usage: 
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Extended Key Usage: 
                clientAuthentication, smartCardLogon


Actual result:
--------------
Certificate Request:
    Data:
        Version: 0 (0x0)
        Subject: C=US, ST=Texas, L=Houston, O=Example Inc, OU=RMStuff,
CN=Test
User/[EMAIL 
PROTECTED]/challengePassword=passwd/principalName=DER:65726e6573744077696e2e6365726e2e6368
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (2048 bit)
                Modulus (2048 bit):
                    00:cc:15:67:32:6a:2b:ad:5e:71:e6:48:22:f9:76:
                    <...skip...>
                    eb:5e:9e:e0:1b:13:b0:93:cf:d5:02:c2:6d:f2:1e:
                    e2:83
                Exponent: 65537 (0x10001)
        Attributes:
        Requested Extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            X509v3 Key Usage: 
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Extended Key Usage: 
                clientAuthentication, smartCardLogon


-- 
Edit bug report at http://bugs.php.net/?id=45076&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45076&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45076&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45076&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45076&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45076&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45076&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45076&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45076&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45076&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45076&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45076&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45076&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45076&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45076&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45076&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45076&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45076&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45076&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45076&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45076&r=mysqlcfg

Reply via email to