And we need to convert to this format:5ayPZaKM3flHFu2B7aiYpkI81/cByFHHNSmcgQQfP+X2bIGf7JlkuEneh5z7PRkk7Z05jOGxIMdvDd7pVLIWmgRLWaN7bI8JAVf8lUN0kcjA5KgQNjRI23LpvnvzHQjB4jyNXkhhxKXREreeWtEujduD1u99l5t2WxoDqdbYbdc= AQAB /27P2g48qXfQBlFRZ+pes6EBBUYzS3r7B1BL3g/O9VFJnZBPQFzclEdZPVvjh9Ve+HktvbKTaYRJ5wlVewDVRw==
5i8bXxa7g6Tue2/NkOjFK5i54RTaGPbjvPcg1N1Wq8pew0lx0lY3q7A+qH3VjiJHwSRifY7n92zkxutSqF4q8Q==hyilhyZ9ZtblFlK1Fp1nWvlYxuesgMYkSmxsmKYYxqoqn9sadF4uwa83Q0Z6EQgQZr4IPBZf9jdvu3au6pU4RQ== RWDDZjiq0fXfL3M2SUvvScGhnNa1GbsoTydJTP9dhS/cug2j8dqssuHPMOeke0+Xwv4ddWyiO/AlUFNTOY4QcQ== BtvaLLe1E1whaPvvT7r72qPl8oq+E020GiHmvO7v08D1SfynETLs5NJVAn4e3ChHNSvErTshin0r1JvLLTKqRw== 31S3r52rmuEdtnbHI8EQhoLcRSikLBURP2myDGZkuK61u3ckel4CaY0y/O2yBAxiM0fyQULpCTXEkFlUzI3LmKoj/L0cSlk58xf8hB837/fn/bulnATWSajKn/p4ecXpBlPTySf9MPwoyNwXdyjjz0bQc6oo1U42VybQRNgvWGE=
-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,8c57f58aa0ad5acc lNc4vhhAiQOJEHuK5Ifc5jA9kLwy082g110hSh81MR4fMfEuUDiu0hanAebaFgA7 vePABXoNJStG9mMO7r+AwSdeZZPF1wpSk35LYNVDZmSp2cy5ZyMDJy+xDNWxYODs f63i10DWE1/6u+Jlnmq5yWT05PvjBV+Jn/MeMwGgkj3JN8xTc8SgSRDsgarxllpk YLxF+mUqwnE3JIBASE7W75DjqmI8KfZXaNT9Xp7x1Jyg5h1HTHQnJLCpwmpoGl32 QTWTQw1BuD0gL04VC+nIKPhia16FGyqqD9sGdeCP18tb/yi4Bz8Nlc/ijLjuwFVX YDoqmjleulNFKQBQcePInStJfDejdETCm30iRhaMe2bH6NJmWfigzlud9uvGsrld f1QNhyTUS+6ntgbRtKLdhGL5Wx1ZItx5UL9UOl+ho7gJOGwiT7dKcF6zOts9vtre kkAsNGiXFcpdGC/xnnMoXHgYBUypCcT9D6K1dp7LzJozzACzlWSnhD9HW1lELLb3 AElJP1AwmHnh383qudM2/KoYRyK6VTUmjTUbsPStjmjldvwXqYUt5PVKsTb98JBj YFafxHdNorg4+ZFY+6JHTIKDMTu+I4td/2ok41oPLAC3x8GVB1iCAG8YgZsKGizy bbv+H3ns40k8n6XyyzI480Zb7/5PtIzY9tLGA9o2znQ+DWm64Wl2nfRDLfncanO4 EKQoYZVuMfU92TCan4roihURnmkO7YaJg6LeQTHUpkiVajV2Kbpv3JYbHH7Gvs+V SiSsQlXGirOFY2D82j54P6WT9L/nKtjmjSIZKq/hGPs9JN//XMfIhw== -----END RSA PRIVATE KEY-----Here the c# code:
public string EncryptPrivateKey(string pPhrase) { RSA rsa1 = RSA.Create(); rsa1.FromXmlString(xml_private_key);//Put here your XML Privatye Key AsymmetricCipherKeyPair keyPair = Org.BouncyCastle.Security.DotNetUtilities.GetRsaKeyPair(rsa1); TextWriter textWriter = new StringWriter(); PemWriter pemWriter = new PemWriter(textWriter); pemWriter.WriteObject(keyPair.Private, "DES-EDE3-CBC", pPhrase.ToCharArray(), new SecureRandom()); pemWriter.Writer.Flush(); return (textWriter.ToString()); }
No comments:
Post a Comment