如何使用RSAkey.pub文件对xml文件进行签名?

时间:2018-07-03 07:26:43

标签: c# rsa private-key xml-signature

我计划使用私钥对xml文件进行签名。我知道如何在C#中使用

创建RSA密钥
RSACryptoServiceProvider Key = new RSACryptoServiceProvider();

但是如果我们将RSA密钥作为* .pub文件,我不知道该如何处理?我通过腻子创建了这个密钥。通常,我想通过一个可以在任何地方工作的RSA私钥对xml签名。另外,我的密钥应该是可重用的。

您介意与我分享您对xml文件签名的经验吗?

*。pub文件的内容如下:

  

ssh-rsa   AAAAB3NzaC1yc2EAAAABIwAAAgEAylfYdB32iUxnhigU + mYn25wKuxyYtVVNtOZ0s0Q5jNo9cGZjQtl4FYVcJnOn2NcL5m7n9 / EsUcKhFGGRuooTUwcVU0L0Hxs2ZT6aI1EqgzotF + VAGgMd9g7Tt / fQsLzbEUbVqwP5NywmdmBeIrPDJY3 + FvXuz1v8Y8tn3KcTI7u1N5wZ6uMxpEXLZQntGDP9sV7a5iklS4uc0eieVtOBCSQ16ruNSdCWhEN3L5dBA / bPNahHuEQf1WcUDvJ23b1EjHFO69F8NIQ0wKroRw6VLlaejlgK2MzDbX1PCDqcGyVUf6XGxNTofny2qR88dRcQppINe3PxLrwLw45JDD4 / Kmjaud8Ef6yPvdvJKCSxd1eiS66y8ykBxIQZaS3vx0jcp / EYYTEazJnTrkYgc26tjw30ZrjKkrgW0MTJAQ8gI5C7vU4wAAjc0kCFiEuZewmjwXMdhhGcHd78BSyDUoWGatTPu00AwOQhN2lVPqh3RfaGP1YUWq2DMYEHhuhdI0UsrtpS3tCToWXy / 7Jr7QSVpJqoWCblQ1Y5aLC96cO8bRHAqraXE2LfcEKCJJBwQDlfLLrybPi7qIZTx + 28JfGOZkVseS9g2y5IBrjBIqdKVw3iFRRvzphJGZDhD5Ld / NcgaSv0xnsIqBHeISE2zvI4onvRC / Ul20EwpDetj9XqVzk =   acteam @ abcdappsvr1

还有另外一个文件,我不确定在使用腻子创建RSA密钥时应该将其称为密钥。 第二个文件的内容如下:

  

