• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NCONF_get_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: NCONF_get_string

char *CONF_get_string(LHASH *conf,const char *group,const char *name)
  {
  if (conf == NULL)
    {
    return NCONF_get_string(NULL, group, name);
    }
  else
    {
    CONF ctmp;
    CONF_set_nconf(&ctmp, conf);
    return NCONF_get_string(&ctmp, group, name);
    }
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:13,代码来源:conf_lib.c


示例2: NCONF_get_string

static char *lookup_conf(const CONF *conf, const char *section, const char *tag)
{
    char *entry = NCONF_get_string(conf, section, tag);
    if (entry == NULL)
        BIO_printf(bio_err, "variable lookup failed for %s::%s\n", section, tag);
    return entry;
}
开发者ID:richsalz,项目名称:openssl,代码行数:7,代码来源:srp.c


示例3: GenerateX509Cert

static X509 *
GenerateX509Cert(X509_REQ *req,                  // IN
                 CONF *config,                   // IN
                 int days)                       // IN
{
   X509 *cert;
   X509V3_CTX ctx;
   char *extensions;
   gboolean ret = FALSE;
   gchar *err = NULL;

   cert = X509_new();
   if (!cert) {
      Error("Failed to allocate a X509 certificate: %s.\n",
            GetSSLError(&err));
      goto exit;
   }

   if (!SetCertSerialNumber(cert)) {
      goto exit;
   }

   if (!X509_set_issuer_name(cert, X509_REQ_get_subject_name(req))    ||
       !X509_gmtime_adj(X509_get_notBefore(cert), 0)                  ||
       !X509_gmtime_adj(X509_get_notAfter(cert), (long)60*60*24*days) ||
       !X509_set_subject_name(cert, X509_REQ_get_subject_name(req))) {
      Error("Failed to configure the X509 certificate: %s.\n",
            GetSSLError(&err));
      goto exit;
   }

   X509V3_set_ctx(&ctx, cert, cert, NULL, NULL, 0);
   X509V3_set_nconf(&ctx, config);

   extensions = NCONF_get_string(config, "req", "x509_extensions");
   if (extensions) {
      if (!X509_set_version(cert, 2)) {
         Error("Failed to set the certificate version: %s.\n",
               GetSSLError(&err));
         goto exit;
      }

      if (!X509V3_EXT_add_nconf(config, &ctx, extensions, cert)) {
         Error("Error loading extension section %s: %s.\n",
               extensions, GetSSLError(&err));
         goto exit;
      }
   }

   ret = TRUE;

exit:
   if (!ret) {
      X509_free(cert);
      cert = NULL;
   }
   g_free(err);

   return cert;
}
开发者ID:AlissonGiron,项目名称:open-vm-tools,代码行数:60,代码来源:cert_key.c


示例4: TS_CONF_set_policies

int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx)
{
    int ret = 0;
    int i;
    STACK_OF(CONF_VALUE) *list = NULL;
    char *policies = NCONF_get_string(conf, section, ENV_OTHER_POLICIES);

    /* If no other policy is specified, that's fine. */
    if (policies && (list = X509V3_parse_list(policies)) == NULL) {
        ts_CONF_invalid(section, ENV_OTHER_POLICIES);
        goto err;
    }
    for (i = 0; i < sk_CONF_VALUE_num(list); ++i) {
        CONF_VALUE *val = sk_CONF_VALUE_value(list, i);
        const char *extval = val->value ? val->value : val->name;
        ASN1_OBJECT *objtmp;

        if ((objtmp = OBJ_txt2obj(extval, 0)) == NULL) {
            ts_CONF_invalid(section, ENV_OTHER_POLICIES);
            goto err;
        }
        if (!TS_RESP_CTX_add_policy(ctx, objtmp))
            goto err;
        ASN1_OBJECT_free(objtmp);
    }

    ret = 1;
 err:
    sk_CONF_VALUE_pop_free(list, X509V3_conf_free);
    return ret;
}
开发者ID:1234-,项目名称:openssl,代码行数:31,代码来源:ts_conf.c


