您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BIO_get_mem_ptr函数代码示例

51自学网 2021-06-01 19:50:02
  C++
这篇教程C++ BIO_get_mem_ptr函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BIO_get_mem_ptr函数的典型用法代码示例。如果您正苦于以下问题:C++ BIO_get_mem_ptr函数的具体用法?C++ BIO_get_mem_ptr怎么用?C++ BIO_get_mem_ptr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BIO_get_mem_ptr函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: flatten_X509

struct X509_flat *flatten_X509(X509 *x){	struct X509_flat *out = NULL;	int ret;	BUF_MEM *bptr = NULL;	BIO *mem = NULL;	if (x == NULL) {		return NULL;	}	mem = BIO_new(BIO_s_mem());	if (mem == NULL) {		return NULL;	}	ret = PEM_write_bio_X509(mem, x);	if (ret == 0) {		BIO_free(mem);		return NULL;	}	out = new_X509_flat();	if (out == NULL)  {		BIO_free(mem);		return NULL;	}	BIO_get_mem_ptr(mem, &bptr);	assert(BIO_set_close(mem, BIO_NOCLOSE) == 1);	BIO_free(mem);	out->len = bptr->length;	if (bptr->length != 0	    && (size_t) bptr->length <= SIZE_MAX/sizeof(*(out->data))) {		out->data = malloc(bptr->length*sizeof(*(out->data)));	}	if (out->data == NULL) {		BUF_MEM_free(bptr);		return NULL;	}	memcpy(out->data, bptr->data, bptr->length);	BUF_MEM_free(bptr);	return out;}
开发者ID:Crashdowns,项目名称:phantom,代码行数:43,


示例2: encode_base64

char* encode_base64(unsigned char* data, size_t length) {    BIO *bmem, *b64;    BUF_MEM *bufmem;    b64 = BIO_new(BIO_f_base64());    bmem = BIO_new(BIO_s_mem());    b64 = BIO_push(b64, bmem);    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);    BIO_write(b64, data, length);    BIO_flush(b64);    BIO_get_mem_ptr(b64, &bufmem);    BIO_set_close(b64, BIO_NOCLOSE);    BIO_free_all(b64);    return bufmem->data;}
开发者ID:sfelton,项目名称:matasano,代码行数:19,


示例3: BIO_new

