91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 617KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-12
  • 語言: 其他
  • 標簽: 私鑰??C#??

資源簡介

用于私鑰加密 公鑰解密用于私鑰加密 公鑰解密用于私鑰加密 公鑰解密

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;

using?Org.BouncyCastle.Asn1.Pkcs;
using?Org.BouncyCastle.Asn1.X509;
using?Org.BouncyCastle.Crypto.Generators;
using?Org.BouncyCastle.Crypto.Parameters;
using?Org.BouncyCastle.Math;
using?Org.BouncyCastle.Pkcs;
using?Org.BouncyCastle.Security;
using?Org.BouncyCastle.Crypto.Engines;
using?Org.BouncyCastle.X509;
using?Org.BouncyCastle.Crypto;
using?Org.BouncyCastle.Asn1;
using?Org.BouncyCastle.Crypto.Encodings;

namespace?CryptionUtils
{
????public?class?RSAForJava
????{

????????public?RSAForJava()
????????{
?????????????
????????}
????????///?
????????///?KEY?結構體
????????///?

????????public?struct?RSAKEY
????????{
????????????///?
????????????///?公鑰
????????????///?

????????????public?string?PublicKey
????????????{
????????????????get;
????????????????set;
????????????}
????????????///?
????????????///?私鑰
????????????///?

????????????public?string?PrivateKey
????????????{
????????????????get;
????????????????set;
????????????}
????????}
????????public?RSAKEY?GetKey()
????????{
????????????//RSA密鑰對的構造器??
????????????RsaKeyPairGenerator?keyGenerator?=?new?RsaKeyPairGenerator();

????????????//RSA密鑰構造器的參數??
????????????RsaKeyGenerationParameters?param?=?new?RsaKeyGenerationParameters(
????????????????Org.BouncyCastle.Math.BigInteger.ValueOf(3)
????????????????new?Org.BouncyCastle.Security.SecureRandom()
????????????????1024???//密鑰長度??
????????????????25);
????????????//用參數初始化密鑰構造器??
????????????keyGenerator.Init(param);
????????????//產生密鑰對??
????????????AsymmetricCipherKeyPair?keyPair?=?keyGenerator.GenerateKeyPair();
????????????//獲取公鑰和密鑰??
????????????AsymmetricKeyParameter?publicKey?=?keyPair.Public;
????????????AsymmetricKeyParameter?privateKey?=?keyPair.Private;

????????????SubjectPublicKeyInfo?subjectPublicKeyInfo?=?SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
????????????PrivateKeyInfo?privateKeyInfo?=?PrivateKeyInfoFactory.CreatePrivateKeyInfo(privateKey);

????????????
????????????Asn1object?asn1objectPublic?=?subjectPublicKeyInfo.ToAsn1object();

????????????byte[]?publicInfoByte?=?asn1objectPublic.GetEncoded(“UTF-8“);
????????????Asn1object?asn1objectPrivate?=?privateKeyInfo.ToAsn1object();
????????????byte[]?privateInfoByte?=?asn1objectPrivate.GetEncoded(“UTF-8“);??

????????????RSAKEY?item?=?new?RSAKEY()
????????????{
????????????????PublicKey?=Convert.Tobase64String(publicInfoByte)
????????????????PrivateKey=Convert.Tobase64String(privateInfoByte)
????????????};
????????????return?item;
????????}
????????private?AsymmetricKeyParameter?GetPublicKeyParameter(string?s)
????????{
????????????s?=?s.Replace(“\r“?““).Replace(“\n“?““).Replace(“?“““);
????????????byte[]?publicInfoByte?=?Convert.Frombase64String(s);
????????????Asn1object?pubKeyObj?=?Asn1object.FromByteArray(publicInfoByt

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????2236416??2015-12-28?21:38??私鑰加密公鑰解密JAVA、C#、PHP互通\dll\BouncyCastle.Crypto.dll

?????文件???????5449??2017-10-28?09:28??私鑰加密公鑰解密JAVA、C#、PHP互通\RsaHelper.cs

?????文件????????782??2018-04-25?09:42??私鑰加密公鑰解密JAVA、C#、PHP互通\調用方法.txt

?????目錄??????????0??2018-04-25?09:51??私鑰加密公鑰解密JAVA、C#、PHP互通\dll

?????目錄??????????0??2018-04-25?09:51??私鑰加密公鑰解密JAVA、C#、PHP互通

-----------?---------??----------?-----??----

??????????????2242647????????????????????5


評論

共有 條評論