Monthly Archives: October 2012

OpenSSL::PKey::RSAError Neither PUB key nor PRIV key:: nested asn1 error – Adaptive Payments Gem

Hey everyone,

I’ve been mucking around with PayPal for a while and decided to try out the adaptive_payments gem by Tommy Chheng. Unfortunately I ran into the following error:


Neither PUB key nor PRIV key:: nested asn1 error

It turns out that I’d simply skipped an important part of the readme file. The api_cert_file in the paypal_adaptive.yaml file should point to a file containing BOTH your paypal_cert_pem.txt and whatever your private key happens to be. This took an embarrassingly long time for me to figure out, so hopefully this will help some of you!

It turns out I still had this wrong, I was using the wrong certs. After sorting out a few more errors that I ran into after the one mentioned above I finally started getting a response from Paypal, unfortunately it was another error message:

Authentication failed. API credentials are incorrect

It turns out I was using the wrong certs. If you’ve run into the same problem you’ll need to go to Profile > Request API Credentials > Option 2 (Request API credentials to create your own API username and password.). Then download the cert and point to this.

Hey everyone, just another update to this. If you happened to be following the railscast on PayPal before attempting to use the gem, you may not get the option to download the certs mentioned above. To get around this, simply remove your existing certificates (Profile > API Access > Option 2 > Remove > Remove). You should now see the ‘Request API Certificate Option’.

Sorry about the confusing post, but there’s a *slight* chance it might be able to help someone else who runs into the same problem.

Additional Logging – Heroku

Hey everyone,

I needed to do a fair bit of logging and came across a heroku guide that shows how to make things a little easier.

Change logging level to debug:
heroku config:add LOG_LEVEL=DEBUG

View a live(ish) feed of errors:
heroku logs –tail

If you’re aware of any other useful bits please let me know!

Blocking Duplicate Payment – Paypal

Hey everyone,

Just a quick post on how to block duplicate payments with PayPal. All you have to do is pass an invoice parameter and then select the ‘block multiple payments per invoice ID’ option in PayPal. I’ve attached an extract from PayPal’s documentation below:

1. Login at
2. Click the ‘Profile’ subtab
3. Under ‘Selling Preferences’ click ‘Payment Receiving Preferences’
4. Choose ‘Yes, block multiple payments per invoice ID’ if you wish to utilize this feature while passing the “invoice” variable
5. Scroll to the bottom and click the ‘Save’ button

To pass the invoice number for Website Payments Standard, you will need to add a line of code to your existing button code. You cannot add this code to a button originally created as encrypted. Example below:

<input type=”hidden” name=”invoice” value=”001″>

The documentation is available at the following link:

Uploadify – Limit to One Upload Only

Hey everyone,

Just a quick post detailing how to limit uploadify to a single file. Simply add the following settings to your uploadify initialisation:

multi: false
queueSizeLimit : 1
uploadLimit : 1

  2. $(document).ready(function() {
  3.      $('#file_upload').uploadify({
  4.         'swf' : '<?php echo $this->Html->url('/uploadify/uploadify.swf');?>',
  5. 	'uploader' : '<?php echo $this->Html->url('/uploadify/uploadify.php');?>',
  6. 	'cancelImg' : '<?php echo $this->Html->url('/webroot/uploadify/cancel.png');?>',
  7. 	'folder' : '<?php echo $this->Html->url('/extraz/uploaded_by_all_users');?>',
  8. 	'auto' : true,
  9. 	'buttonText' : 'Browse',
  10. 	'multi' : false,
  11. 	'queueSizeLimit' : 1,
  12. 	'uploadLimit' : 1,
  13. 	'sizeLimit' : 1073741824,
  14. 	'debug' : true,
  15. 	'multi' : false,	        
  16. 	'onUploadProgress' : upload_progress_handler,
  17. 	'onUploadStart' : upload_start_handler,
  18. 	'onUploadSuccess' : on_upload_success,
  19. 	'onUploadError' : on_upload_error
  20.      });
  21. });

Once the upload limit is exceeded the onUploadError event is raised.


Git with KDiff3 – Windows

Hey all,

Just a quick post showing the config I needed to use in order to get KDiff3 working with git. It took a while to get this working so hopefully it’ll be able to help someone else out.

  1. #Config file
  2. [user]
  3. 	email =
  4. 	name = test
  5. [core]
  6. 	editor = \"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\"
  8. [apply]
  9.     whitespace = fix
  11. [color]
  12.     branch = auto
  13.     diff = auto
  14.     interactive = auto
  15.     status = auto
  18. [core]
  19.         pager = less -FRSX
  20.         whitespace = cr-at-eol
  21.         autocrlf = input
  22.         excludesfile = /Users/test/.gitignore_global
  23.         editor = mate -w
  25. [alias]
  26.         co = checkout
  27.         lg = log --graph --pretty=oneline --abbrev-commit
  29. [gui]
  30. 	recentrepo = Y:/Projects/Junk
  31. 	recentrepo = C:/xampp/htdocs/onlinemedia
  32. [merge]
  33. 	tool = kdiff3

Screenshot of git config from GUI:

Git Config KDiff

Git Config KDiff

Running KDiff3:

Executing KDiff3

Executing KDiff3

KDiff3 display:

KDiff3 Display

KDiff3 Display