基于PHP的应用程序的Microsoft HealthVault证书

时间:2011-07-28 22:10:52

标签: php certificate healthvault

一些背景信息

我正在开发一个应该与Microsoft HealthVault交互的PHP应用程序。我能够从https://sourceforge.net/projects/healthvaultphp/下载健康保险库,并获取存储在我的healthvault测试帐户中的数据。

现在图书馆附带了“沙盒”app.id,app.cer等所有认证内容。所以我遇到的问题是如何获得我的php应用程序的实时证书。我从microsoft下载了makecert.exe文件为我生成证书,但它生成了一个二进制文件,与healthvaultphp库中包含的文本文件相比。

我的问题

如何以及如何进入以下文件?

认证/ app.cer

认证/ app.fp

认证/ app.pem

1 个答案:

答案 0 :(得分:1)

我完全忘了我在这里发布了这个问题......以下是我如何解决这个问题:

PHP中的Microsoft Healthvault设置 需要的文件:

app.pem
    RSA private key
app.cer
    Certificate file
app.id
    Application ID
app.fp
    Application thumbprint

生成PEM和CER文件

Download and install Microsoft Healthvault SDK
    http://msdn.microsoft.com/en-us/healthvault/bb688183
    Install as an administrator
Once installed create new application
    Click ‘Create New Application’ button
    Uncheck ‘Automatially…website…application’ box
    Click ‘Create and Register application’ button
    It will create a certificate name ‘WildcatApp-<appid>’
        app.id will contain <appid> 
    At this point you can click on the ‘HealthVault Application Configuration Center’ link and setup your HealthVault application.
Generate the PFX file
    Right-click on your ‘Certificate Name’
    Click ‘Export public and private keys (.pfx)’ menu item
    Select the desired location for the .pfx file, preferably in third_party/microsoftHealthVault/authentication
Converting PFX file to certificate and private key files
    Do this in your linux vm, you should at this point have access to .pfx file because you put in location mentioned on 3.c
    You will need to use ‘openssl’ to do the next steps
    Generate app.cer
        openssl pkcs12 -in <filename>.pfx -clcerts -nokeys -out app.cer
        press ‘enter’ when asked for ‘import password’
        This file should only contain text starting at ---BEGIN CERTIFICATE--- to ----END CERTIFICATE---- everything before and after should be deleted
        Now you have app.cer file
    Generate app.pem
        openssl pkcs12 -in <filename>.pfx -out app_enc.pem –nocerts
        press ‘enter’ when asked for ‘import password’
        type in your host windows login password for ‘PEM pass phrase’
        This will generate an encrypted private key file
        The encrypted private key file needs to be unencrypted to be able to use in the application
        openssl rsa -in app_enc.pem -out app.pem
        Now you have the app.pem file
Log in to your healthvault configuration screen to get the app id and thumbprint
    https://config.healthvault-ppe.com/default.aspx
    Copy the ‘Application Id’ and insert it in the app.id file
    Click on the ‘Application Id’
    Click on the ‘Public certs’ tab
    Copy the ‘Thumbprint’ and insert it in the app.fp file

此时您的app.cer,app.pem,app.id和app.fp文件已准备好使用。

Healthvault应用程序配置 https://config.healthvault-ppe.com/default.aspx

HealthVault开发人员中心 http://msdn.microsoft.com/en-us/healthvault/bb688183

HealthVault Thing定义 http://developer.healthvault.com/types/types.aspx