int utils::Base64Encode(const unsigned char* buffer, size_t length, char** b64text) { //Encodes a binary safe base 64 string	BIO *bio, *b64;	BUF_MEM *bufferPtr;	b64 = BIO_new(BIO_f_base64());	bio = BIO_new(BIO_s_mem());	bio = BIO_push(b64, bio);	BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL); //Ignore newlines - write everything in one line	BIO_write(bio, buffer, length);	BIO_flush(bio);	BIO_get_mem_ptr(bio, &bufferPtr);	BIO_set_close(bio, BIO_NOCLOSE);	BIO_free_all(bio);	*b64text=(*bufferPtr).data;	return (0); //success}
开发者ID:athongintel,项目名称:irm5-ec_crypto,代码行数:19,


示例4: LUA_FUNCTION

static LUA_FUNCTION(openssl_pkcs7_decrypt){  PKCS7 *p7 = CHECK_OBJECT(1, PKCS7, "openssl.pkcs7");  X509 *cert = CHECK_OBJECT(2, X509, "openssl.x509");  EVP_PKEY *key = CHECK_OBJECT(3, EVP_PKEY, "openssl.evp_pkey");  long flags = luaL_optint(L, 4, 0);  BIO *out = BIO_new(BIO_s_mem());  if (PKCS7_decrypt(p7, key, cert, out, flags))  {    BUF_MEM* mem;    BIO_get_mem_ptr(out, &mem);    lua_pushlstring(L, mem->data, mem->length);  }  else    lua_pushnil(L);  BIO_free(out);  return 1;}
开发者ID:Shaddy1884,项目名称:lua-openssl,代码行数:19,


示例5: b64_encode

//------------------------------------------------------------------------------// helper function to encode a vector of bytes to a base64 string:static std::string b64_encode(const std::vector<unsigned char>& data) {   BIO* b64 = BIO_new(BIO_f_base64());   BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);   BIO* bmem = BIO_new(BIO_s_mem());   b64 = BIO_push(b64, bmem);      BIO_write(b64, data.data(), data.size());   BIO_flush(b64);   BUF_MEM* bptr = NULL;   BIO_get_mem_ptr(b64, &bptr);      std::string output(bptr->data, bptr->length);   BIO_free_all(b64);   return output;}
开发者ID:CrazyCaptian,项目名称:Test,代码行数:21,


示例6: BIO_new

char *base64(const unsigned char *input, int length){	BIO *bmem, *b64;	BUF_MEM *bptr;	b64 = BIO_new(BIO_f_base64());	bmem = BIO_new(BIO_s_mem());	b64 = BIO_push(b64, bmem);	BIO_write(b64, input, length);	BIO_flush(b64);	BIO_get_mem_ptr(b64, &bptr);	char *buff = (char *)malloc(bptr->length);	memcpy(buff, bptr->data, bptr->length-1);	buff[bptr->length-1] = 0;	BIO_free_all(b64);	return buff;}
开发者ID:katmagic,项目名称:perspectives-notary-server,代码行数:19,


示例7: encode

passwand_error_t encode(const uint8_t *s, size_t len, char **e) {    assert(s != NULL);    assert(e != NULL);    if (len > (size_t)INT_MAX)        return PW_OVERFLOW;    /* Create a base64 filter. */    BIO *b64 __attribute__((cleanup(autobiofree))) = BIO_new(BIO_f_base64());    if (b64 == NULL)        return PW_NO_MEM;    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);    /* Create an in-memory sink to encode data into. */    BIO *out = BIO_new(BIO_s_mem());    if (out == NULL)        return PW_NO_MEM;    BIO *pipe __attribute__((cleanup(autobiofree))) = BIO_push(b64, out);    b64 = NULL;    /* Encode the data. */    if (BIO_write(pipe, s, len) != (int)len)        return PW_IO;    BIO_flush(pipe);    /* Extract it into a string. */    BUF_MEM *bptr;    BIO_get_mem_ptr(out, &bptr);    if (SIZE_MAX - 1 < bptr->length)        return PW_OVERFLOW;    *e = malloc(bptr->length + 1);    if (*e == NULL)        return PW_NO_MEM;    memcpy(*e, bptr->data, bptr->length);    (*e)[bptr->length] = '/0';    return PW_OK;}
开发者ID:Smattr,项目名称:passwand,代码行数:42,


示例8: base_64_encode

//Function to use openssl to do BASE64 encodingstatic bool base_64_encode(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t *out_size){    BIO* bioMem = NULL;    bool ret = false;    BIO *bio64 = NULL;    BIO_METHOD *bm = BIO_f_base64();    if(bm == NULL)        goto ret_point;    bio64 = BIO_new(bm);    if(bio64 == NULL)         goto ret_point;    BIO_set_flags(bio64, BIO_FLAGS_BASE64_NO_NL);    bm = BIO_s_mem();    if(bm == NULL)        goto ret_point;    bioMem = BIO_new(bm);    if(bioMem == NULL)        goto ret_point;   (void)BIO_push(bio64, bioMem);    if(BIO_write(bio64, in_buf, in_size) != (int)in_size){        goto ret_point;    }    (void)BIO_flush(bio64);    BUF_MEM *bptr;    BIO_get_mem_ptr(bio64, &bptr);    if(bptr==NULL){        goto ret_point;    }    if(*out_size < bptr->length){        goto ret_point;    }    if(memcpy_s(out_buf, *out_size,bptr->data, bptr->length)!=0)        goto ret_point;            *out_size = static_cast<uint32_t>(bptr->length);    ret = true;ret_point:    BIO_free_all(bio64);//we need not free bioMem too because the free_all has free it.    return ret;}
开发者ID:0-T-0,项目名称:linux-sgx,代码行数:43,


示例9: BIO_new

// ============================================================================std::string Crypto::base64(const std::vector<uint8_t>& input){    BIO *bmem, *b64;    BUF_MEM* bptr;    std::string result;    b64 = BIO_new(BIO_f_base64());    bmem = BIO_new(BIO_s_mem());    b64 = BIO_push(b64, bmem);    BIO_set_flags(bmem, BIO_FLAGS_BASE64_NO_NL);    BIO_write(b64, input.data(), (int)input.size());    BIO_flush(b64);    BIO_get_mem_ptr(b64, &bptr);    result.resize(bptr->length - 1);    memcpy(&result[0], bptr->data, bptr->length - 1);    BIO_free_all(b64);    return result;}   // base64
开发者ID:qwertychouskie,项目名称:stk-code,代码行数:21,


