Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
f25825c2
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f25825c2
编写于
8月 13, 2015
作者:
R
Rich Salz
提交者:
Rich Salz
8月 13, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix FAQ formatting for new website.
Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
ac63710a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
16 addition
and
10 deletion
+16
-10
FAQ
FAQ
+16
-10
未找到文件。
FAQ
浏览文件 @
f25825c2
...
@@ -861,22 +861,25 @@ with the i2d_*_bio() or d2i_*_bio() functions or you can use the
...
@@ -861,22 +861,25 @@ with the i2d_*_bio() or d2i_*_bio() functions or you can use the
i2d_*(), d2i_*() functions directly. Since these are often the
i2d_*(), d2i_*() functions directly. Since these are often the
cause of grief here are some code fragments using PKCS7 as an example:
cause of grief here are some code fragments using PKCS7 as an example:
----- snip:start -----
unsigned char *buf, *p;
unsigned char *buf, *p;
int len;
int len
= i2d_PKCS7(p7, NULL)
;
len = i2d_PKCS7(p7, NULL);
buf = OPENSSL_malloc(len); /* error checking omitted */
buf = OPENSSL_malloc(len); /* or Malloc, error checking omitted */
p = buf;
p = buf;
i2d_PKCS7(p7, &p);
i2d_PKCS7(p7, &p);
----- snip:end -----
At this point buf contains the len bytes of the DER encoding of
At this point buf contains the len bytes of the DER encoding of
p7.
p7.
The opposite assumes we already have len bytes in buf:
The opposite assumes we already have len bytes in buf:
unsigned char *p;
----- snip:start -----
p = buf;
unsigned char *p = buf;
p7 = d2i_PKCS7(NULL, &p, len);
p7 = d2i_PKCS7(NULL, &p, len);
----- snip:end -----
At this point p7 contains a valid PKCS7 structure or NULL if an error
At this point p7 contains a valid PKCS7 structure or NULL if an error
occurred. If an error occurred ERR_print_errors(bio) should give more
occurred. If an error occurred ERR_print_errors(bio) should give more
...
@@ -893,14 +896,17 @@ because it no longer points to the same address.
...
@@ -893,14 +896,17 @@ because it no longer points to the same address.
Memory allocation and encoding can also be combined in a single
Memory allocation and encoding can also be combined in a single
operation by the ASN1 routines:
operation by the ASN1 routines:
unsigned char *buf = NULL; /* mandatory */
----- snip:start -----
int len;
unsigned char *buf = NULL;
len = i2d_PKCS7(p7, &buf);
int len = i2d_PKCS7(p7, &buf);
if (len < 0)
if (len < 0) {
/* Error */
/* Error */
}
/* Do some things with 'buf' */
/* Do some things with 'buf' */
/* Finished with buf: free it */
/* Finished with buf: free it */
OPENSSL_free(buf);
OPENSSL_free(buf);
----- snip:end -----
In this special case the "buf" parameter is *not* incremented, it points
In this special case the "buf" parameter is *not* incremented, it points
to the start of the encoding.
to the start of the encoding.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录