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 4,262 other subscribers

Archive for March 19th, 2019

How can I open a cmd window in a specific location? – Stack Overflow

Posted by jpluimers on 2019/03/19

Based on [WayBack] How can I open a cmd window in a specific location? – Stack Overflow:

cmd /K "pushd ""D:\Versioned Stuff\wiert.me"""

The quoting is required for paths having spaces, so I always include them just in case I ever have a path with spaces.

If I want it with bash, then I run it as follows:

cmd /K "pushd ""D:\Versioned Stuff\wiert.me""" && "C:\Program Files\Git\bin\bash.exe"

Documentation: [WayBack] CD Change Directory – Windows CMD – SS64.com

–jeroen

Posted in CommandLine, Console (command prompt window), Development, Power User, Software Development, Windows | Leave a Comment »

openssl: checking out RSA private key files in .rsa and .pem format

Posted by jpluimers on 2019/03/19

While checking out an issue with the SSH server for ContinuaCI issue (see info below), I wanted to look at the files leading to the issue: .pem and .rsa files with the private key for the SSH server.

So I browsed through my series of openssl related articles to see if I already had made a script better explaining the cryptic openssl command-line parameters. I didn’t have it yet, but it turned out to be really simple:

C:\ProgramData\VSoft\ContinuaCI\SSHD>"C:\Program Files (x86)\Git\usr\bin\openssl.exe" rsa -in server_keypair.rsa
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
C:\ProgramData\VSoft\ContinuaCI\SSHD>"C:\Program Files (x86)\Git\usr\bin\openssl.exe" rsa -in server_keypair.rsa -text
Private-Key: (1024 bit)
modulus:
    ..:..:..:.....
publicExponent: 35 (0x23)
privateExponent:
    ..:..:..:.....
prime1:
    ..:..:..:.....
prime2:
    ..:..:..:.....
exponent1:
    ..:..:..:.....
exponent2:
    ..:..:..:.....
coefficient:
    ..:..:..:.....
writing RSA key
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
C:\ProgramData\VSoft\ContinuaCI\SSHD>"C:\Program Files (x86)\Git\usr\bin\openssl.exe" rsa -in server_keypair.pem
Enter pass phrase for server_keypair.pem:
unable to load Private Key
2675996:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:529:
2675996:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:p12_decr.c:108:
2675996:error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error:p12_decr.c:139:
2675996:error:0907B00D:PEM routines:PEM_READ_BIO_PRIVATEKEY:ASN1 lib:pem_pkey.c:141:
C:\ProgramData\VSoft\ContinuaCI\SSHD>"C:\Program Files (x86)\Git\usr\bin\openssl.exe" rsa -in server_keypair.pem -passin pass:password
unable to load Private Key
2675996:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:529:
2675996:error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error:p12_decr.c:108:
2675996:error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error:p12_decr.c:139:
2675996:error:0907B00D:PEM routines:PEM_READ_BIO_PRIVATEKEY:ASN1 lib:pem_pkey.c:141:

The command-lines use the [WayBack]rsa tool with:

  • the -in parameter
  • (for the first file) the -text parameter to dump it into human readable form
  • (for the second file) the -passin parameter with a [WayBackpass phrase argument pass:password.

The server_keypair.pem file (having the header -----BEGIN ENCRYPTED PRIVATE KEY----- and footer -----END ENCRYPTED PRIVATE KEY-----) was a password protected RSA private key where somehow ContinuaCI had the wrong password for.

I’m not sure it’s a good idea that the server_keypair.pem file has not password at all.

Read the rest of this entry »

Posted in Continua CI, Continuous Integration, Development, OpenSSL, Power User, Security, Software Development | Leave a Comment »

Are these really Windows compiler unsupported Delphi Intrinsic Routines?

Posted by jpluimers on 2019/03/19

Odd, the [WayBack/Archive.is] Delphi Intrinsic Routines – RAD Studio indicates quite a few compiler intrinsics are not available on Windows.

I wonder if this list is correct:

Routine Description DCC32 DCC64 DCCOSX DCCAARM DCCIOSARM DCCIOSARM64 DCCIOS32
System.AtomicCmpExchange AtomicCmpExchange is used for comparing and exchanging memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicDecrement AtomicDecrement is used for decrementing memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicExchange AtomicExchange is used for exchanging memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicIncrement AtomicIncrement is used for incrementing memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.BuiltInArcTan Calculates the arctangent of a given number. Allowed.png Allowed.png
System.BuiltInArcTan2 Calculates the arctangent angle and quadrant of a given number. Allowed.png Allowed.png
System.BuiltInCos Calculates the cosine of an angle. Allowed.png Allowed.png
System.BuiltInLn Calculates the natural logarithm of a real expression. Allowed.png Allowed.png
System.BuiltInLnXPlus1 Calculates the natural logarithm of (X+1). Allowed.png Allowed.png
System.BuiltInLog10 Calculates log base 10. Allowed.png Allowed.png
System.BuiltInLog2 Calculates log base 2. Allowed.png Allowed.png
System.BuiltInSin Calculates the sine of the angle. Allowed.png Allowed.png
System.BuiltInSqrt Calculates the square root of X. Allowed.png Allowed.png
System.BuiltInTan Calculates the tangent of X. Allowed.png Allowed.png

Especially since this compiles fine with the DCC32 compiler:

program CompilerIntrinsicsConsoleProject;

{$APPTYPE CONSOLE}

{$R *.res}

var
  I, J, K: Integer;
begin
  System.AtomicCmpExchange(I, J, K);
  System.AtomicDecrement(I);
  System.AtomicExchange(I, J);
  System.AtomicIncrement(J);
end.

–jeroen

Posted in Delphi, Delphi 10.3 Rio (Carnival), Development, Software Development | 3 Comments »