示例10: base64_encode

static int base64_encode(char *str,int str_len,char *encode,int encode_len){      BIO *bmem,*b64;      BUF_MEM *bptr;      b64=BIO_new(BIO_f_base64());      bmem=BIO_new(BIO_s_mem());      b64=BIO_push(b64,bmem);      BIO_write(b64,str,str_len); //encode      BIO_flush(b64);      BIO_get_mem_ptr(b64,&bptr);     if(bptr->length>encode_len){         oss_log_write("encode_len too small/n");         return -1;      }        encode_len=bptr->length;     memcpy(encode,bptr->data,bptr->length); //  write(1,encode,bptr->length);     BIO_free_all(b64);     return encode_len;}
开发者ID:xuanya4202,项目名称:aliyun_oss,代码行数:20,


示例11: encodeBase64

gchar* encodeBase64(gchar *input, gint length) {    BIO *b64 = BIO_new(BIO_f_base64());    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);    BIO *bmem = BIO_new(BIO_s_mem());    b64 = BIO_push(b64, bmem);    BIO_write(b64, input, length);    BIO_flush(b64);    BUF_MEM *buffer;    BIO_get_mem_ptr(b64, &buffer);    gchar *data = g_malloc(buffer->length);    memcpy(data, buffer->data, buffer->length - 1);    data[buffer->length - 1] = 0;    BIO_free_all(b64);    return data;}
开发者ID:houzhenggang,项目名称:openwrt-ar9331,代码行数:20,


示例12: BIO_new

char *Base64::encode(const char *input, int size){    BIO *bmem, *b64;    BUF_MEM *bptr;    b64 = BIO_new(BIO_f_base64());    bmem = BIO_new(BIO_s_mem());    b64 = BIO_push(b64, bmem);    BIO_write(b64, input, size);    BIO_flush(b64);    BIO_get_mem_ptr(b64, &bptr);    char *buff = (char *)Memory::Alloc(bptr->length);    memcpy(buff, bptr->data, bptr->length-1);    buff[bptr->length-1] = 0;    BIO_free_all(b64);    return buff;}
开发者ID:WizKid,项目名称:FriBID-windows,代码行数:20,


示例13: BIO_new

static char *base64(char *str, size_t *len) {        BIO *b64, *bmem;        BUF_MEM *bptr;        b64 = BIO_new(BIO_f_base64());        bmem = BIO_new(BIO_s_mem());        b64 = BIO_push(b64, bmem);        BIO_write(b64, str, *len);        BIO_flush(b64);        BIO_get_mem_ptr(b64, &bptr);        char *buf = malloc(bptr->length-1);        memcpy(buf, bptr->data, bptr->length-1);        *len = bptr->length-1;        BIO_free_all(b64);        return buf;}
开发者ID:20tab,项目名称:blastbeat,代码行数:20,


示例14: SSL_write

std::streamsize Connection::write(const char* buf, std::size_t n){    std::streambuf* sb = _ios->rdbuf();    if( ! sb)        return 0;    std::streamsize written = SSL_write(_ssl, buf, n);    log_debug("encrypted " << written << " bytes");    BUF_MEM* bm = 0;    BIO_get_mem_ptr(_out, &bm);    if(bm->length > 0)    {        sb->sputn(bm->data, bm->length);        log_debug("wrote " << bm->length << " bytes to output");        bm->length = 0;    }    return written;}
开发者ID:3Nigma,项目名称:frayon,代码行数:20,


示例15: codec_base64_encode

/** * BASE64编码 * * LUA示例: * local codec = require('codec') * local bs = [[...]] --源内容 * local result = codec.base64_encode(bs) */static int codec_base64_encode(lua_State *L){    size_t len;    const char *bs = luaL_checklstring(L, 1, &len);    BIO *b64 = BIO_new(BIO_f_base64());    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);    BIO *bio = BIO_new(BIO_s_mem());    bio = BIO_push(b64, bio);    BIO_write(bio, bs, len);    BIO_flush(bio);    BUF_MEM *p;    BIO_get_mem_ptr(bio, &p);    int n = p->length;    char dst[n];    memcpy(dst, p->data, n);    BIO_free_all(bio);    lua_pushlstring(L, dst, n);    return 1;}
开发者ID:mashijie,项目名称:lua-codec,代码行数:28,


