Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
27068df7
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
8
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
27068df7
编写于
2月 15, 2003
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Single pass processing to cleartext S/MIME signing.
上级
b12753df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
82 addition
and
20 deletion
+82
-20
CHANGES
CHANGES
+11
-0
apps/smime.c
apps/smime.c
+9
-3
crypto/pkcs7/pk7_mime.c
crypto/pkcs7/pk7_mime.c
+49
-7
crypto/pkcs7/pk7_smime.c
crypto/pkcs7/pk7_smime.c
+12
-10
crypto/pkcs7/pkcs7.h
crypto/pkcs7/pkcs7.h
+1
-0
未找到文件。
CHANGES
浏览文件 @
27068df7
...
...
@@ -4,6 +4,17 @@
Changes between 0.9.7a and 0.9.8 [xx XXX xxxx]
*) Support for single pass processing for S/MIME signing. This now
means that S/MIME signing can be done from a pipe, in addition
cleartext signing (multipart/signed type) is effectively streaming
and the signed data does not need to be all held in memory.
This is done with a new flag PKCS7_PARTSIGN. When this flag is set
PKCS7_sign() only initializes the PKCS7 structure and the actual signing
is done after the data is output (and digests calculated) in
SMIME_write_PKCS7().
[Steve Henson]
*) Add full support for -rpath/-R, both in shared libraries and
applications, at least on the platforms where it's known how
to do it.
...
...
apps/smime.c
浏览文件 @
27068df7
/* smime.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project
1999
.
* project.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999
-2003
The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -478,8 +478,14 @@ int MAIN(int argc, char **argv)
if
(
operation
==
SMIME_ENCRYPT
)
{
p7
=
PKCS7_encrypt
(
encerts
,
in
,
cipher
,
flags
);
}
else
if
(
operation
==
SMIME_SIGN
)
{
/* If detached data and SMIME output enable partial
* signing.
*/
if
((
flags
&
PKCS7_DETACHED
)
&&
(
outformat
==
FORMAT_SMIME
))
flags
|=
PKCS7_PARTSIGN
;
p7
=
PKCS7_sign
(
signer
,
key
,
other
,
in
,
flags
);
if
(
BIO_reset
(
in
)
!=
0
&&
(
flags
&
PKCS7_DETACHED
))
{
/* Don't need to rewind for partial signing */
if
(
!
(
flags
&
PKCS7_PARTSIGN
)
&&
(
BIO_reset
(
in
)
!=
0
))
{
BIO_printf
(
bio_err
,
"Can't rewind input file
\n
"
);
goto
end
;
}
...
...
crypto/pkcs7/pk7_mime.c
浏览文件 @
27068df7
/* pk7_mime.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project
1999
.
* project.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999
-2003
The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -86,6 +86,7 @@ STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */
DECLARE_STACK_OF
(
MIME_HEADER
)
IMPLEMENT_STACK_OF
(
MIME_HEADER
)
static
int
pkcs7_output_data
(
BIO
*
bio
,
BIO
*
data
,
PKCS7
*
p7
,
int
flags
);
static
int
B64_write_PKCS7
(
BIO
*
bio
,
PKCS7
*
p7
);
static
PKCS7
*
B64_read_PKCS7
(
BIO
*
bio
);
static
char
*
strip_ends
(
char
*
name
);
...
...
@@ -150,7 +151,6 @@ static PKCS7 *B64_read_PKCS7(BIO *bio)
int
SMIME_write_PKCS7
(
BIO
*
bio
,
PKCS7
*
p7
,
BIO
*
data
,
int
flags
)
{
char
linebuf
[
MAX_SMLEN
];
char
bound
[
33
],
c
;
int
i
;
if
((
flags
&
PKCS7_DETACHED
)
&&
data
)
{
...
...
@@ -171,9 +171,9 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
BIO_printf
(
bio
,
"This is an S/MIME signed message
\n\n
"
);
/* Now write out the first part */
BIO_printf
(
bio
,
"------%s
\r\n
"
,
bound
);
if
(
flags
&
PKCS7_TEXT
)
BIO_printf
(
bio
,
"Content-Type: text/plain
\n\n
"
);
while
((
i
=
BIO_read
(
data
,
linebuf
,
MAX_SMLEN
))
>
0
)
BIO_write
(
bio
,
linebuf
,
i
);
pkcs7_output_data
(
bio
,
data
,
p7
,
flags
);
BIO_printf
(
bio
,
"
\n
------%s
\n
"
,
bound
);
/* Headers for signature */
...
...
@@ -195,6 +195,47 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags)
return
1
;
}
/* Handle output of PKCS#7 data */
static
int
pkcs7_output_data
(
BIO
*
out
,
BIO
*
data
,
PKCS7
*
p7
,
int
flags
)
{
BIO
*
tmpbio
,
*
p7bio
;
if
(
!
(
flags
&
PKCS7_PARTSIGN
))
{
SMIME_crlf_copy
(
data
,
out
,
flags
);
return
1
;
}
/* Partial sign operation */
/* Initialize sign operation */
p7bio
=
PKCS7_dataInit
(
p7
,
out
);
/* Copy data across, computing digests etc */
SMIME_crlf_copy
(
data
,
p7bio
,
flags
);
/* Must be detached */
PKCS7_set_detached
(
p7
,
1
);
/* Finalize signatures */
PKCS7_dataFinal
(
p7
,
p7bio
);
/* Now remove any digests from output BIO */
while
(
1
)
{
tmpbio
=
BIO_pop
(
p7bio
);
if
(
tmpbio
==
out
)
break
;
BIO_free
(
tmpbio
);
}
return
1
;
}
/* SMIME reader: handle multipart/signed and opaque signing.
* in multipart case the content is placed in a memory BIO
* pointed to by "bcont". In opaque this is set to NULL
...
...
@@ -314,7 +355,8 @@ int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
BIO_write
(
out
,
linebuf
,
len
);
return
1
;
}
if
(
flags
&
PKCS7_TEXT
)
BIO_printf
(
out
,
"Content-Type: text/plain
\r\n\r\n
"
);
if
(
flags
&
PKCS7_TEXT
)
BIO_printf
(
out
,
"Content-Type: text/plain
\r\n\r\n
"
);
while
((
len
=
BIO_gets
(
in
,
linebuf
,
MAX_SMLEN
))
>
0
)
{
eol
=
0
;
while
(
iscrlf
(
linebuf
[
len
-
1
]))
{
...
...
crypto/pkcs7/pk7_smime.c
浏览文件 @
27068df7
/* pk7_smime.c */
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
* project
1999
.
* project.
*/
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
* Copyright (c) 1999
-2003
The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -97,14 +97,6 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
PKCS7_add_certificate
(
p7
,
sk_X509_value
(
certs
,
i
));
}
if
(
!
(
p7bio
=
PKCS7_dataInit
(
p7
,
NULL
)))
{
PKCS7err
(
PKCS7_F_PKCS7_SIGN
,
ERR_R_MALLOC_FAILURE
);
return
NULL
;
}
SMIME_crlf_copy
(
data
,
p7bio
,
flags
);
if
(
!
(
flags
&
PKCS7_NOATTR
))
{
PKCS7_add_signed_attribute
(
si
,
NID_pkcs9_contentType
,
V_ASN1_OBJECT
,
OBJ_nid2obj
(
NID_pkcs7_data
));
...
...
@@ -133,6 +125,16 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
}
}
if
(
flags
&
PKCS7_PARTSIGN
)
return
p7
;
if
(
!
(
p7bio
=
PKCS7_dataInit
(
p7
,
NULL
)))
{
PKCS7err
(
PKCS7_F_PKCS7_SIGN
,
ERR_R_MALLOC_FAILURE
);
return
NULL
;
}
SMIME_crlf_copy
(
data
,
p7bio
,
flags
);
if
(
flags
&
PKCS7_DETACHED
)
PKCS7_set_detached
(
p7
,
1
);
if
(
!
PKCS7_dataFinal
(
p7
,
p7bio
))
{
...
...
crypto/pkcs7/pkcs7.h
浏览文件 @
27068df7
...
...
@@ -260,6 +260,7 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
#define PKCS7_BINARY 0x80
#define PKCS7_NOATTR 0x100
#define PKCS7_NOSMIMECAP 0x200
#define PKCS7_PARTSIGN 0x400
/* Flags: for compatibility with older code */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录