Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
a331a305
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
8 个月 前同步成功
通知
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 搜索 >>
提交
a331a305
编写于
5月 04, 2000
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make PKCS#12 code handle missing passwords.
Add a couple of FAQs.
上级
316e6a66
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
81 addition
and
24 deletion
+81
-24
CHANGES
CHANGES
+13
-0
FAQ
FAQ
+22
-5
apps/pkcs12.c
apps/pkcs12.c
+8
-3
crypto/evp/evp_pbe.c
crypto/evp/evp_pbe.c
+2
-1
crypto/evp/p5_crpt.c
crypto/evp/p5_crpt.c
+3
-0
crypto/evp/p5_crpt2.c
crypto/evp/p5_crpt2.c
+2
-1
crypto/pkcs12/p12_key.c
crypto/pkcs12/p12_key.c
+15
-7
crypto/pkcs12/p12_kiss.c
crypto/pkcs12/p12_kiss.c
+15
-3
crypto/pkcs12/p12_mutl.c
crypto/pkcs12/p12_mutl.c
+1
-4
未找到文件。
CHANGES
浏览文件 @
a331a305
...
...
@@ -4,6 +4,19 @@
Changes between 0.9.5a and 0.9.6 [xx XXX 2000]
*) Make PKCS#12 code work with no password. The PKCS#12 spec
is a little unclear about how a blank password is handled.
Since the password in encoded as a BMPString with terminating
double NULL a zero length password would end up as just the
double NULL. However no password at all is different and is
handled differently in the PKCS#12 key generation code. NS
treats a blank password as zero length. MSIE treats it as no
password on export: but it will try both on import. We now do
the same: PKCS12_parse() tries zero length and no password if
the password is set to "" or NULL (NULL is now a valid password:
it wasn't before) as does the pkcs12 application.
[Steve Henson]
*) Bugfixes in apps/x509.c: Avoid a memory leak; and don't use
perror when PEM_read_bio_X509_REQ fails, the error message must
be obtained from the error queue.
...
...
FAQ
浏览文件 @
a331a305
...
...
@@ -16,8 +16,10 @@ OpenSSL - Frequently Asked Questions
*
How do I create certificates or certificate requests?
*
Why can't I create certificate requests?
*
Why does <SSL program> fail with a certificate verify error?
*
Why can I only use weak ciphers when I connect to a server using OpenSSL?
*
How can I create DSA certificates?
*
Why can't I make an SSL connection using a DSA certificate?
*
How can I remove the passphrase on a private key?
*
Why can't the OpenSSH configure script detect OpenSSL?
...
...
@@ -232,6 +234,13 @@ or file and the relevant program configured to read it. The OpenSSL program
the verify(1) program manual page for more information.
*
Why can I only use weak ciphers when I connect to a server using OpenSSL?
This is almost certainly because you are using an old "export grade" browser
which only supports weak encryption. Upgrade your browser to support 128 bit
ciphers.
*
How can I create DSA certificates?
Check the CA.pl(1) manual page for a DSA certificate example.
...
...
@@ -242,11 +251,19 @@ Check the CA.pl(1) manual page for a DSA certificate example.
Typically you'll see a message saying there are no shared ciphers when
the same setup works fine with an RSA certificate. There are two possible
causes. The client may not support connections to DSA servers most web
browsers only support connections to servers supporting RSA cipher suites.
The other cause is that a set of DH parameters has not been supplied to
the server. DH parameters can be created with the dhparam(1) command and
loaded using the SSL_CTX_set_tmp_dh() for example: check the source to
s_server in apps/s_server.c for an example.
browsers (including Netscape and MSIE) only support connections to servers
supporting RSA cipher suites. The other cause is that a set of DH parameters
has not been supplied to the server. DH parameters can be created with the
dhparam(1) command and loaded using the SSL_CTX_set_tmp_dh() for example:
check the source to s_server in apps/s_server.c for an example.
*
How can I remove the passphrase on a private key?
Firstly you should be really *really* sure you want to do this. Leaving
a private key unencrypted is a major security risk. If you decide that
you do have to do this check the EXAMPLES sections of the rsa(1) and
dsa(1) manual pages.
*
Why can't the OpenSSH configure script detect OpenSSL?
...
...
apps/pkcs12.c
浏览文件 @
a331a305
...
...
@@ -528,11 +528,16 @@ int MAIN(int argc, char **argv)
#ifdef CRYPTO_MDEBUG
CRYPTO_push_info
(
"verify MAC"
);
#endif
if
(
!
PKCS12_verify_mac
(
p12
,
mpass
,
-
1
))
{
/* If we enter empty password try no password first */
if
(
!
macpass
[
0
]
&&
PKCS12_verify_mac
(
p12
,
NULL
,
0
))
{
/* If mac and crypto pass the same set it to NULL too */
if
(
!
twopass
)
cpass
=
NULL
;
}
else
if
(
!
PKCS12_verify_mac
(
p12
,
mpass
,
-
1
))
{
BIO_printf
(
bio_err
,
"Mac verify error: invalid password?
\n
"
);
ERR_print_errors
(
bio_err
);
goto
end
;
}
else
BIO_printf
(
bio_err
,
"MAC verified OK
\n
"
);
}
BIO_printf
(
bio_err
,
"MAC verified OK
\n
"
);
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info
();
#endif
...
...
@@ -549,9 +554,9 @@ int MAIN(int argc, char **argv)
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info
();
#endif
PKCS12_free
(
p12
);
ret
=
0
;
end:
PKCS12_free
(
p12
);
if
(
export_cert
||
inrand
)
app_RAND_write_file
(
NULL
,
bio_err
);
#ifdef CRYPTO_MDEBUG
CRYPTO_remove_all_info
();
...
...
crypto/evp/evp_pbe.c
浏览文件 @
a331a305
...
...
@@ -92,7 +92,8 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
ERR_add_error_data
(
2
,
"TYPE="
,
obj_tmp
);
return
0
;
}
if
(
passlen
==
-
1
)
passlen
=
strlen
(
pass
);
if
(
!
pass
)
passlen
=
0
;
else
if
(
passlen
==
-
1
)
passlen
=
strlen
(
pass
);
pbetmp
=
(
EVP_PBE_CTL
*
)
sk_value
(
pbe_algs
,
i
);
i
=
(
*
pbetmp
->
keygen
)(
ctx
,
pass
,
passlen
,
param
,
pbetmp
->
cipher
,
pbetmp
->
md
,
en_de
);
...
...
crypto/evp/p5_crpt.c
浏览文件 @
a331a305
...
...
@@ -125,6 +125,9 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
salt
=
pbe
->
salt
->
data
;
saltlen
=
pbe
->
salt
->
length
;
if
(
!
pass
)
passlen
=
0
;
else
if
(
passlen
==
-
1
)
passlen
=
strlen
(
pass
);
EVP_DigestInit
(
&
ctx
,
md
);
EVP_DigestUpdate
(
&
ctx
,
pass
,
passlen
);
EVP_DigestUpdate
(
&
ctx
,
salt
,
saltlen
);
...
...
crypto/evp/p5_crpt2.c
浏览文件 @
a331a305
...
...
@@ -86,7 +86,8 @@ int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
HMAC_CTX
hctx
;
p
=
out
;
tkeylen
=
keylen
;
if
(
passlen
==
-
1
)
passlen
=
strlen
(
pass
);
if
(
!
pass
)
passlen
=
0
;
else
if
(
passlen
==
-
1
)
passlen
=
strlen
(
pass
);
while
(
tkeylen
)
{
if
(
tkeylen
>
SHA_DIGEST_LENGTH
)
cplen
=
SHA_DIGEST_LENGTH
;
else
cplen
=
tkeylen
;
...
...
crypto/pkcs12/p12_key.c
浏览文件 @
a331a305
...
...
@@ -74,25 +74,30 @@ void h__dump (unsigned char *p, int len);
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
int
PKCS12_key_gen_asc
(
const
char
*
pass
,
int
passlen
,
unsigned
char
*
salt
,
int
PKCS12_key_gen_asc
(
const
char
*
pass
,
int
passlen
,
unsigned
char
*
salt
,
int
saltlen
,
int
id
,
int
iter
,
int
n
,
unsigned
char
*
out
,
const
EVP_MD
*
md_type
)
{
int
ret
;
unsigned
char
*
unipass
;
int
uniplen
;
if
(
!
asc2uni
(
pass
,
&
unipass
,
&
uniplen
))
{
if
(
!
pass
)
{
unipass
=
NULL
;
uniplen
=
0
;
}
else
if
(
!
asc2uni
(
pass
,
&
unipass
,
&
uniplen
))
{
PKCS12err
(
PKCS12_F_PKCS12_KEY_GEN_ASC
,
ERR_R_MALLOC_FAILURE
);
return
0
;
}
ret
=
PKCS12_key_gen_uni
(
unipass
,
uniplen
,
salt
,
saltlen
,
ret
=
PKCS12_key_gen_uni
(
unipass
,
uniplen
,
salt
,
saltlen
,
id
,
iter
,
n
,
out
,
md_type
);
memset
(
unipass
,
0
,
uniplen
);
/* Clear password from memory */
Free
(
unipass
);
if
(
unipass
)
{
memset
(
unipass
,
0
,
uniplen
);
/* Clear password from memory */
Free
(
unipass
);
}
return
ret
;
}
int
PKCS12_key_gen_uni
(
unsigned
char
*
pass
,
int
passlen
,
unsigned
char
*
salt
,
int
PKCS12_key_gen_uni
(
unsigned
char
*
pass
,
int
passlen
,
unsigned
char
*
salt
,
int
saltlen
,
int
id
,
int
iter
,
int
n
,
unsigned
char
*
out
,
const
EVP_MD
*
md_type
)
{
...
...
@@ -106,10 +111,12 @@ int PKCS12_key_gen_uni (unsigned char *pass, int passlen, unsigned char *salt,
int
tmpn
=
n
;
#endif
#if 0
if (!pass) {
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
#endif
#ifdef DEBUG_KEYGEN
fprintf
(
stderr
,
"KEYGEN DEBUG
\n
"
);
...
...
@@ -125,7 +132,8 @@ int PKCS12_key_gen_uni (unsigned char *pass, int passlen, unsigned char *salt,
Ai
=
Malloc
(
u
);
B
=
Malloc
(
v
+
1
);
Slen
=
v
*
((
saltlen
+
v
-
1
)
/
v
);
Plen
=
v
*
((
passlen
+
v
-
1
)
/
v
);
if
(
passlen
)
Plen
=
v
*
((
passlen
+
v
-
1
)
/
v
);
else
Plen
=
0
;
Ilen
=
Slen
+
Plen
;
I
=
Malloc
(
Ilen
);
Ij
=
BN_new
();
...
...
crypto/pkcs12/p12_kiss.c
浏览文件 @
a331a305
...
...
@@ -106,11 +106,23 @@ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
/* Check the mac */
if
(
!
PKCS12_verify_mac
(
p12
,
pass
,
-
1
))
{
/* If password is zero length or NULL then try verifying both cases
* to determine which password is correct. The reason for this is that
* under PKCS#12 password based encryption no password and a zero length
* password are two different things...
*/
if
(
!
pass
||
!*
pass
)
{
if
(
PKCS12_verify_mac
(
p12
,
NULL
,
0
))
pass
=
NULL
;
else
if
(
PKCS12_verify_mac
(
p12
,
""
,
0
))
pass
=
""
;
else
{
PKCS12err
(
PKCS12_F_PKCS12_PARSE
,
PKCS12_R_MAC_VERIFY_FAILURE
);
goto
err
;
}
}
else
if
(
!
PKCS12_verify_mac
(
p12
,
pass
,
-
1
))
{
PKCS12err
(
PKCS12_F_PKCS12_PARSE
,
PKCS12_R_MAC_VERIFY_FAILURE
);
goto
err
;
}
}
if
(
!
parse_pk12
(
p12
,
pass
,
-
1
,
pkey
,
cert
,
ca
))
{
...
...
crypto/pkcs12/p12_mutl.c
浏览文件 @
a331a305
...
...
@@ -106,10 +106,7 @@ int PKCS12_verify_mac (PKCS12 *p12, const char *pass, int passlen)
return
0
;
}
if
((
maclen
!=
(
unsigned
int
)
p12
->
mac
->
dinfo
->
digest
->
length
)
||
memcmp
(
mac
,
p12
->
mac
->
dinfo
->
digest
->
data
,
maclen
))
{
PKCS12err
(
PKCS12_F_VERIFY_MAC
,
PKCS12_R_MAC_VERIFY_ERROR
);
return
0
;
}
||
memcmp
(
mac
,
p12
->
mac
->
dinfo
->
digest
->
data
,
maclen
))
return
0
;
return
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录