示例5: TS_CONF_set_digests

int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx)
{
    int ret = 0;
    int i;
    STACK_OF(CONF_VALUE) *list = NULL;
    char *digests = NCONF_get_string(conf, section, ENV_DIGESTS);
    if (!digests) {
        TS_CONF_lookup_fail(section, ENV_DIGESTS);
        goto err;
    }
    if (!(list = X509V3_parse_list(digests))) {
        TS_CONF_invalid(section, ENV_DIGESTS);
        goto err;
    }
    if (sk_CONF_VALUE_num(list) == 0) {
        TS_CONF_invalid(section, ENV_DIGESTS);
        goto err;
    }
    for (i = 0; i < sk_CONF_VALUE_num(list); ++i) {
        CONF_VALUE *val = sk_CONF_VALUE_value(list, i);
        const char *extval = val->value ? val->value : val->name;
        const EVP_MD *md;
        if (!(md = EVP_get_digestbyname(extval))) {
            TS_CONF_invalid(section, ENV_DIGESTS);
            goto err;
        }
        if (!TS_RESP_CTX_add_md(ctx, md))
            goto err;
    }

    ret = 1;
 err:
    sk_CONF_VALUE_pop_free(list, X509V3_conf_free);
    return ret;
}
开发者ID:bmeck,项目名称:openssl,代码行数:35,代码来源:ts_conf.c


示例6: do_generate

static int do_generate(BIO *bio, char *genstr, char *genconf, BUF_MEM *buf)
	{
	CONF *cnf = NULL;
	int len;
	long errline;
	unsigned char *p;
	ASN1_TYPE *atyp = NULL;

	if (genconf)
		{
		cnf = NCONF_new(NULL);
		if (!NCONF_load(cnf, genconf, &errline))
			goto conferr;
		if (!genstr)
			genstr = NCONF_get_string(cnf, "default", "asn1");
		if (!genstr)
			{
			BIO_printf(bio, "Can't find 'asn1' in '%s'\n", genconf);
			goto err;
			}
		}

	atyp = ASN1_generate_nconf(genstr, cnf);
	NCONF_free(cnf);

	if (!atyp)
		return -1;

	len = i2d_ASN1_TYPE(atyp, NULL);

	if (len <= 0)
		goto err;

	if (!BUF_MEM_grow(buf,len))
		goto err;

	p=(unsigned char *)buf->data;

	i2d_ASN1_TYPE(atyp, &p);

	ASN1_TYPE_free(atyp);
	return len;

	conferr:

	if (errline > 0)
		BIO_printf(bio, "Error on line %ld of config file '%s'\n",
							errline, genconf);
	else
		BIO_printf(bio, "Error loading config file '%s'\n", genconf);

	err:
	NCONF_free(cnf);
	ASN1_TYPE_free(atyp);

	return -1;

	}
开发者ID:0w,项目名称:moai-dev,代码行数:58,代码来源:asn1pars.c


示例7: NCONF_get_string

const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
{
    if (!section) {
        section = NCONF_get_string(conf, BASE_SECTION, ENV_DEFAULT_TSA);
        if (!section)
            ts_CONF_lookup_fail(BASE_SECTION, ENV_DEFAULT_TSA);
    }
    return section;
}
开发者ID:1234-,项目名称:openssl,代码行数:9,代码来源:ts_conf.c


示例8: ConfigX509CertReq

