The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,854 other subscribers

Archive for the ‘Security’ Category

Some command-line tips for OpenSSL and file format (pfx, p12, cer, crt, key, etc.) conversion of certificates, keys

Posted by jpluimers on 2015/02/27

OpenSSL is really nice, but remembering all these command-line switches is difficult, especially when you do not use them often enough.

I don’t, and when I do there are a few common tasks I perform, and I was glad to find a few links with great information:

I’ve converted them to batch files that run fine when copied to the directory where you put the x86 or x64 Windows version of OpenSSL (they assume %~dp0openssl.exe for the location of the OpenSSL.exe binary, just in case it is not on the path, or you have various tools that scattered around incompatible copies of OpenSSL binaries).

OpenSSL defaults to PEM format (that has text base64 strings), so if you get DER format (binary) you need to convert them.

A few errors I got and what they mean

Error decrypting PKCS#7 structure

Error decrypting PKCS#7 structure
5216:error:21070073:PKCS7 routines:PKCS7_dataDecode:no recipient matches certificate:.\crypto\pkcs7\pk7_doit.c:538:
5216:error:21072077:PKCS7 routines:PKCS7_decrypt:decrypt error:.\crypto\pkcs7\pk7_smime.c:557:

This error means that the recipient of the email does not match the certificate you pass in. What happens is that OpenSSL tries to decrypt the mail, it cannot match the certificate to the mail, and barfs. It usually happens when you have From/To reversed by accident.

Error decrypting PKCS#7 structure

Error decrypting PKCS#7 structure
4948:error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch:.\crypto\x509\x509_cmp.c:330:
4948:error:2107207F:PKCS7 routines:PKCS7_decrypt:private key does not match certificate:.\crypto\pkcs7\pk7_smime.c:552:

This means somewhere you mixed up a private and public key in the certificate files.

Use something like the OpenSSL wrapper verify-private-key-matches-certificate-x509-pem-cer.bat to verify them.

Error reading S/MIME message

Error reading S/MIME message
6900:error:0D06B08E:asn1 encoding routines:ASN1_D2I_READ_BIO:not enough data:.\crypto\asn1\a_d2i_fp.c:251:
6900:error:0D0D106E:asn1 encoding routines:B64_READ_ASN1:decode error:.\crypto\asn1\asn_mime.c:193:
6900:error:0D0D40CB:asn1 encoding routines:SMIME_read_ASN1:asn1 parse error:.\crypto\asn1\asn_mime.c:528:

OpenSSL does not like .EML files to end with a period (. which SMTP needs to process when sending an .EML file).
See https://gist.github.com/anonymous/7233372 and https://gist.github.com/anonymous/7233329
The former throws this error, the latter not. This is not caused the width of the base64 encoding (not yet archived at the WayBack machine), which I initially thought, but the terminating period.

Verification failure

Verification failure
8228:error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error:.\crypto\pkcs7\pk7_smime.c:342:Verify error:self signed certificate in certificate chai
n

–jeroen

Posted in base64, Development, Encoding, MIME, OpenSSL, Power User, Security, Software Development, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | Leave a Comment »

“PC Decrapifier” – via: Machines Plus Minds: Regarding Lenovo preinstalling SSL-breaking MITM on their machines

Posted by jpluimers on 2015/02/21

I didn’t even know there was a “PC Decrapifier”, but it exists: “PC Decrapifier” – Google Search.

Anyway: never use OEM Windows installs ever.

Would the Dutch Microsoft Store offer the same service?

–jeroen

via: Machines Plus Minds: Regarding Lenovo preinstalling SSL-breaking MITM on their machines.

Posted in Power User, Security, Windows | Leave a Comment »

Binary builds of Win64 and Win32 OpenSSL (via: Shining Light Productions)

Posted by jpluimers on 2015/02/20

The quickest way to get Win64 and Win32 binary builds of the youngest OpenSSL, you should get them from Shining Light Productions – Win32 OpenSSL.

Despite the link name, you can get the Win64 binaries from there too..

Besides binaries, they also have the source to build them from, and any other redistributable you’d need.

They run on virtually any Windows version, though I only used them on NT based Windows versions of XP/2003 and younger.