示例16: openssl_ssl_session_export

static int openssl_ssl_session_export(lua_State*L){  SSL_SESSION* session = CHECK_OBJECT(1, SSL_SESSION, "openssl.ssl_session");  int pem = lua_isnoneornil(L, 2) ? 1 : auxiliar_checkboolean(L, 2);  BIO* bio = BIO_new(BIO_s_mem());  BUF_MEM *bio_buf;  if (pem)  {    PEM_write_bio_SSL_SESSION(bio, session);  }  else  {    i2d_SSL_SESSION_bio(bio, session);  }  BIO_get_mem_ptr(bio, &bio_buf);  lua_pushlstring(L, bio_buf->data, bio_buf->length);  BIO_free(bio);  return 1;}
开发者ID:witchu,项目名称:lua-openssl,代码行数:20,


示例17: crypto_pk_write_key_to_string_impl

/** Helper function to implement crypto_pk_write_*_key_to_string. */int crypto_pk_write_key_to_string_impl(crypto_pk_t *env, char **dest,                                   size_t *len, int is_public){    BUF_MEM *buf;    BIO *b;    int r;//    assert(env);//    assert(env->key);//    assert(dest);    b = BIO_new(BIO_s_mem()); /* Create a memory BIO */    if (!b)        return -1;    /* Now you can treat b as if it were a file.  Just use the     * PEM_*_bio_* functions instead of the non-bio variants.     */    if (is_public)        r = PEM_write_bio_RSAPublicKey(b, env->key);    else        r = PEM_write_bio_RSAPrivateKey(b, env->key, NULL,NULL,0,NULL,NULL);    if (!r) {        err(1, "writing RSA key to string");        BIO_free(b);        return -1;    }    BIO_get_mem_ptr(b, &buf);    (void)BIO_set_close(b, BIO_NOCLOSE); /* so BIO_free doesn't free buf */    BIO_free(b);    *dest = sgx_malloc(buf->length+1);    sgx_memcpy(*dest, buf->data, buf->length);    (*dest)[buf->length] = 0; /* nul terminate it */    *len = buf->length;    BUF_MEM_free(buf);    return 0;}
开发者ID:johnjohnsp1,项目名称:opensgx,代码行数:42,


示例18: BIO_new

char *bin2Base64PlusSlashEqualsMultiLine(const unsigned char *input, int length){// from http://www.ioncannon.net/programming/34/howto-base64-encode-with-cc-and-openssl/  BIO *bmem, *b64;  BUF_MEM *bptr;  b64 = BIO_new(BIO_f_base64());  bmem = BIO_new(BIO_s_mem());  b64 = BIO_push(b64, bmem);  BIO_write(b64, input, length);  BIO_flush(b64);  BIO_get_mem_ptr(b64, &bptr);  char *buff = (char *)malloc(bptr->length);  memcpy(buff, bptr->data, bptr->length-1);  buff[bptr->length-1] = 0;  BIO_free_all(b64);  return buff;}
开发者ID:2i3r,项目名称:PBKDF2-GCC-OpenSSL-library,代码行数:21,


示例19: BIO_new

/** 	dsa_get_ppk	Returns a dynamically allocated string like the following:		-----BEGIN PUBLIC KEY-----	...Some, uh, public key...	-----END PUBLIC KEY-----		or NULL on error.  Note that the pointer is dynamically allocated.*/char *dsa_get_ppk(){        BIO *fsu = BIO_new(BIO_s_mem());        BUF_MEM *buf;        char *realbuf = NULL;	if(fsu == NULL)		return NULL;        PEM_write_bio_DSA_PUBKEY(fsu, probe);        BIO_flush(fsu);        BIO_get_mem_ptr(fsu, &buf);	if((realbuf = malloc(53 + buf->length)) != NULL) {        	memcpy(realbuf, buf->data, buf->length);        	realbuf[buf->length] = '/0';	}	BIO_free(fsu);	return realbuf;}
开发者ID:pete,项目名称:freenote-probe,代码行数:31,


示例20: BIO_new

char* CryptoHandler::base64encode(const unsigned char *input, const int& length){	BIO *bmem, *b64;	BUF_MEM *bptr;	b64 = BIO_new(BIO_f_base64());	BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);	bmem = BIO_new(BIO_s_mem());	b64 = BIO_push(b64, bmem);	BIO_write(b64, input, length);	BIO_flush(b64);	BIO_get_mem_ptr(b64, &bptr);	char *buff = (char *)malloc(bptr->length);	memcpy(buff, bptr->data, bptr->length-1);	buff[bptr->length-1] = 0;	BIO_free_all(b64);	return buff;}
开发者ID:GYGit,项目名称:ffead-cpp,代码行数:21,


示例21: BIO_new

char *base64_enc(uint8_t *input, int length) {  BIO *bmem, *b64;  BUF_MEM *bptr;  b64 = BIO_new(BIO_f_base64());  bmem = BIO_new(BIO_s_mem());  b64 = BIO_push(b64, bmem);  BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);  BIO_write(b64, input, length);  BIO_flush(b64);  BIO_get_mem_ptr(b64, &bptr);  char *buf = (char *)malloc(bptr->length);  if (bptr->length) {    memcpy(buf, bptr->data, bptr->length - 1);    buf[bptr->length - 1] = 0;  }  BIO_free_all(bmem);  return buf;}
开发者ID:Havelock-Vetinari,项目名称:shairport-sync,代码行数:21,


