Exemple #1
0
        public RSA()
        {
            this.CrytpServiceProvider = new RSACryptoServiceProvider(512);

            //PrivateKey = RSAPemParser.ImportPrivateKey(this.getPrivateKey());
            //PublicKey = RSAPemParser.ImportPrivateKey(this.getPublicKey());
            this.setPrivateKey(RSAPemParser.ExportPrivateKey(this.CrytpServiceProvider));
        }
Exemple #2
0
        public void setPublicKey(string publicKey)
        {
            string pub = @"-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKxtGGN7xyVbla0mT1FLwzEK0naW1lfD
B/VtArLtq5/pVQU5+0Ku8gE2hwsiCodOcVfdw+Vg0axkcVT9bovnTIECAwEAAQ==
-----END PUBLIC KEY-----";

            this.PublicKey = RSAPemParser.ImportPublicKey(publicKey);
            // this.CrytpServiceProvider.FromXmlString(publicKey);
        }
Exemple #3
0
 public void setPrivateKey(String privateKey)
 {
     this.PrivateKey = RSAPemParser.ImportPrivateKey(privateKey);
     // this.CrytpServiceProvider.FromXmlString(publicKey);
 }
Exemple #4
0
 public string getPrivateKey()
 {
     return(RSAPemParser.ExportPrivateKey(this.CrytpServiceProvider));
     //return this.CrytpServiceProvider.ToXmlString(true);
 }
Exemple #5
0
 public string getPublicKey()
 {
     return(RSAPemParser.ExportPublicKey(this.CrytpServiceProvider));
     //return this.CrytpServiceProvider.ToXmlString(false);
 }