javacommons/security/src/utils/securityutils.cpp
changeset 26 dc7c549001d5
parent 21 2a9601315dfc
child 72 1f0034e370aa
equal deleted inserted replaced
23:98ccebc37403 26:dc7c549001d5
   492     }
   492     }
   493     // do the base64 decoding
   493     // do the base64 decoding
   494     authInfo->signature = new char[sig_len];
   494     authInfo->signature = new char[sig_len];
   495     BIO * b64 = BIO_new(BIO_f_base64());
   495     BIO * b64 = BIO_new(BIO_f_base64());
   496     BIO * mem = BIO_new_mem_buf((char *)sig, sig_len);
   496     BIO * mem = BIO_new_mem_buf((char *)sig, sig_len);
   497     if ((NULL == b64) || (NULL == mem))
   497     if (b64 && mem)
   498     {
   498     {    
   499         env->ReleaseStringUTFChars(signature,sig);
   499         BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
   500         delete[] jcert;
   500         BIO_set_close(b64, BIO_CLOSE);
   501         jcert = NULL;
   501         BIO_set_close(mem, BIO_CLOSE);
   502     }
   502         mem = BIO_push(b64, mem);
   503     BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
   503         authInfo->signature_len = BIO_read(mem, authInfo->signature, sig_len);
   504     BIO_set_close(b64, BIO_CLOSE);
   504         BIO_free_all(mem);
   505     BIO_set_close(mem, BIO_CLOSE);
   505     }
   506     mem = BIO_push(b64, mem);
       
   507     authInfo->signature_len = BIO_read(mem, authInfo->signature, sig_len);
       
   508     BIO_free_all(mem);
       
   509     env->ReleaseStringUTFChars(signature,sig);
   506     env->ReleaseStringUTFChars(signature,sig);
   510     delete[] jcert;
   507     delete[] jcert;
   511     jcert = NULL;
   508     jcert = NULL;
   512 }
   509 }
   513 
   510