static gboolean
ConfigX509CertReq(X509_REQ *req,                 // OUT
                  CONF *config)                  // IN
{
   int idx;
   X509_NAME *subject;
   gboolean ret = FALSE;
   const char *dname;
   gchar *err = NULL;

   if (!X509_REQ_set_version(req, 0L)) {
      Error("Failed to set the certificate request version: %s.\n",
            GetSSLError(&err));
      goto exit;
   }

   subject = X509_REQ_get_subject_name(req);
   if (!subject) {
      Error("Failed to get the certificate request subject name: %s.\n",
            GetSSLError(&err));
      goto exit;
   }

   dname = NCONF_get_string(config, "req", "distinguished_name");
   if (dname) {
      STACK_OF(CONF_VALUE) *dn_sk = NCONF_get_section(config, dname);
      if (!dn_sk) {
         Error("Failed to get section %s: %s.\n",
               dname, GetSSLError(&err));
         goto exit;
      }

      for (idx = 0; idx < sk_CONF_VALUE_num(dn_sk); idx++) {
         CONF_VALUE *v = sk_CONF_VALUE_value(dn_sk, idx);

         if (!X509_NAME_add_entry_by_txt(subject, v->name, MBSTRING_ASC,
                                         v->value, -1, -1, 0)) {
            Error("Failed to set certificate request pair %s/%s: %s.\n",
                  v->name, v->value, GetSSLError(&err));
            goto exit;
         }
      }
   }

   ret = TRUE;

exit:
   g_free(err);
   return ret;
}
开发者ID:AlissonGiron,项目名称:open-vm-tools,代码行数:50,代码来源:cert_key.c


示例9: TS_CONF_set_serial

int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
                       TS_RESP_CTX *ctx)
{
    int ret = 0;
    char *serial = NCONF_get_string(conf, section, ENV_SERIAL);
    if (!serial) {
        ts_CONF_lookup_fail(section, ENV_SERIAL);
        goto err;
    }
    TS_RESP_CTX_set_serial_cb(ctx, cb, serial);

    ret = 1;
 err:
    return ret;
}
开发者ID:1234-,项目名称:openssl,代码行数:15,代码来源:ts_conf.c


示例10: TS_CONF_set_crypto_device

int TS_CONF_set_crypto_device(CONF *conf, const char *section,
                              const char *device)
{
    int ret = 0;

    if (device == NULL)
        device = NCONF_get_string(conf, section, ENV_CRYPTO_DEVICE);

    if (device && !TS_CONF_set_default_engine(device)) {
        ts_CONF_invalid(section, ENV_CRYPTO_DEVICE);
        goto err;
    }
    ret = 1;
 err:
    return ret;
}
开发者ID:1234-,项目名称:openssl,代码行数:16,代码来源:ts_conf.c


示例11: ts_CONF_add_flag

static int ts_CONF_add_flag(CONF *conf, const char *section,
                            const char *field, int flag, TS_RESP_CTX *ctx)
{
    const char *value = NCONF_get_string(conf, section, field);

    if (value) {
        if (strcmp(value, ENV_VALUE_YES) == 0)
            TS_RESP_CTX_add_flags(ctx, flag);
        else if (strcmp(value, ENV_VALUE_NO) != 0) {
            ts_CONF_invalid(section, field);
            return 0;
        }
    }

    return 1;
}
开发者ID:1234-,项目名称:openssl,代码行数:16,代码来源:ts_conf.c


示例12: do_generate

static int do_generate(char *genstr, const char *genconf, BUF_MEM *buf)
{
    CONF *cnf = NULL;
    int len;
    unsigned char *p;
    ASN1_TYPE *atyp = NULL;

    if (genconf) {
        if ((cnf = app_load_config(genconf)) == NULL)
            goto err;
        if (!genstr)
            genstr = NCONF_get_string(cnf, "default", "asn1");
        if (!genstr) {
            BIO_printf(bio_err, "Can't find 'asn1' in '%s'\n", genconf);
            goto err;
        }
    }

    atyp = ASN1_generate_nconf(genstr, cnf);
    NCONF_free(cnf);
    cnf = NULL;

    if (!atyp)
        return -1;

    len = i2d_ASN1_TYPE(atyp, NULL);

    if (len <= 0)
        goto err;

    if (!BUF_MEM_grow(buf, len))
        goto err;

    p = (unsigned char *)buf->data;

    i2d_ASN1_TYPE(atyp, &p);

    ASN1_TYPE_free(atyp);
    return len;

 err:
    NCONF_free(cnf);
    ASN1_TYPE_free(atyp);
    return -1;
}
开发者ID:Frrank1,项目名称:node,代码行数:45,代码来源:asn1pars.c


