How to install a certificate using C into local machines root - c

I've created a self-signed certificate by referring to this link, now I got a .cer file which I ll install to my local machine root, using certmgr.exe. But I'd like to install this certificate programmatically.
Language to be used :C.
Compiler am using : MINGW
It should Support all versions of windows.
And I couldn't find the proper API for the same, It would be helpful if I get any Tips??

Related

Remote-SSH: identityFile path format on Winsows machine

Struggling to make Remote-SSH working in VS Code.
My local machine is Windows 10 and remote machine is Ubuntu 20.04. I have set configuration file "config" in C:\Users\xxx.ssh folder as bellow:
Host EC2
HostName ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com
User xxxx
IdentityFile D:/1WWW/KeyPairs/myKeyPair.pem
But its not working.
I am sure there is some problem in my identityFile path, but I don't know what. Any guidance please.
Try using '~' (home path) instead of using the full path
I would suggest to use puttygen.exe to generate a pair of public/private key.
Anyway the private key generated is not directly usable (it has a .ppk extension) and you need to go to Convertions -> Export OpenSSH key to get your private key in RSA format that can be used in the IdentityFile

how can i establish bgp connection using opendaylight nitrogen version (karaf-0.7.1) and my router

I need to establish bgp session between my router and odl. I have installed nitrogen version (karaf-0.7.1) and installed bgp feature using command feature:install odl-bgpcep-bgp.
After googling i found that in order to establish setup i need to edit a file (41-bgp-example.xml) which will be generated after installing bgp feature mentioned above, but i couldn't find the file in (\etc\opendaylight\karaf) and not seen in other locations. There is a file 31-bgp-example.xml and some other bmp file.
I am also not able to install feature (odl-bgpcep-bgp all).
What steps should be followed to do it via rest?
I installed the feature odl-restconf.
How can i proceed further? which file should i edit and how to run?
odl version: karaf(0.7.1)
The feature naming convention changed between Carbon and Nitrogen. To install the relevant bgpcep features, install "odl-bgpcep-bgp" instead of "odl-bgpcep-bgp-all".
Managed to configure using advanced rest client (use this -localhost:8181/url).
Changed content type to application/xml.still open and notification packet(bgp) is only flowing and session is not established,ODL is sending tcp packet with reset flag set.

PHP 7.x connection with MSSQL server with MAMP

I am trying to connect mssql server to PHP 7.0.8 through MAMP. I have tried using freetds. On some blog people are saying to use pdo_dblib.so extension but it's not working.
Please guide me through the process of connection.
For those who still have this problem:
/Applications/MAMP/bin/php/php7.2.1/bin/pecl install sqlsrv pdo_sqlsrv
Edit php.ini:
extension=sqlsrv.so
extension=pdo_sqlsrv.so
If necessary, use brew install autoconf if you don't have it already.
While the answers posted by Vague Space and Pedro Santiago helped, I still think the answers are a bit lacking and incomplete… Or ask you to do too much. Honestly the official Microsoft instructions are overkill when they state you need to install their Docker image of SQL Server and such? C’mon… Most people just need the drivers installed to make a connection.
So here is my answer based on my experience installing the pdo_sqlsrv.so and sqlsrv.so modules in MAMP (version 5.2) but should work for most any MAMP version that supports some flavor of PHP 7.
Adjust the .bash_profile so MAMP’s binaries and libraries are a part of your $PATH settings.
First, adjust your .bash_profile so the MAMP stuff is in there; makes it easier to launch and work with MAMP specific binaries and ensures MAMP libraries are checked when doing things like installing new modules like this.
The way I like to do it is like this; set $MAMP_BIN and $MAMP_PHP variables like this and then rebuild the $PATH variables:
# MAMP stuff.
export MAMP_BIN="/Applications/MAMP/Library/bin";
export MAMP_PHP="/Applications/MAMP/bin/php/php7.2.10/bin";
# Final $PATH setting.
export PATH="/usr/local/bin:/usr/local/sbin:$MAMP_BIN:$MAMP_PHP:$PATH";
Save it and just log out of the Terminal session and back in, or just resource the .bash_profile like this:
source ~/.bash_profile
With that done, let’s install the core Microsoft ODBC binary stuff.
Install the Microsoft ODBC stuff.
Do this to install the core ODBC stuff on macOS; be sure to have Homebrew installed:
brew tap microsoft/SQLSRV-release https://github.com/Microsoft/homebrew-SQLSRV-release
brew update
brew install --no-sandbox msodbcsql17 SQLSRV-tools
Then when that’s done, go ahead and install the Unix ODBC stuff like this:
brew install unixodbc
Now install the actual PHP modules via PECL:
pecl install sqlsrv pdo_sqlsrv
With the modules installed, add them to the php.ini file in MAMP so PHP can recognize it. For PHP 7.2.10 on MAMP 5.x it should be located here:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini
And just add these config lines to the bottom of the file:
; Enable 'Microsoft Drivers for PHP for SQL Server' extension module
extension = sqlsrv.so
extension = pdo_sqlsrv.so
; Configuration
;sqlsrv.WarningsReturnAsErrors = 1
;sqlsrv.LogSeverity = 0
;sqlsrv.LogSubsystems = 0
;sqlsrv.ClientBufferMaxKBSize = 10240
;pdo_sqlsrv.log_severity = 0
;pdo_sqlsrv.client_buffer_max_kb_size = 10240
Note, most tutorials—and even PECL when you install the modules—simply mention adding extension = sqlsrv.so and extension = pdo_sqlsrv.so to the php.ini config, but these config options are the ones that RedHat has when installing the PHP SQLSRV via the Remi repo. Yeah, most of them are commented out but I still like having it there for reference.
Follow this guide through step 3: Microsoft PHP drivers for SQL Server
Find where pecl drops extensions in your local machine
Copy the files pdo_sqlsrv.so and sqlsrv.so into your MAMP's PHP extension directory. Mine was located at /Applications/MAMP/bin/php/php7x.x/lib/php/extensions/no-debug-foo-bar
Edit your php.ini file to include the new extensions:
extension=sqlsrv.so
extension=pdo_sqlsrv.so
Restart your MAMP servers.
having just done this in 2019 with MAMPPRO4 on windows 10 (follow upto step 4 to test that you are connected and then do point 9 ) point 5 onwards is for changing the path in the command line
download dll files from microsoft
https://www.microsoft.com/en-gb/download/details.aspx?id=20098
follow the instruction after running the exe file and place the dll
files into the extension directory of the php version that you are
using eg: MAMP/bin/php/php7.1.29/ext
check phpinfo for the Loaded Configuration File of the php.ini file
add the 2 dll files depending on your requirements (I wasted time by
using the 64.dll) make sure you are using ts(thread safe) not
nts(none thread safe) in the file name of the dll
extension=php_sqlsrv_71_ts_x86.dll
extension=php_pdo_sqlsrv_71_ts_x86.dll
in control panel search for advanced system settings and click
click Environment Variables
under system variables not user variables click path and click edit
click new and add C:\MAMP\bin\php\php7.1.29 (Edit this to your path)
restart MAMP
open a new command line an enter php -v
you should see the php version displayed

