Friday, March 31, 2017

Web Projects in Visual Studio 2015

have moved from new projects to File / New Web Site

x86 or x64 - DUMPBIN dllname.dll /Headers

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86

Monday, March 27, 2017

bat datei log date time

echo Begin >ExecAnalyticsDataReportingLog.txt
Date /T >>ExecAnalyticsDataReportingLog.txt
TIME /T >>ExecAnalyticsDataReportingLog.txt
sqlcmd -S localhost\sqlexpress -D StpDb -Q "exec mySP"
echo Finish >>ExecAnalyticsDataReportingLog.txt
Date /T >>ExecAnalyticsDataReportingLog.txt
TIME /T >>ExecAnalyticsDataReportingLog.txt

Tuesday, March 21, 2017

osmc samba (linux)

prüfen ob installiert:
ps -ef |grep smb
sollte eine oder mehre zeile mit /usr/sbin/smbd liefern


install:
sudo apt-get install samba

adduser peter
smbpasswd -a peter


/etc/smb.conf

[freigabename]
path = /srv/data
wrtiteable = yes
valid users = peter



neustart:
sudo systemctl restart smbd.service



https://wiki.ubuntuusers.de/Samba_Server/

sudo smbpasswd -a <username> # Fügt den Benutzer <username> der Samba Datenbank hinzu und aktiviert diesen
sudo smbpasswd -x <username> # Entfernt den Benutzer <username> aus der Samba Datenbank
sudo smbpasswd -d <username> # Deaktiviert den Benutzer <username> in der Datenbank
sudo smbpasswd -e <username> # Aktiviert den vorher deaktivierten Benutzer <username> in der Datenbank wieder 


Wednesday, March 15, 2017

signing assembly strong name / signtool

A) STRONG NAME

1) you need SDK Tool SN:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\sn.exe

2) create key file:
sn -k StrongNameKeyFile.snk

3) sign the assembly in Visual Studio
in VisualStudio open Project Properties,
Signing,
Sign the assembly and choose the StrongNameKeyFile.snk from (2)

4) check if assembly is strong named:
sn -v assembly name
=> output ....exe stellt keine Assembly mit einem starken Namen dar.
oder
=> output Die Assembly "....exe" ist gültig

readmore:
https://www.linkedin.com/pulse/code-signing-visual-studio-jason-brower

B) SIGNTOOL

C:\Program Files (x86)\Windows Kits\10\bin\x64

/a automatically selects the code signing certificate with the longest valid date:
signtool sign /a yourApp.exe 
=> output Done Adding Additional Store 
Succeddfully signed: yourapp.exe

=> there is a new Tab in Windows File Properties named "Digital Certificates" which shows the cert owner

buildtarget and BadImageFormatException

http://stackoverflow.com/questions/5229768/c-sharp-compiling-for-32-64-bit-or-for-any-cpu


On a 32-bit machine:

  • Any CPU: runs as a 32-bit process, can load Any CPU and x86 assemblies, will get BadImageFormatException if it tries to load an x64 assembly.
  • x86: same as Any CPU.
  • x64BadImageFormatException always.

On a 64-bit machine:

  • Any CPU: runs as a 64-bit process, can load Any CPU and x64 assemblies, will get BadImageFormatException if it tries to load an x86 assembly.
  • x86: runs as a 32-bit process, can load Any CPU and x86 assemblies, will get BadImageFormatException if it tries to load an x64 assembly.
  • x64: same as Any CPU.
It is the JIT compiler that generates an assembly code that's compatible with the requested target based on this flag.

Tuesday, March 14, 2017

code signing certificate

StartCom:
easy: upload documents, wait 1 day for validation
comodo (and resellers): have to go to notary and send letter to usa

Saturday, March 11, 2017

UEFI New Boot drive


https://forum.acronis.com/forum/25975

On a Dell Latitude I had to go into the BIOS settings under boot sequence. Then under the UEFI settings it will show the Windows Boot for the old hard drive. It seems to be tied to the serial of the drive. If you click on add new, it will populate with the cloned drive serial, you simply just give it a name (I called it Windows New) and copy the boot location from the existing entry (bottom line). The EFI files it needs to boot with are stored in a hidden partition on the drive (which also much be cloned) - this is what you are pointing to.

Thursday, March 09, 2017

certificates / Zertifikate basics

Zertifikat anzeigen im Browser:

Chrome

drei Punkte Menü ganz rechts, unteres Drittel weitere Tools, Entwickler => Security Tab (fentesr etwas breiter machen damit Security Tab sichtbar wird)

Klassen

Class 1 for individuals, intended for email.
Class 2 for organizations, for which proof of identity is required.
Class 3 for servers and software signing, for which independent verification and checking of identity and authority is done by the issuing certificate authority.
Class 4 for online business transactions between companies.
Class 5 for private organizations or governmental security.