示例13: TS_CONF_add_flag

static int TS_CONF_add_flag(CONF *conf, const char *section, const char *field,
			    int flag, TS_RESP_CTX *ctx)
	{
	/* Default is false. */
	const char *value = NCONF_get_string(conf, section, field);
	if (value)
		{
		if (TINYCLR_SSL_STRCMP(value, ENV_VALUE_YES) == 0)
			TS_RESP_CTX_add_flags(ctx, flag);
		else if (TINYCLR_SSL_STRCMP(value, ENV_VALUE_NO) != 0)
			{
			TS_CONF_invalid(section, field);
			return 0;
			}
		}

	return 1;
	}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:18,代码来源:ts_conf.cpp


示例14: LoadOpenSSLConf

static CONF *
LoadOpenSSLConf(const gchar *fname)              // IN
{
   CONF *config;
   const char *mask;
   gboolean ret = FALSE;
   gchar *err = NULL;

   config = NCONF_new(NULL);
   if (!config) {
      Error("Failed to allocate the OpenSSL config.\n");
      goto exit;
   }

   if (!NCONF_load(config, fname, NULL)) {
      Error("Failed to load the configuration file %s: %s.\n",
            fname, GetSSLError(&err));
      goto exit;
   }

   OPENSSL_load_builtin_modules();

   if (!CONF_modules_load(config, NULL, 0)) {
      Error("Error configuring OpenSSL modules: %s.\n",
            GetSSLError(&err));
      goto exit;
   }

   mask = NCONF_get_string(config, "req", "string_mask");
   if (mask) {
      ASN1_STRING_set_default_mask_asc(mask);
   }

   ret = TRUE;

exit:
   if (!ret) {
      NCONF_free(config);
      config = NULL;
   }
   g_free(err);

   return config;
}
开发者ID:AlissonGiron,项目名称:open-vm-tools,代码行数:44,代码来源:cert_key.c


示例15: TS_CONF_set_signer_cert

int TS_CONF_set_signer_cert(CONF *conf, const char *section,
                            const char *cert, TS_RESP_CTX *ctx)
{
    int ret = 0;
    X509 *cert_obj = NULL;
    if (!cert)
        cert = NCONF_get_string(conf, section, ENV_SIGNER_CERT);
    if (!cert) {
        TS_CONF_lookup_fail(section, ENV_SIGNER_CERT);
        goto err;
    }
    if (!(cert_obj = TS_CONF_load_cert(cert)))
        goto err;
    if (!TS_RESP_CTX_set_signer_cert(ctx, cert_obj))
        goto err;

    ret = 1;
 err:
    X509_free(cert_obj);
    return ret;
}
开发者ID:bmeck,项目名称:openssl,代码行数:21,代码来源:ts_conf.c


示例16: populateConfig

static int populateConfig(void)
{
  certcfg_Property_t i;

  for (i = CERTCFG_ROOT_DIR; i < CERTCFG_MAX_PROPERTY ; i++)
    {
      char *str;
      /* zero all pointers so if there's no conf we dont' have
      ** bogus info */
      configObject.descStr[i] = '\0';

      str = NCONF_get_string(configObject.conf,
			     configObject.descStr[CERTCFG_CONFIG_NAME],
			     propertyNameList[i]);

      PRINT_CFG_STR_PROPS(i, str);
      CertCfgSetObjectStrValue(i, str);
      
      // no need to free as NCONF_get_string doesn't return a copy.
    }
  return 0;
}
开发者ID:openwebos,项目名称:pmcertificatemgr,代码行数:22,代码来源:cert_cfg.c


示例17: TS_CONF_set_signer_digest

