Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
d9f5f07e
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
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看板
提交
d9f5f07e
编写于
3月 14, 2008
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Initial support for Encrypted Data type generation.
上级
b31db9ee
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
2 deletion
+31
-2
apps/cms.c
apps/cms.c
+11
-0
crypto/cms/cms.h
crypto/cms/cms.h
+4
-0
crypto/cms/cms_enc.c
crypto/cms/cms_enc.c
+15
-2
crypto/cms/cms_lib.c
crypto/cms/cms_lib.c
+1
-0
未找到文件。
apps/cms.c
浏览文件 @
d9f5f07e
...
...
@@ -87,6 +87,7 @@ static int smime_cb(int ok, X509_STORE_CTX *ctx);
#define SMIME_UNCOMPRESS (11 | SMIME_IP)
#define SMIME_COMPRESS (12 | SMIME_OP)
#define SMIME_ENCRYPTED_DECRYPT (13 | SMIME_IP)
#define SMIME_ENCRYPTED_ENCRYPT (14 | SMIME_OP)
int
MAIN
(
int
,
char
**
);
...
...
@@ -169,6 +170,8 @@ int MAIN(int argc, char **argv)
operation
=
SMIME_UNCOMPRESS
;
else
if
(
!
strcmp
(
*
args
,
"-EncryptedData_decrypt"
))
operation
=
SMIME_ENCRYPTED_DECRYPT
;
else
if
(
!
strcmp
(
*
args
,
"-EncryptedData_encrypt"
))
operation
=
SMIME_ENCRYPTED_ENCRYPT
;
#ifndef OPENSSL_NO_DES
else
if
(
!
strcmp
(
*
args
,
"-des3"
))
cipher
=
EVP_des_ede3_cbc
();
...
...
@@ -745,6 +748,14 @@ int MAIN(int argc, char **argv)
flags
|=
CMS_STREAM
;
cms
=
CMS_encrypt
(
encerts
,
in
,
cipher
,
flags
);
}
else
if
(
operation
==
SMIME_ENCRYPTED_ENCRYPT
)
{
if
(
indef
)
flags
|=
CMS_STREAM
;
cms
=
CMS_EncryptedData_encrypt
(
in
,
cipher
,
secret_key
,
secret_keylen
,
flags
);
}
else
if
(
operation
&
SMIME_SIGNERS
)
{
int
i
;
...
...
crypto/cms/cms.h
浏览文件 @
d9f5f07e
...
...
@@ -142,6 +142,10 @@ int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
const
unsigned
char
*
key
,
size_t
keylen
,
BIO
*
dcont
,
BIO
*
out
,
unsigned
int
flags
);
CMS_ContentInfo
*
CMS_EncryptedData_encrypt
(
BIO
*
in
,
const
EVP_CIPHER
*
cipher
,
const
unsigned
char
*
key
,
size_t
keylen
,
unsigned
int
flags
);
int
CMS_EncryptedData_set1_key
(
CMS_ContentInfo
*
cms
,
const
EVP_CIPHER
*
ciph
,
const
unsigned
char
*
key
,
size_t
keylen
);
...
...
crypto/cms/cms_enc.c
浏览文件 @
d9f5f07e
...
...
@@ -75,6 +75,8 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
X509_ALGOR
*
calg
=
ec
->
contentEncryptionAlgorithm
;
unsigned
char
iv
[
EVP_MAX_IV_LENGTH
],
*
piv
=
NULL
;
int
ok
=
0
;
int
enc
;
enc
=
ec
->
cipher
?
1
:
0
;
...
...
@@ -90,7 +92,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
BIO_get_cipher_ctx
(
b
,
&
ctx
);
if
(
enc
)
c
alg
->
algorithm
=
OBJ_nid2obj
(
EVP_CIPHER_CTX_type
(
ctx
))
;
c
iph
=
ec
->
cipher
;
else
{
ciph
=
EVP_get_cipherbyobj
(
calg
->
algorithm
);
...
...
@@ -110,6 +112,9 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
goto
err
;
}
if
(
enc
)
calg
->
algorithm
=
OBJ_nid2obj
(
EVP_CIPHER_CTX_type
(
ctx
));
/* If necessary set key length */
if
(
ec
->
keylen
!=
EVP_CIPHER_CTX_key_length
(
ctx
))
...
...
@@ -164,9 +169,17 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec)
goto
err
;
}
}
return
b
;
ok
=
1
;
err:
if
(
ec
->
key
)
{
OPENSSL_cleanse
(
ec
->
key
,
ec
->
keylen
);
OPENSSL_free
(
ec
->
key
);
ec
->
key
=
NULL
;
}
if
(
ok
)
return
b
;
BIO_free
(
b
);
return
NULL
;
}
...
...
crypto/cms/cms_lib.c
浏览文件 @
d9f5f07e
...
...
@@ -180,6 +180,7 @@ int CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
{
case
NID_pkcs7_data
:
case
NID_pkcs7_encrypted
:
case
NID_id_smime_ct_compressedData
:
/* Nothing to do */
return
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录