示例22: extract_sub_name

/* * Trivial utility function to extract the string * value of the subject name from a cert. */static void extract_sub_name (X509 *cert, char *name, int len){    X509_NAME *subject_nm;    BIO *out;    BUF_MEM *bm;    subject_nm = X509_get_subject_name(cert);    out = BIO_new(BIO_s_mem());    X509_NAME_print_ex(out, subject_nm, 0, XN_FLAG_SEP_SPLUS_SPC);    BIO_get_mem_ptr(out, &bm);    strncpy(name, bm->data, len);    if (bm->length < len) {        name[bm->length] = 0;    } else {        name[len] = 0;    }    BIO_free(out);}
开发者ID:StephenWall,项目名称:libest,代码行数:25,


示例23: base64_encode

void base64_encode(unsigned char *input, int length,char *output, int *output_len){	BIO *bmem, *b64;	BUF_MEM *bptr;	char *buff;			b64 = BIO_new(BIO_f_base64());	BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);	bmem = BIO_new(BIO_s_mem());	b64 = BIO_push(b64, bmem);	BIO_write(b64, input, length);	BIO_flush(b64);	BIO_get_mem_ptr(b64, &bptr);		//buff = (char *)malloc(bptr->length);	memcpy(output, bptr->data, bptr->length);	output[bptr->length] = 0;		*output_len = bptr->length;			BIO_free_all(b64);}
开发者ID:noikiy,项目名称:shopexts,代码行数:21,


示例24: ossl_x509crl_get_signature_algorithm

static VALUE ossl_x509crl_get_signature_algorithm(VALUE self){    X509_CRL *crl;    BIO *out;    BUF_MEM *buf;    VALUE str;    GetX509CRL(self, crl);    if (!(out = BIO_new(BIO_s_mem()))) {	ossl_raise(eX509CRLError, NULL);    }    if (!i2a_ASN1_OBJECT(out, crl->sig_alg->algorithm)) {	BIO_free(out);	ossl_raise(eX509CRLError, NULL);    }    BIO_get_mem_ptr(out, &buf);    str = rb_str_new(buf->data, buf->length);    BIO_free(out);    return str;}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:21,


示例25: base64encode

