dear all
i have just made a code to make a certificate request from a node and my
certificate authority reply with the certificate
the node has attributes as below
   X509_REQ   *x;
   EVP_PKEY   *prk;
   EVP_PKEY   *puk;
   X509        m_myCert;
   //RSA structure contain both private and public key
   RSA        *rsa_keyPair;
   X509_NAME  *name;
the function which made the certificate request is
  X509_REQ*
  AeroRoutingProtocol :: MakeSignedCertReq (int bits, int serial, int days)
  {
    X509_REQ_set_pubkey(x,puk);
    name=X509_REQ_get_subject_name(x);
    // it gives errors i don't knoe why????
    //X509_NAME_add_entry_by_txt(name,"C",MBSTRING_ASC, "UK", -1, -1, 0);
    //X509_NAME_add_entry_by_txt(name,"CN",MBSTRING_ASC, "OpenSSL Group",
-1, -1, 0);
    X509_REQ_sign(x,puk,EVP_md5());
    return x;
  }
the certificate authority receive this request and reply by the certificate
the function that make certificate as below

 X509*
 CertificateAuthority :: CreateCertificate (X509 *issuer, X509_REQ *req,
RSA *key )
 {
    X509 *cert = NULL;
    int rv;
    X509_NAME *xn_req = NULL, *subject = NULL;
    EVP_PKEY *pkey = NULL;

    //create the certificate
    X509 * x509;
    x509 = X509_new();
    X509_NAME *issuerSubject = X509_get_subject_name(issuer);
    X509_set_issuer_name(cert, issuerSubject);
    xn_req = X509_REQ_get_subject_name(req);
    X509_set_subject_name(cert, subject);
    pkey = X509_REQ_get_pubkey(req);
    rv = X509_set_pubkey(cert, pkey);
    X509_gmtime_adj(X509_get_notBefore(cert), 0);
    X509_gmtime_adj(X509_get_notAfter(cert), 36400);
    signCertificateWithKey(cert, key);
    return cert;
 }

when i compile i got this error
../src/aerorp/model/certificate-authority.cc: In member function ‘X509*
ns3::AeroRP::CertificateAuthority::CreateCertificate(X509*, X509_REQ*,
RSA*)’:
../src/aerorp/model/certificate-authority.cc:58:37: error:
‘signCertificateWithKey’ was not declared in this scope

thanks allot for help

-- 
Warmest regards and best wishes for a good health,*urs sincerely *
*mero*

Reply via email to