Two notes:

  • you usually need the Visual C++ 2008 redistributables, of which there is both an x86 and an x64 version (the OpenSSL installer just tells you it is missing, and assumes you know if it is the x86 or x64 one).
  • unless you are a software developer wanting to link to OpenSSL, the “Light” versions of the installs suffice.

–jeroen

via: Shining Light Productions – Win32 OpenSSL.

Posted in OpenSSL, Power User, Security, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | 1 Comment »

Mac OS X: Replicating md5sum Output Format (via: Raam Dev)

Posted by jpluimers on 2015/02/18

Mac OS X has md5, but no md5sum.

I agree with Mac OS X: Replicating md5sum Output Format that the second way of emulating md5 is better than the first one.

So here it is:


#!/bin/bash
/sbin/md5 -r "$@"

view raw

md5sum.bash

hosted with ❤ by GitHub

–jeroen

via: Mac OS X: Replicating md5sum Output Format – Raam Dev

Posted in Apple, bash, Development, Hashing, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, md5, OS X 10.8 Mountain Lion, Power User, Scripting, Security, Software Development | Leave a Comment »

VeraCrypt is the open source TrueCrypt successor – via Ashley Wilson – Google+

Posted by jpluimers on 2015/02/16

Wow, finally a TrueCrypt successor. And it is open source too!

VeraCrypt is the successor of the venerable TrueCrypt file encryption software, which was abandoned by its developers a while ago. VeryCrypt is compatible with TrueCrypt containers, and is open-source. (TrueCrypt was not). The resulting product fixes all known vulnerabilities that TrueCrypt had, and strengthened the security.

Read more about changes from TrueCrypt at https://veracrypt.codeplex.com/discussions/569777#PostContent_1313325

Veracrypt is now at these locations:
https://sourceforge.net/projects/veracrypt/
https://github.com/veracrypt/VeraCrypt

–jeroen

via Ashley Wilson – Google+.

Read the rest of this entry »

Posted in Encryption, Power User, Security | Leave a Comment »

djm’s personal weblog: Key rotation in OpenSSH 6.8+

Posted by jpluimers on 2015/02/03

Really interesting. Need to implement this when it gets public. djm’s personal weblog: Key rotation in OpenSSH 6.8+.

Watching https://github.com/openssh/openssh-portable

Posted in Power User, Security | Leave a Comment »

Add a Security Key to your Google Account: FIDO U2F Security Key

Posted by jpluimers on 2014/12/08

I just added a FIDO U2F Security Key | Yubico as a FIDO second factor to my Google Account: Add a Security Key to your Google Account – Accounts Help.

The cool thing: if you don’t have your FIDO U2F key with you, you can fall back to Google two step verification mechanisms like Authenticator, SMS/Phone or pre-generated backup security codes.

–jeroen

Posted in Chrome, Google, Google Apps, GoogleAuthenticator, Power User, Security, U2F FIDO Security Keys | 4 Comments »

Google: view which Devices used your account when: Security – Devices

Posted by jpluimers on 2014/11/24

Security – Deviceshttps://security.google.com/settings/security/activity

Posted in Google, Power User, Security | Leave a Comment »

Introducing nogotofail—a network traffic security testing tool for TLS/SSL – via: Google Online Security Blog

Posted by jpluimers on 2014/11/07

Great! And it is open source at https://github.com/google/nogotofail:

The Android Security Team has built a tool, called nogotofail, that provides an easy way to confirm that the devices or applications you are using are safe against known TLS/SSL vulnerabilities and misconfigurations. Nogotofail works for Android, iOS, Linux, Windows, Chrome OS, OSX, in fact any device you use to connect to the Internet.

There’s an easy-to-use client to configure the settings and get notifications on Android and Linux, as well as the attack engine itself which can be deployed as a router, VPN server, or proxy.

–jeroen

via Google Online Security Blog: Introducing nogotofail—a network traffic security testing tool.

Posted in *nix, Android Devices, Chrome, Google, iOS, Mac OS X / OS X / MacOS, OpenSSL, Power User, Security, Windows | Leave a Comment »

HTTPS blessing and curse: Security Collapse in the HTTPS Market – ACM Queue

Posted by jpluimers on 2014/09/29

Funny to discover these two articles today:

–jeroen

Posted in https, Power User, Security | Leave a Comment »