/*This function will Base-64 encode your data.*/char * base64encode (const void *b64_encode_me, int encode_this_many_bytes){	BIO *b64_bio, *mem_bio;   //Declare two BIOs.  One base64 encodes, the other stores memory.	BUF_MEM *mem_bio_mem_ptr; //Pointer to the "memory BIO" structure holding the base64 data.		b64_bio = BIO_new(BIO_f_base64());  //Initialize our base64 filter BIO.	mem_bio = BIO_new(BIO_s_mem());  //Initialize our memory sink BIO.	BIO_push(b64_bio, mem_bio);  //Link the BIOs (i.e. create a filter-sink BIO chain.)	BIO_set_flags(b64_bio, BIO_FLAGS_BASE64_NO_NL);  //Don't add a newline every 64 characters.		BIO_write(b64_bio, b64_encode_me, encode_this_many_bytes); //Encode and write our b64 data.	BIO_flush(b64_bio);  //Flush data.  Necessary for b64 encoding, because of pad characters.		BIO_get_mem_ptr(mem_bio, &mem_bio_mem_ptr);  //Store address of mem_bio's memory structure.	BIO_set_close(mem_bio,BIO_NOCLOSE); //Permit access to mem_ptr after BIOs are destroyed.	BIO_free_all(b64_bio);  //Destroys all BIOs in chain, starting with b64 (i.e. the 1st one).		(*mem_bio_mem_ptr).data[(*mem_bio_mem_ptr).length] = '/0';  //Adds a null-terminator.		return (*mem_bio_mem_ptr).data; //Returns base-64 encoded data. (See: "buf_mem_st" struct).}
开发者ID:jamella,项目名称:matasano,代码行数:22,


示例26: assert

int SocketClient::pinCertCallback(int pok, X509_STORE_CTX *ctx){    std::cout << "Checking pinned certificate" << std::endl;    X509 *cert = NULL;    BIO *b64 = NULL;    BUF_MEM *bptr = NULL;    char *szCert = NULL;    cert = ctx->current_cert;    assert(cert != NULL);    b64 = BIO_new(BIO_s_mem());    assert(b64 != NULL);    assert(1 == PEM_write_bio_X509(b64, cert));    BIO_get_mem_ptr(b64, &bptr);    assert(NULL != (szCert = (char*)malloc(bptr->length + 1)));    assert(0 < BIO_read(b64, szCert, bptr->length));    int ret = strncmp(szCert, AUTH_CERTIFICATE, strlen(AUTH_CERTIFICATE));    free(szCert);    if (b64)    {        BIO_free(b64);    }    if(ret == 0)    {        std::cout << "pinned certificate verification passed..." << std::endl;        return 1;    }    else    {        std::cout << "pinned certificate verification failed..." << std::endl;        return 0;    }}
开发者ID:marcb1,项目名称:ssl_socket,代码行数:40,


示例27: int

PKI_MEM *PKI_MEM_new_func_bio ( void *obj, int (*func)(BIO *, void *) ) {	BIO *bio_mem = NULL;	PKI_MEM *ret = NULL;	BUF_MEM *bio_mem_ptr = NULL;	int i = 0;	size_t size = 0;	if (!obj || !func ) {		return NULL;	}	if(( bio_mem = BIO_new(BIO_s_mem())) == NULL ) {		return NULL;	}	// fprintf( stderr, "BIO=>%p -- OBJ=>%p/n", bio_mem, obj );	if((i = func( bio_mem, obj )) <= 0 ) {		return NULL;	}	BIO_get_mem_ptr( bio_mem, &bio_mem_ptr );	if ( bio_mem_ptr == NULL ) {		if( bio_mem ) BIO_free ( bio_mem );		return ( NULL );	}	/* Adds the data to the return PKI_MEM */	size = (size_t) bio_mem_ptr->length;	ret = PKI_MEM_new_data( size, (unsigned char *) bio_mem_ptr->data);	/* Closes the BIO and frees the memory */	if( bio_mem ) BIO_free ( bio_mem );	return ( ret );}
开发者ID:Brenhilt,项目名称:libpki,代码行数:40,


示例28: ossl_x509crl_to_text

static VALUE ossl_x509crl_to_text(VALUE self){    X509_CRL *crl;    BIO *out;    BUF_MEM *buf;    VALUE str;    GetX509CRL(self, crl);    if (!(out = BIO_new(BIO_s_mem()))) {	ossl_raise(eX509CRLError, NULL);    }    if (!X509_CRL_print(out, crl)) {	BIO_free(out);	ossl_raise(eX509CRLError, NULL);    }    BIO_get_mem_ptr(out, &buf);    str = rb_str_new(buf->data, buf->length);    BIO_free(out);	    return str;}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:22,



注:本文中的BIO_get_mem_ptr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BIO_get_ssl函数代码示例
C++ BIO_get_mem_data函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。