Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java中使用Microsoft Cryptographics PublicBlobType.Capi1PublicKey_Java_Windows Runtime_Encryption Asymmetric - Fatal编程技术网

在Java中使用Microsoft Cryptographics PublicBlobType.Capi1PublicKey

在Java中使用Microsoft Cryptographics PublicBlobType.Capi1PublicKey,java,windows-runtime,encryption-asymmetric,Java,Windows Runtime,Encryption Asymmetric,使用下面的代码将公钥生成到WinRT应用程序中 AsymmetricKeyAlgorithmProvider asymmetricKeyAlgorithmProvider = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.get_RsaPkcs1()); CryptographicKey cryptographicKey = asymmetricKeyAlgorithmProvider.CreateKe

使用下面的代码将公钥生成到WinRT应用程序中

AsymmetricKeyAlgorithmProvider asymmetricKeyAlgorithmProvider = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.get_RsaPkcs1());
CryptographicKey cryptographicKey = asymmetricKeyAlgorithmProvider.CreateKeyPair(1024u);
IBuffer buffer = cryptographicKey.Export(3);
IBuffer buffer2 = cryptographicKey.ExportPublicKey(3);
byte[] inArray;
CryptographicBuffer.CopyToByteArray(buffer, ref inArray);
byte[] inArray2;
CryptographicBuffer.CopyToByteArray(buffer2, ref inArray2);
CommonMethods.PrivateKey = Convert.ToBase64String(inArray);
CommonMethods.PublicKey = Convert.ToBase64String(inArray2);
在ExportPublicKey中,公钥3指CapipPublicKey。如果我想使用base64将公钥字符串编码到java应用程序中,我该怎么做呢


Java没有像CapipPublic密钥这样的东西

我找不到任何直接的方法来做到这一点。我首先将CapiPublicKey转换为WinRT中java支持的X509公钥


然后,我将生成的公钥用于java。

我找不到任何直接的方法来实现这一点。我首先将CapiPublicKey转换为WinRT中java支持的X509公钥

然后,我将生成的公钥用于java