dongyuans61046 2017-06-30 13:23
浏览 14

从关键细节到关键资源

I use the function openssl_pkey_get_details to get the details of my keys (primes, exponents...). Key types I managed are mostly RSA and EC ones.

Example:

<?php
$pemFilename = 'file://'.__DIR__ . '/public.es256.key';
$keyResource = openssl_pkey_get_public($pemFilename);
$details = openssl_pkey_get_details($keyResource);

With the code above, the data contained in the $details is an array with the components of my key.

Now I would like to convert back this array into a key resource i.e. the inverse function of the one above.

Example:

$keyResource = function_to_be_defined($details);

Is there any way to do it without external libraries?

The comments recommend to use function openssl_pkey_get_private, but it accepts only the file path to a PEM key or a string that contains the key in PEM format.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算