Importing key from server with gpgme - gnupg

I'm trying to import a key from a keyserver using GPGME. I'm sure the key exists, since I can see it when I access the server with my browser. I followed the manual and produced this:
gpgme_key_t key;
gpgme_keylist_mode_t mode = gpgme_get_keylist_mode(ctx);
mode &= ~GPGME_KEYLIST_MODE_LOCAL;
mode |= GPGME_KEYLIST_MODE_EXTERN;
err = gpgme_set_keylist_mode(ctx, mode);
err = gpgme_get_key(ctx, id, &key, 0);
The keyring directory is configured at the beginning:
gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP, NULL, KeyringDir);
That directory contains a gpg.conf file with a "keyserver" entry specifiying the URL of the server. The global gpg.conf has the same directive with the same URL too.
The issue is that the import fails with the error "End of file", which means "not found". The id I pass has 8 characters starting with 0x, since I heard there may be issues with different formats.
Browing this site I found this related question search for a public key on a keyserver with GPGME however I'm not sure how those functions are supposed to be used, and they don't appear in the manual.
Thanks for the help.

Related

Trying to use the ocaml-mm library

I'm trying to use the ocaml-mm package (https://github.com/savonet/ocaml-mm) and trying to run one of the examples for sine_wav.ml
I first installed the package and also installed the ao library, which the sine_wav file uses. Everything compiles, but I get this error when I'm trying to run the file:
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$ make main
Entering directory '/home/ddavidjeong/cs3110/ms'
Fatal error: exception Failure("Failed to open device")
make: *** [Makefile:2: main] Error 2
ddavidjeong#DESKTOP-60PESIS:~/cs3110/ms/test$
I have no idea what this exception could refer to.
This errors means that the libao library failed to open its default audio device. You can at least check which default device was found by the library by using in utop
#require "ao";;
Ao.get_default_driver ()
```ocaml
Similarly, you can get the list of all audio device found by libao with
```ocaml
Ao.drivers;;
If there is no visible issue with the default driver, and there is some non-default driver available that looks like they might work; it would be possible to try to use another device in sin_wave.ml by replacing the instance of the Mm_ao.writer class in
let ao = new Mm_ao.writer channels sample_rate in
by an instance of
class ao_writer driver channels rate = object
object
val dev = Ao.open_live ~driver ~channels ~rate ~byte_format:`LITTLE_ENDIAN ()
method write buf ofs len =
let s = Audio.S16LE.make buf ofs len in
Ao.play dev s
method close = Ao.close dev
end
with the right driver.
But it is probably better to see why libao cannot open the default device that it selected itself.

Unable to sign file using openssl_pkcs7_sign on MacOS X 10.11.16

I need to sign a file that I create(For the purpose of our discussion - lets call it unsignedfile.xml). This file is written to the folder where my php page is (unsignedfile.xml will be alongside index.php).
I'm on php 5.5.38. I have a .cer file issue to me (Class 2 signing certificate).
I attempted the following
$clearfile = "unsignedfile.xml";
$encfile = $clearfile . ".enc";
openssl_pkcs7_sign(realpath($clearfile), realpath($encfile),
'file://'.realpath('/path/to/my/file/issued.cer'),
array ('file://'.realpath('/path/to/my/file/issued.cer'), "99999999"),
array ()
);
However i have been getting an error
Warning: openssl_pkcs7_sign(): error getting private key in /path/to/my/php/site/index.php on line xyz
Any assistance would be very much appreciated.
Possible suspects in my mind.. 1. Do I need to import this .cer file to mac osx keychain? .. I did but still the same result OR SHOULD the import should be in a different format?2. Am I missing any todo's in my apache server?

Gradle uploadArchives task unable to read secret key

I have created a gradle project and everything builds fine, but when I try to upload to my Maven repository, I get the following Gradle error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not evaluate onlyIf predicate for task ':library:signArchives'.
> Unable to read secret key from file: C:\Users\ideal\pubring.gpg (it may not be a PGP secret key ring)
I followed the instructions at Sonatype to generate the key, then copied it from its generated location to the location listed above. I have also published the public key to MITs key repository. The gradle.properties file in my user directory contains the following entries related to the keychain:
signing.keyId=MY_KEY_ID
signing.password=MY_KEY_PASSWORD
signing.secretKeyRingFile=C:\\Users\\ideal\\pubring.gpg
This is on a Windows platform. I have tried searching for the error message but the only thing which comes up is the source files for the related plugins.
The secring.gpg file has been removed in GPG 2.1.
However, GPG still can create such a file: gpg --export-secret-keys -o secring.gpg
Pro Tip: If Gradle's signing plugin complains that your key in signing.keyId=MY_KEY_ID is too long, you're certainly using the 40 characters fingerprint but are asked for the 8 char ID. You've got three options then:
You can configure GPG to show the 8 char ID instead of the fingerprint by setting the keyid-format option.
a) Either explicitly define this option on CLI: gpg --list-keys --keyid-format short (Thanks tjheslin1!)
b) Or activate this option implicitly through the options file (default location is ~/.gnupg/gpg.conf).
Try the last 8 digits of your 40 chars fingerprint. This is for the lazy developer ;-)
The problem is that you are using the public key, switch to the secret key, normally named "secring.gpg".
So in your case it should placed in
C:\Users\ideal\secring.gpg
The "secring.gpg" file may not be needed in GPG 2.1 and later versions, and can be generated with commands:
"gpg --export-secret-keys -o \dir\secring.gpg"

Getting error when using facebook authentication in codeigniter

I am using Facebook-Oauth. I am using windows 7 and i am trying to run it in my localserver. I am setting site-url :http://www.domain.com and canvas url : http://www.domain.com/ . I didn't make change any other change in settings in the facebook developer site.But whenever i am trying to run it in my localhost i am getting this error :
1.Message: Use of undefined constant CURLPROXY_HTTP - assumed 'CURLPROXY_HTTP'
2.Message: Use of undefined constant CURLAUTH_BASIC - assumed 'CURLAUTH_BASIC'
Both in
Filename: core/Loader.php
Line Number: 956
I have set the app id and app secrect key in the config file.
$config['facebook_app_id'] = '424824207643973';
$config['facebook_api_key'] = '424824207643973';
$config['facebook_secret_key'] = 'my-app-secretkey';
cURL is most likely not installed correctly or linked up to PHP. Windows does not come with cURL installed (another reason to switch to a *nix based system! but I digress) so you'll need the appropriate dll files to enable it, then link those in via your php.ini file.
With regards to your current error, please check for syntax errors and leave a comment on this answer and update your provided source, and I'll modify.

Problem with Win32 WNet APIs and NFS paths

I am running on a Win2K8R2 system that has Microsoft's NFS client installed in addition to the Windows CIFS client.
Given a UNC path (which the NFS client does support with caveats) I need to be able to tell if operations on the path would be handled by the CIFS or NFS client. WNetGetResourceInformation() would seem to provide this, but I have not been able to get it to work when the UNC path is to an NFS server.
Sample code:
int GetResourceInformation(TCHAR* path, void* buffer, DWORD* size)
{
TCHAR* p = NULL;
NETRESOURCE nr;
memset(&nr, 0, sizeof(nr));
nr.lpRemoteName = path;
DWORD dwRetVal = WNetGetResourceInformation(&nr, buffer, size, &p);
if(dwRetVal == NO_ERROR)
{
NETRESOURCE* tmp = (NETRESOURCE*)buffer;
wprintf(L"%s provider=%s system=%s\n", path, tmp->lpProvider, (p == NULL) ? L"<null>" : p);
}
else
{
wprintf(L"WNetGetResourceInformation failed for %s with error: %u\n", path, dwRetVal);
}
return dwRetVal;
}
I have also tried filling in the NETRESOURCE lpProvider and/or dwType fields as suggested in the doc but with no change in behavior.
If I pass the function a CIFS UNC path it succeeds. If I pass it an NFS UNC path it fails with error 487 "Attempt to access invalid address.". I also tried passing the native NFS path style hostname:/export/file but this fails with error 67 "The network name cannot be found."
I found the following sample for using WNetAddConnection2() with NFS but this code also fails for me with error 50 "The request is not supported". I can successfully mount the export using either "net use" command or the NFS-specific mount.exe tool provided by Microsoft.
Finally, WNetOpenEnum/WNetEnumResource does not return any NFS provider information for me or even show any connected drives that I have mapped via "net use" or mount.exe.
My general question is, has anyone had better success using the the WNet APIs with the NFS provider? Specifically, is there some mechanism I can use to determine the provider for a remote path?
Are you building as x86 or x64? It looks like the WNet* API's don't work correctly for NFS shares from an x86 process under WOW64. You can see this without writing code - if you have an NFS share mounted, "C:\windows\system32\net use" will show it, where "C:\windows\syswow64\net use" will not. Filesystem access seems OK the 32-bit process, but none of the APIs work.
Even built as x64, using a NULL lpProvider is inconsistent for me. Half the time it doesn't work, the other half it waits about 5 seconds before returning.
Calling WNetGetResourceInformation twice, once with a lpProvider of "NFS Network" and once with "Microsoft Windows Network" works consistently and returns instantly.

Resources