Formate:


  • .csr This is a Certificate Signing Request. Some applications can generate these for submission to certificate-authorities. The actual format is PKCS10 which is defined in RFC 2986. It includes some/all of the key details of the requested certificate such as subject, organization, state, whatnot, as well as the public key of the certificate to get signed. These get signed by the CA and a certificate is returned. The returned certificate is the public certificate (which includes the public key but not the private key), which itself can be in a couple of formats.
  • .pem Defined in RFC's 1421 through 1424, this is a container format that may include just the public certificate (such as with Apache installs, and CA certificate files /etc/ssl/certs), or may include an entire certificate chain including public key, private key, and root certificates. Confusingly, it may also encode a CSR (e.g. as used here) as the PKCS10 format can be translated into PEM. The name is from Privacy Enhanced Mail (PEM), a failed method for secure email but the container format it used lives on, and is a base64 translation of the x509 ASN.1 keys.
  • .key This is a PEM formatted file containing just the private-key of a specific certificate and is merely a conventional name and not a standardized one. In Apache installs, this frequently resides in /etc/ssl/private. The rights on these files are very important, and some programs will refuse to load these certificates if they are set wrong.
  • .pkcs12 .pfx .p12 Originally defined by RSA in the Public-Key Cryptography Standards, the "12" variant was enhanced by Microsoft. This is a passworded container format that contains both public and private certificate pairs. Unlike .pem files, this container is fully encrypted. Openssl can turn this into a .pem file with both public and private keys: openssl pkcs12 -in file-to-convert.p12 -out converted-file.pem -nodes
A few other formats that show up from time to time:
  • .der A way to encode ASN.1 syntax in binary, a .pem file is just a Base64 encoded .der file. OpenSSL can convert these to .pem (openssl x509 -inform der -in to-convert.der -out converted.pem). Windows sees these as Certificate files. By default, Windows will export certificates as .DER formatted files with a different extension. Like...
  • .cert .cer .crt A .pem (or rarely .der) formatted file with a different extension, one that is recognized by Windows Explorer as a certificate, which .pem is not.
  • .p7b Defined in RFC 2315, this is a format used by windows for certificate interchange. Java understands these natively. Unlike .pem style certificates, this format has a defined way to include certification-path certificates.
  • .crl A certificate revocation list. Certificate Authorities produce these as a way to de-authorize certificates before expiration. You can sometimes download them from CA websites.

In summary, there are four different ways to present certificates and their components:
  • PEM Governed by RFCs, it's used preferentially by open-source software. It can have a variety of extensions (.pem, .key, .cer, .cert, more)
  • PKCS7 An open standard used by Java and supported by Windows. Does not contain private key material.
  • PKCS12 A private standard that provides enhanced security versus the plain-text PEM format. This can contain private key material. It's used preferentially by Windows systems, and can be freely converted to PEM format through use of openssl.
  • DER The parent format of PEM. It's useful to think of it as a binary version of the base64-encoded PEM file. Not routinely used by much outside of Windows.

pem, crt 

pem ist standardformat vieler ssl tools (z.b. openssl)

-----BEGIN CERTIFICATE-----
base64code
-----END CERTIFICATE-----

crt kann in cer mittels windows zertifikats assistent umgewandelt werden (2.Tab Datei erstellen)

cer

kann entweder base64 oder binär DER codiert sein:
base 64 encoded X.509
-----BEGIN CERTIFICATE-----
base64code
-----END CERTIFICATE-----

der codiert binär X.509
unlesbar

Tools

microsoft:

signtool (C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe)
certutil (C:\WINDOWS\system32\certutil.exe  )

java

keytool (C:\Program Files\Java\jdk1.8.0_131\bin\keytool.exe)
signing: java -jar jsign-2.0.jar  ( https://ebourg.github.io/jsign/ )

Code Signing


http://stackoverflow.com/questions/3580349/code-signing-microsoft-authenticode

Tools

  • signtool.exe - the code signing tool (C:\Program Files (x86)\Windows Kits\10\bin\x64 )
  • makecert.exe - creates a digital certificate
  • cert2spc.exe - converts a digital certificate into the Software Publisher Certificate (code signing) format
  • pvk2pfx.exe - imports the private key and software publisher certificate into the .pfx file format required by signtool.exe.

how to check if a cert is a code signing cert:

look at the purpose: should be
Ensure software cam from software publisher
...

Saturday, March 04, 2017

azure sql db create login and user

CREATE LOGIN my20170403  WITH PASSWORD='pwd1'
alter login my20170403  ENABLE
alter login my20170403  WITH PASSWORD='mypwd'
alter login my20170403 WITH DEFAULT_DATABASE = mydb

create user my20170403 for login my20170403 with default_schema = [dbo]

to connect with sql management studio
also needs user in master database - because deafult database not there

Wednesday, March 01, 2017

address denied exception wcf

Fehlermeldung:
HTTP konnte URL ... nicht registrieren. Der Prozess weist keine Zugriffsrechte für diesen Namepsace auf

allow using the adress / port  with netsh:

for example http:
netsh http add urlacl url=http://+:port/ user=DOMAIN\UserName