How to change .pem file to .key file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onthepunt
    Junior Member
    • Jul 2020
    • 5

    #1

    How to change .pem file to .key file?

    I created my key through XCA and exported it as a PEM private file (.pem) following this tutorial https://www.youtube.com/watch?v=nO4UnHRyLz4. When I use the path of the key as my Cert Path, I get an error saying 'Make sure .crt and .key file is present. Do I need to export my key in a different file format through XCA? How do I change a .pem file extension to .key?

    My code:


    certs_path1 = r'C:\Users\\Desktop\Certs\Arb.crt'
    certs_path2 = r'C:\Users\\Desktop\Certs\Client-2048.pem'
    my_username = ""
    my_password = ""
    my_app_key = ""
    trading = betfairlightweight.APIClient(username=my_username, password=my_password, app_key=my_app_key, certs=certs_path1 and certs_path2)
    trading.login()
    Last edited by onthepunt; 07-08-2020, 07:36 AM.
  • sun082
    Junior Member
    • Mar 2022
    • 4

    #2
    I experienced the same issue, this worked for me:

    Code:
    openssl rsa -in client2048.pem -out client2048.key
    You can also add the path of where you are reading in and saving the file and it should work. i.e C:\client2048.pem

    Comment

    • lahomacady
      Junior Member
      • Jul 2022
      • 1

      #3
      Thank you very much for your help, everything works!

      Comment

      • Angel
        Junior Member
        • Aug 2019
        • 1

        #4
        What goes in the my_app_key = "" ?

        Everybody's code has this but nobody or any of the documentation reveal what this is!

        In this example, certs_path2 already links to the key.

        Should my_app_key be repeating this super long string e..g. my_app_key = 'MIIEpAIBAAKCAQEA+NANqNuwh6C/xEgHOxHSmwj6RhViriBCJFkd0syrU9TWN0TnLA9YS5NET2IdCN N5xZ+uBwZH+Rt+xe7/alpKB+hefAoGc/UeoRzMXc1az...................' ?

        Comment

        • BetfairDeveloperProgram
          Administrator
          • Oct 2008
          • 680

          #5
          Hi Angel

          You should put your Delayed/live App Key as the value for "my_app_key = "

          See https://docs.developer.betfair.com/d...pplicationKeys for details on how to retrieve your existing App Keys.

          Kind Regards

          Neil

          Comment

          Working...
          X