-----开始使用RSA私有密钥----- MIIJJgIBAAKCAgEAylfYdB32iUxnhigU + mYn25wKuxyYtVVNtOZ0s0Q5jNo9cGZj   Qtl4FYVcJnOn2NcL5m7n9 / EsUcKhFGGRuooTUwcVU0L0Hxs2ZT6aI1EqgzotF + VA   GgMd9g7Tt / fQsLzbEUbVqwP5NywmdmBeIrPDJY3 + FvXuz1v8Y8tn3KcTI7u1N5wZ   6uMxpEXLZQntGDP9sV7a5iklS4uc0eieVtOBCSQ16ruNSdCWhEN3L5dBA / bPNahH   uEQf1WcUDvJ23b1EjHFO69F8NIQ0wKroRw6VLlaejlgK2MzDbX1PCDqcGyVUf6XG   xNTofny2qR88dRcQppINe3PxLrwLw45JDD4 / Kmjaud8Ef6yPvdvJKCSxd1eiS66y   8ykBxIQZaS3vx0jcp / EYYTEazJnTrkYgc26tjw30ZrjKkrgW0MTJAQ8gI5C7vU4w   AAjc0kCFiEuZewmjwXMdhhGcHd78BSyDUoWGatTPu00AwOQhN2lVPqh3RfaGP1YU   Wq2DMYEHhuhdI0UsrtpS3tCToWXy / 7Jr7QSVpJqoWCblQ1Y5aLC96cO8bRHAqraX   E2LfcEKCJJBwQDlfLLrybPi7qIZTx + 28JfGOZkVseS9g2y5IBrjBIqdKVw3iFRRv   zphJGZDhD5Ld / NcgaSv0xnsIqBHeISE2zvI4onvRC / Ul20EwpDetj9XqVzkCASMC   ggIBAJZP4p9mtyQqIQSSzcFTM40yFpmgNu0azAK50wjTmHdDCRGrJSpYZ9V5AqA4   qJJz3PRSYy020HdAH + NBKm1QoKQT4 / S1ZOPoVEs10ZaUEPPE0QpvyTflDvFM18p9   k7Z9qgzViMgu1mN / 4g7LPp1vmEfIkN3bQ6 / 7MISlut5te + 6osoEU4A2S1GtnDB8r   8fS46FfgEFM0ghrcvaM / FomkbnvRwacO + z4l7Ce9FrWjj2IHzSCLov3pdrvI6lQ /   FnjVveSr8Xv6tAnBS8JTEvL049lHqPwG43x62lFVxa5XbKZzgJlWk6gpIb0ML + tZ   CFb7MPDERIeX9P4lSpFFIFI83nX0PbH7xcivEgmQALe1eQ2edl5GECodlzRwIVT2   1egRJf9RFuXbXXrHTU6lpbVWfSHqlpnuwyt9mYFzczocWCzeu6qDBrOHtQw + / z5C   3xKqZWsY4ARLa5Rzw2bcXPCwtxSrHOb95md0GPEq171CGI3LjZKjaYHlW8GsBS9s   U1hflKVO / C895Wxg2aovpLe2eqLTcfay6N0090ZmfrX27YTpMcGmfw3Xgx7JuZ6l   7wqaghTUyRvxFkqhLczGm2M0k0MUC2JlbmUwF + jnNPCPoXDbnb1Emaq54EBoJZbf   i6RDGiBiXiIvtFP0G0r2UeJf6cxX5oFqPW9DTrWy4 / utOBxrAoIBAQDrcRzem20h   oHv9MgcXM91rzWnwvwcTwCDq6yR / 3e8cUw7Zru1dbFWjepsX + ycsFtqpHauesG8c   UdvGv3sg7HVdkr3aPBn4qI / EXGD94eF2KKc4iGmCvmcB9KTCTRLN8iOn1Tnbenao   bivc85yva / SvTa20uWxijOrHzsFFE3qb1dpaTSi0kZErX61WcIiRsOaWDBL6EwvJ   rShWxSxQ4vEabxyrxDFVN95 + yaGPlHhkSXhzIFQniA8p / LBdupro9hxC79KfSWXp   oZuVLoNaWtTdkLHGNUxH43wOp5RSaB7xRy634993c9 / v6b9qaX / lgdXky / 2nr0SB   etgXxcHzxKSlAoIBAQDcAt6jo7934NKJDFEjC + A0DifCGT08MSvHKMh1e71Qh620   GWXJ67QlIj0AY8R1i8upC / + TxKQj7Hf2UN8W0Kzf8UsmCGqKwIqdgsmk7cVfVQoP   QCp4G6oZzxrfG5k / 2OZuBNRW0CFuLwH6F9Ru1pJmcCTZEdMgDnM99rcHnmLtmJOC   AQBcYOqkggD0dkXCK / aFgtuKwCF2enVGJsh / D + aWBLqXAHbOAOhRtMr6Gf57PzXG   6sH4 + A2DXlyEpoV85b57Mj + lFoqXmeyxQYLaWxt + 1alx4c24pAu68zAnOeM8v + d5   fn3qv5Ix9wamS2M81K + qidY + cqhbQf7qKw7HvKAFAoIBAHkVmdGRwxibrXrmh03C   5ub77Vc9q95FjUWdgHxGQHT3g / rsP48hxaSIMoFcl82IGK6 + zUpMG + KtwXwn9i4w   dt + qjYYtibMU3DkZkPeYvRgyKh0S9G8gF7fc5wTXLj4HgA0r1JzCo2yQblRgB3Ao   5DzmHtH49emKTNvJarXPgOJt + 0RiMjD6Z + pruDsVTYzBYKTwREYYbHZZDW50CCmZ   SMvEHV + mukkVaxyiNdTQA2bGsvlhFVYot1dsAu5f9 + WF4qYU7 / olv2I12vxDzoY9   V4fkA6fDo5KvgaEi + 9Kb8qf4uPDbl39C6DI9suZE4rCL6lho6NnlG + rRdnKgN9xz   wmMCggEAcSYMGaSrnLzEC / e0svAqKWZdlwWqdrozxYKwPGuF7uaxGss7qaxrRkwf   X0lAdvdwDcuoAtooh4DtPNkiRj9u2ZIJZARUDNgmxgi / eWRW4JIibj5BuhzbIzdP   pfDvum + McxhtM / YCkG / yY1y2ZONhO / 8o5KoUzqhYhkReISzia5BL3HWLKDHXwlF8   1X6niG5hhn3P / jbso1Tr2u9fzFFSBAJuls0J5kmcDMNhEujMBN6t8UWIVCfMb3Jb   d2uVG6lapcISGmNdOAYEsu59z2IOI / jazNqHDoBAjAgKIs1QSyDdca7EahlhIQKy   9m / p5MUnJIFm3kmYaXJl14Pbty3OowKCAQAmXVBFmvgKfKBu6HaqwO0QsSZw + iYo   MTNpGdCcQ6tzSf74DUFHv2NE6BPYxIfp3tv6CM36O0oYIilzK2ILwNFd + Y6ZfDxk   KZUXZIloH0V + 0bdSqqD0fqr8TGIzEKJQQbe3zpTsuQ + A9hmFkVLpByI1woyBnZS3   7K + Nsasiim4gxHozRSmA3Ka36OdwbuV8xj65HnTFJT1dysDm2fLvLK + a + ejjwQ4C   AA2fZK / tmVqD1O99tDZsMc + ThAGAG + 3GxKHVP6EI1yyC20bK8JIhgIlfmiRb5eTc   F3JHEkyc4M4fTJXYQ3nbjPubHVsL6jeuvv76VzIZjrQEAl7V6lL4Pnok   -----结束RSA私钥-----

0 个答案:

没有答案