int TS_CONF_set_signer_digest(CONF *conf, const char *section,
                              const char *md, TS_RESP_CTX *ctx)
{
    int ret = 0;
    const EVP_MD *sign_md = NULL;
    if (md == NULL)
        md = NCONF_get_string(conf, section, ENV_SIGNER_DIGEST);
    if (md == NULL) {
        ts_CONF_lookup_fail(section, ENV_SIGNER_DIGEST);
        goto err;
    }
    sign_md = EVP_get_digestbyname(md);
    if (sign_md == NULL) {
        ts_CONF_invalid(section, ENV_SIGNER_DIGEST);
        goto err;
    }
    if (!TS_RESP_CTX_set_signer_digest(ctx, sign_md))
        goto err;

    ret = 1;
 err:
    return ret;
}
开发者ID:1234-,项目名称:openssl,代码行数:23,代码来源:ts_conf.c


示例18: NCONF_get_number_e

int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
           long *result)
  {
  char *str;

  if (result == NULL)
    {
    CONFerr(CONF_F_NCONF_GET_NUMBER_E,ERR_R_PASSED_NULL_PARAMETER);
    return 0;
    }

  str = NCONF_get_string(conf,group,name);

  if (str == NULL)
    return 0;

  for (*result = 0;conf->meth->is_number(conf, *str);)
    {
    *result = (*result)*10 + conf->meth->to_int(conf, *str);
    str++;
    }

  return 1;
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:24,代码来源:conf_lib.c


示例19: app_load_config

static CONF *load_config_file(const char *configfile)
{
    CONF *conf = app_load_config(configfile);

    if (conf != NULL) {
        const char *p;

        BIO_printf(bio_err, "Using configuration from %s\n", configfile);
        p = NCONF_get_string(conf, NULL, ENV_OID_FILE);
        if (p != NULL) {
            BIO *oid_bio = BIO_new_file(p, "r");
            if (!oid_bio)
                ERR_print_errors(bio_err);
            else {
                OBJ_create_objects(oid_bio);
                BIO_free_all(oid_bio);
            }
        } else
            ERR_clear_error();
        if (!add_oid_section(conf))
            ERR_print_errors(bio_err);
    }
    return conf;
}
开发者ID:Beatzevo,项目名称:openssl,代码行数:24,代码来源:ts.c


示例20: MAIN


//.........这里部分代码省略.........
	if (!X509_STORE_set_default_paths(ctx))
		{
		ERR_print_errors(bio_err);
		goto end;
		}

	if ((CAkeyfile == NULL) && (CA_flag) && (CAformat == FORMAT_PEM))
		{ CAkeyfile=CAfile; }
	else if ((CA_flag) && (CAkeyfile == NULL))
		{
		BIO_printf(bio_err,"need to specify a CAkey if using the CA command\n");
		goto end;
		}

	if (extfile)
		{
		long errorline = -1;
		X509V3_CTX ctx2;
		extconf = NCONF_new(NULL);
		if (!NCONF_load(extconf, extfile,&errorline))
			{
			if (errorline <= 0)
				BIO_printf(bio_err,
					"error loading the config file '%s'\n",
								extfile);
                	else
                        	BIO_printf(bio_err,
				       "error on line %ld of config file '%s'\n"
							,errorline,extfile);
			goto end;
			}
		if (!extsect)
			{
			extsect = NCONF_get_string(extconf, "default", "extensions");
			if (!extsect)
				{
				ERR_clear_error();
				extsect = "default";
				}
			}
		X509V3_set_ctx_test(&ctx2);
		X509V3_set_nconf(&ctx2, extconf);
		if (!X509V3_EXT_add_nconf(extconf, &ctx2, extsect, NULL))
			{
			BIO_printf(bio_err,
				"Error Loading extension section %s\n",
								 extsect);
			ERR_print_errors(bio_err);
			goto end;
			}
		}


	if (reqfile)
		{
		EVP_PKEY *pkey;
		BIO *in;

		if (!sign_flag && !CA_flag)
			{
			BIO_printf(bio_err,"We need a private key to sign with\n");
			goto end;
			}
		in=BIO_new(BIO_s_file());
		if (in == NULL)
			{
开发者ID:0omega,项目名称:platform_external_openssl,代码行数:67,代码来源:x509.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NCONF_new函数代码示例发布时间:2022-05-30
下一篇:
C++ NCONF_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap