Unable to retrieve values from CSR using Phpseclib - phpseclib

Following the example from the link I am able to parse a CSR fine. However if I try to retrieve individual attributes i get errors.. Its strange though using the same method I can pull info from a public key but just not the CSR..
Phpseclib CSR parser:
http://phpseclib.sourceforge.net/x509/examples.html#readcsr
This works:
Print_r($csr);
This does not work??
$CN = $csr['certificationRequestInfo']['subject']['rdnSequence'][0][0]['value']['utf8String'];
echo $CN;

This issue is now resolved and was due to lack of support for parsing Microsoft CSR's.. The fix can be found here phpseclib cant parse CSR from Microsoft CA?

Related

How to use aws cli with cli-input-json

I was having trouble using the cli-input-json by following the AWS documentation which seems simple enough (here), but was as per usual missing a key element that they assume everyone knows. That being that the JSON file needs to be UTF-8 encoded. By default when using Visual Studio Code & Powershell, it would get the skeleton file in UTF-16 LE encoding.
The error that the CLI would provide was a JSON formatting error.
Props goes to Sudarpo Chong with a comment on a similiar post, but doesn't focus on this as a key issue.
Summary:
ensure JSON file in UTF-8 encoding.

Nifi: ReplaceTextWithMapping doesnt work as expected

I have been trying out examples in nifi and has been trying out the ReplaceTextWithMapping processor. The processor config as given below.
The mapping file is shown below.And I have used tab space between key and value.
I have followed this article here. And there is a lots of ID in the input file to the processor.There is no error on the logs. Can someone help me understand the problem.
The only workaround I could find was giving the values directly like (ID|POS). This does work. But still don't know why regex is not working.

RegExp_Extract everything before first dot in Google Data Studio

I'm trying to use Google Data Studio to build a dashboard of browser versions. The "Browser Version" field in Google Analytics has too much detail so I want to extract everything before the . in a version number. I've tried creating a new field with the following formula, but keep getting an error "Could not parse formula". I've tested this RegEx on regex101.com and it seems to work so maybe I'm not understanding something about Google Data Studio?
REGEXP_EXTRACT(Browser Version,'^(.+?)\.')
Try the below regular expression. I believe the issue is because (not set) is also a possible value for the Browser Version dimension, so your regex must cater for that condition as well.
REGEXP_EXTRACT(Browser Version,'^\\D*(\\d+)\\D*')

Does Crypto++ support TOFB-I?

I'm developing a C++ application to decrypt the data encrypted by someone else with TOFB-I (TDEA Output Feedback - Interleaved).
To do this I'm using the Crypto++ library.
Unfortunately, the result of the decryption doesn't seem to work: the first byte is decrypted correctly, the rest is just meaningless data.
I've double checked with the Linux command line tool OpenSSL and get exactly the same result.
So I'm inclined to believe that I'm applying a decryption algorithm with wrong feedback, so that the first IV works fine but something goes wrong with the feedbacks.
My question is: how do I apply the interleaved variant of the DES_OFB mode?
Couldn't find anything about this either in the Crypto++ or in the OpenSSL documentation.
Apparently Crypto++ (and also OpenSSL) doesn't support TOFB-I operation mode:
http://csrc.nist.gov/groups/STM/cavp/documents/des/tripledesval.html
Actually, according to the above link no implementation has been validated yet as conforming to TOFB-I!
So I guess I'll need to implement my own TOFB-I algo.

How to sign XML document or verify XML document signature with C++?

Subj. I need to sign/verify under Windows in native C++ (no .NET), using private key for signing, public key for verification.
I saw few examples on MSDN (http://msdn.microsoft.com/en-us/library/ms761363(VS.85).aspx) that demonstrate how to sign the document with CSP (I don't know what this means).
For my case I need to use a "key" from the binary data array (using DSA encryption algorithm)... can somebody help me with that?
Thank you in advance.
I recommand libxml2 and xmlsec which are perfect for this purpose.
The API can seem hard to read at first, but it works well. xmlsec uses OpenSSL to achieve the cryptographic part.
Providing a "short" example here is probably hard because the three libraries require some initialization and a lot of C calls.
Google's keyczar lib is also very easy to use
There's also Crypto++