Google API access using Service Account oauth2client.client.CryptoUnavailableError: No crypto library available

I am trying to create a service account app so that I can access Google Analytics api using Python.
Two things are confusing me. First, when I use the following code:
`from oauth2client.client import SignedJwtAssertionCredentials
client_email = "#####client_email#######.gserviceaccount.com"
with open("XXXXXX.p12") as f:
private_key = f.read()
credentials = SignedJwtAssertionCredentials(client_email, private_key,'https://www.googleapis.com/auth/sqlservice.admin')`
I get the following error:
`oauth2client.client.CryptoUnavailableError: No crypto library available`
After doing a little research I found that this might have to do with granting the app domain-wide authority to the service account. However, when I log on to the Google Developers Console I cannot locate the security icon or the more-options button. Any help much appreciated thank you.
This did the trick for me (without converting to PEM):
pip install PyOpenSSL
pip freeze says I have version 0.15.1
That error probably means you need the python-openssl package.
apt-get install python-openssl
Even if you are installed pycrypto & python-ssl libraries in your development environment, You need to add this pycrypto library in your application's app.yaml file.
libraries:
- name: pycrypto
version: "latest"
I just recently set this up but opted to go with PyCrypto 2.6.1, but you can also use python-openssl as mentioned in the previous answer.
The only problem I had and I can't pinpoint this down, but the P12 key generated by the Google Developer Console wasn't working with my Service Account API call (to the Content API for Shopping), and I had to switch the key to the PEM format to get things going.
My setup: (Win7, python 2.7.x, PyCrypto 2.6.1)
The error I got when trying to use the P12 key, but later resolved when converting it to PEM:
Error 3: PKCS12 format is not supported by the PyCrypto library.
NotImplementedError: PKCS12 format is not supported by the PyCrypto library. Try converting to a “PEM” (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option.
One important thing, don't forget to go inside Google Analytics and grant the appropriate permissions for the client email address that is created during the creation of the Service Account.
OSX 10.11 El Capitan does not distribute OpenSSL anymore. I was able to install cryptography using Homebrew and static build:
env CRYPTOGRAPHY_OSX_NO_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl)/lib/libssl.a $(brew --prefix openssl)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
More info
http://cryptography.readthedocs.org/en/latest/installation/

How to install mod_ssl on windows server 2008 64bits

We manage our own VM Windows Server 2008 R2 STD 64 bits which is use as a web server.
APACHE httpd-2.2.22-win32-x86-no_ssl is install on it since the beggining cause this was the only self install file (MSI) that we found on Apache web site.
I now need to install an SSL Certificate. I ran into a couple of forum without getting the exact solution method to my situation.
I use OpenSSL to create our own Self Sign Certificate on purpose of this installation. The issue is where can I find mod_ssl module that is missing ? I have no experience yet (but it's never too late to get a start) with compiling binaries and where can I get some safe binaries for this module if order to continue in configuring this dawn SSL Certificate ? :)
On the same machine i'm also running :
php-5.3.13-Win32-VC9-x86
mysql-5.5.24-winx64
FileZilla_Server-0_9_41
hMailServer
Finally, I just took it (mod_ssl.so) from my dev. server under an WAMP solution. I'd uncomment the ssl_module line into httpd.conf as suppose and all Works fine on my production server with this module.

Resources