[gnutls-devel] GnuTLS | PBKDF2 doesn't work with all SHA-2 hashes or MD5 (#723)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue Mar 5 18:35:51 CET 2019


New Issue was created.

Issue 723: https://gitlab.com/gnutls/gnutls/issues/723
Author:    Hubert Kario
Assignee:  

## Description of problem:
in PKCS#12 files, PBES2 with PBKDF2 with hmacWithSHA512, hmacWithSHA384, hmacWithSHA224 or hmacWithMD5 PRF does not work

## Version of gnutls used:
gnutls-3.6.5-1.el8.x86_64

## Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
RHEL

## How reproducible:


 * download https://github.com/redhat-qe-security/keyfile-corpus
 * run `certtool --p12-info --inder --infile 'keyfile-corpus-keyfiles-0.1.3/rsa(2048,sha256),cert&key(PBES2(PBKDF2(salt(64),iter(1000000),keyLen(default),prf(hmacWithSHA512)),aes-256-cbc(IV(16)))),mac(sha512,salt(64),iter(1000000)),pass(ascii).p12' --password 'Red Hat Enterprise Linux 7.4'`
 * run `certtool --p12-info --inder --infile 'keyfile-corpus-keyfiles-0.1.3/rsa(2048,sha256),cert&key(PBES2(PBKDF2(salt(8),iter(2048),keyLen(default),prf(hmacWithMD5)),aes-128-cbc(IV(16)))),mac(sha1,salt(8),iter(2048)),pass(ascii).p12' --password 'Red Hat Enterprise Linux 7.4'`
 * run `certtool --p12-info --inder --infile 'keyfile-corpus-keyfiles-0.1.3/rsa(2048,sha256),cert&key(PBES2(PBKDF2(salt(8),iter(2048),keyLen(default),prf(hmacWithSHA224)),aes-128-cbc(IV(16)))),mac(sha1,salt(8),iter(2048)),pass(ascii).p12' --password 'Red Hat Enterprise Linux 7.4'`
 * etc.

## Actual results:
```
bag_decrypt: The hash algorithm is unknown.
There were errors parsing the structure
MAC info:
	MAC: SHA1 (1.3.14.3.2.26)
	Salt: a9e4a4ff82fcc30b
	Salt size: 8
	Iteration count: 2048

BAG #0
	Type: Encrypted
	Cipher: AES-128-CBC
	Schema: PBES2-AES128-CBC (2.16.840.1.101.3.4.1.2)
	Salt: 38cc590051f7c4e4
	Salt size: 8
	Iteration count: 2048

	Decrypting...

BAG #1
	Elements: 1
	Type: PKCS #8 Encrypted key
	PKCS #8 information:
		Cipher: AES-128-CBC
		Schema: PBES2-AES128-CBC (2.16.840.1.101.3.4.1.2)
		Salt: 5369a4e334531320
		Salt size: 8
		Iteration count: 2048

	Friendly name: localhost
	Key ID: E3:76:B4:62:05:2B:2F:D4:B9:12:5B:B0:EA:E0:4F:10:C8:C0:C5:B0
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIU2mk4zRTEyACAggA
MAwGCCqGSIb3DQIIBQAwHQYJYIZIAWUDBAECBBAgdxbvUGAApqxH2FVPOldABIIE
0JJ4SXh8mxEk0MA+zVhfW9y2PXyL3vm2/3SI7U0hc9d3OCZtgFu3al1CN9PbfqZ9
DcG0ddTY3WY8wpNlWErPeYlRuNVFCpK++pWCrFjZAftRVaJlQQS0okf+idmfSv8E
5fSo8RoyXzPOmzgh0YUpaYT0iSE1YeJ0LTIjk1ZYeNoZbQFMUgoQZgRE04i9pCBX
UdlXlGjJeGSykNEcRFFBpr6yA+kkWJecjQeGbk8dnUO9nyN10UzJ0Ly7v9pR7Eaq
jJTk3dqusCn4ViPWxmj3fY+/+GEhe9+sVgxVhtBanb0NAXc3HQ8Dcz2vyPLI1rfJ
wTxDyGLD/6sVQAZYhYh5BVOaWCIRUOPkxtXfH990+1pTN90ySvVxMuIypJvvPULW
Ik+w94xOiYMSuxe1DFQjRRBxOjVXZLGHmgzUREevti81g80FCOnKO0Nivg/WcLKq
2AhOQv3TvnTfu3WbFF7Ddyp56IXynUaxhyqxGstMZ/0+PL0To1zfPnWY88BJn0co
TPRIiuFC8Ggt7IirrXm8MvuShvEeh9V1X0UOhOXZEZTFu+xlLNaaT6LcIJ0xuRtn
R90sSqra4hzyG0HlqjA/fqmO2wExDZGyou3ghpGczx7VEFlLx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can be processed just like other PKCS#12 files in the set

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/issues/723
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190305/ad106ef9/attachment-0001.html>


More information about the Gnutls-devel mailing list