Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
3cbb7937
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
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看板
提交
3cbb7937
编写于
6月 05, 1999
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add d2i,i2d bio and fp functions for PKCS#8 and add -inform and -outform
arguments to pkcs8 application.
上级
600dec15
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
90 addition
and
4 deletion
+90
-4
apps/pkcs8.c
apps/pkcs8.c
+26
-4
crypto/x509/x509.h
crypto/x509/x509.h
+10
-0
crypto/x509/x_all.c
crypto/x509/x_all.c
+54
-0
未找到文件。
apps/pkcs8.c
浏览文件 @
3cbb7937
...
...
@@ -72,6 +72,7 @@ int MAIN(int argc, char **argv)
int
topk8
=
0
;
int
pbe_nid
=
-
1
;
int
iter
=
PKCS12_DEFAULT_ITER
;
int
informat
,
outformat
;
int
p8_broken
=
PKCS8_OK
;
X509_SIG
*
p8
;
PKCS8_PRIV_KEY_INFO
*
p8inf
;
...
...
@@ -79,11 +80,23 @@ int MAIN(int argc, char **argv)
char
pass
[
50
];
int
badarg
=
0
;
if
(
bio_err
==
NULL
)
bio_err
=
BIO_new_fp
(
stderr
,
BIO_NOCLOSE
);
informat
=
FORMAT_PEM
;
outformat
=
FORMAT_PEM
;
ERR_load_crypto_strings
();
SSLeay_add_all_algorithms
();
args
=
argv
+
1
;
while
(
!
badarg
&&
*
args
&&
*
args
[
0
]
==
'-'
)
{
if
(
!
strcmp
(
*
args
,
"-topk8"
))
topk8
=
1
;
if
(
!
strcmp
(
*
args
,
"-inform"
))
{
if
(
args
[
1
])
{
args
++
;
informat
=
str2fmt
(
*
args
);
}
else
badarg
=
1
;
}
else
if
(
!
strcmp
(
*
args
,
"-outform"
))
{
if
(
args
[
1
])
{
args
++
;
outformat
=
str2fmt
(
*
args
);
}
else
badarg
=
1
;
}
else
if
(
!
strcmp
(
*
args
,
"-topk8"
))
topk8
=
1
;
else
if
(
!
strcmp
(
*
args
,
"-noiter"
))
iter
=
1
;
else
if
(
!
strcmp
(
*
args
,
"-nooct"
))
p8_broken
=
PKCS8_NO_OCTET
;
else
if
(
!
strcmp
(
*
args
,
"-in"
))
{
...
...
@@ -114,7 +127,7 @@ int MAIN(int argc, char **argv)
if
(
pbe_nid
==
-
1
)
pbe_nid
=
NID_pbeWithMD5AndDES_CBC
;
if
(
infile
)
{
if
(
!
(
in
=
BIO_new_file
(
infile
,
"r"
)))
{
if
(
!
(
in
=
BIO_new_file
(
infile
,
"r
b
"
)))
{
BIO_printf
(
bio_err
,
"Can't open input file %s
\n
"
,
infile
);
return
(
1
);
...
...
@@ -122,7 +135,7 @@ int MAIN(int argc, char **argv)
}
else
in
=
BIO_new_fp
(
stdin
,
BIO_NOCLOSE
);
if
(
outfile
)
{
if
(
!
(
out
=
BIO_new_file
(
outfile
,
"w"
)))
{
if
(
!
(
out
=
BIO_new_file
(
outfile
,
"w
b
"
)))
{
BIO_printf
(
bio_err
,
"Can't open output file %s
\n
"
,
outfile
);
return
(
1
);
...
...
@@ -154,7 +167,16 @@ int MAIN(int argc, char **argv)
return
(
0
);
}
if
(
!
(
p8
=
PEM_read_bio_PKCS8
(
in
,
NULL
,
NULL
)))
{
if
(
informat
==
FORMAT_PEM
)
p8
=
PEM_read_bio_PKCS8
(
in
,
NULL
,
NULL
);
else
if
(
informat
==
FORMAT_ASN1
)
p8
=
d2i_PKCS8_bio
(
in
,
NULL
);
else
{
BIO_printf
(
bio_err
,
"Bad input format specified for key
\n
"
);
return
(
1
);
}
if
(
!
p8
)
{
BIO_printf
(
bio_err
,
"Error reading key
\n
"
,
outfile
);
ERR_print_errors
(
bio_err
);
return
(
1
);
...
...
crypto/x509/x509.h
浏览文件 @
3cbb7937
...
...
@@ -581,6 +581,11 @@ int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa);
#ifndef NO_DSA
DSA
*
d2i_DSAPrivateKey_fp
(
FILE
*
fp
,
DSA
**
dsa
);
int
i2d_DSAPrivateKey_fp
(
FILE
*
fp
,
DSA
*
dsa
);
X509_SIG
*
d2i_PKCS8_fp
(
FILE
*
fp
,
X509_SIG
**
p8
);
int
i2d_PKCS8_fp
(
FILE
*
fp
,
X509_SIG
*
p8
);
PKCS8_PRIV_KEY_INFO
*
d2i_PKCS8_PRIV_KEY_INFO_fp
(
FILE
*
fp
,
PKCS8_PRIV_KEY_INFO
**
p8inf
);
int
i2d_PKCS8_PRIV_KEY_INFO_fp
(
FILE
*
fp
,
PKCS8_PRIV_KEY_INFO
*
p8inf
);
#endif
#endif
...
...
@@ -600,6 +605,11 @@ int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa);
#ifndef NO_DSA
DSA
*
d2i_DSAPrivateKey_bio
(
BIO
*
bp
,
DSA
**
dsa
);
int
i2d_DSAPrivateKey_bio
(
BIO
*
bp
,
DSA
*
dsa
);
X509_SIG
*
d2i_PKCS8_bio
(
BIO
*
bp
,
X509_SIG
**
p8
);
int
i2d_PKCS8_bio
(
BIO
*
bp
,
X509_SIG
*
p8
);
PKCS8_PRIV_KEY_INFO
*
d2i_PKCS8_PRIV_KEY_INFO_bio
(
BIO
*
bp
,
PKCS8_PRIV_KEY_INFO
**
p8inf
);
int
i2d_PKCS8_PRIV_KEY_INFO_bio
(
BIO
*
bp
,
PKCS8_PRIV_KEY_INFO
*
p8inf
);
#endif
#endif
...
...
crypto/x509/x_all.c
浏览文件 @
3cbb7937
...
...
@@ -381,3 +381,57 @@ int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, EVP_MD *type,
(
char
*
)
data
,
md
,
len
));
}
#ifndef NO_FP_API
X509_SIG
*
d2i_PKCS8_fp
(
FILE
*
fp
,
X509_SIG
**
p8
)
{
return
((
X509_SIG
*
)
ASN1_d2i_fp
((
char
*
(
*
)())
X509_SIG_new
,
(
char
*
(
*
)())
d2i_X509_SIG
,
(
fp
),(
unsigned
char
**
)(
p8
)));
}
int
i2d_PKCS8_fp
(
FILE
*
fp
,
X509_SIG
*
p8
)
{
return
(
ASN1_i2d_fp
(
i2d_X509_SIG
,
fp
,(
unsigned
char
*
)
p8
));
}
#endif
X509_SIG
*
d2i_PKCS8_bio
(
BIO
*
bp
,
X509_SIG
**
p8
)
{
return
((
X509_SIG
*
)
ASN1_d2i_bio
((
char
*
(
*
)())
X509_SIG_new
,
(
char
*
(
*
)())
d2i_X509_SIG
,
(
bp
),(
unsigned
char
**
)(
p8
)));
}
int
i2d_PKCS8_bio
(
BIO
*
bp
,
X509_SIG
*
p8
)
{
return
(
ASN1_i2d_bio
(
i2d_X509_SIG
,
bp
,(
unsigned
char
*
)
p8
));
}
#ifndef NO_FP_API
PKCS8_PRIV_KEY_INFO
*
d2i_PKCS8_PRIV_KEY_INFO_fp
(
FILE
*
fp
,
PKCS8_PRIV_KEY_INFO
**
p8inf
)
{
return
((
PKCS8_PRIV_KEY_INFO
*
)
ASN1_d2i_fp
(
(
char
*
(
*
)())
PKCS8_PRIV_KEY_INFO_new
,
(
char
*
(
*
)())
d2i_PKCS8_PRIV_KEY_INFO
,
(
fp
),
(
unsigned
char
**
)(
p8inf
)));
}
int
i2d_PKCS8_PRIV_KEY_INFO_fp
(
FILE
*
fp
,
PKCS8_PRIV_KEY_INFO
*
p8inf
)
{
return
(
ASN1_i2d_fp
(
i2d_PKCS8_PRIV_KEY_INFO
,
fp
,(
unsigned
char
*
)
p8inf
));
}
#endif
PKCS8_PRIV_KEY_INFO
*
d2i_PKCS8_PRIV_KEY_INFO_bio
(
BIO
*
bp
,
PKCS8_PRIV_KEY_INFO
**
p8inf
)
{
return
((
PKCS8_PRIV_KEY_INFO
*
)
ASN1_d2i_bio
(
(
char
*
(
*
)())
PKCS8_PRIV_KEY_INFO_new
,
(
char
*
(
*
)())
d2i_PKCS8_PRIV_KEY_INFO
,
(
bp
),
(
unsigned
char
**
)(
p8inf
)));
}
int
i2d_PKCS8_PRIV_KEY_INFO_bio
(
BIO
*
bp
,
PKCS8_PRIV_KEY_INFO
*
p8inf
)
{
return
(
ASN1_i2d_bio
(
i2d_PKCS8_PRIV_KEY_INFO
,
bp
,(
unsigned
char
*
)
p8inf
));
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录