Пример #1
0
        public static SatoPrivateKey FromPem(string input)
        {
            var key = Pem.Decode <AsymmetricKeyParameter>(input);

            if (key == null)
            {
                var key2 = Pem.Decode <AsymmetricCipherKeyPair>(input);
                if (key2 == null)
                {
                    return(null);
                }

                key = key2.Private;
            }

            return(new SatoPrivateKey(key));
        }
Пример #2
0
 public string ToPem() => Pem.Encode(_key);
Пример #3
0
        public static SatoKeyPair FromPem(string input)
        {
            var keyPair = Pem.Decode <AsymmetricCipherKeyPair>(input);

            return(new SatoKeyPair(new SatoPrivateKey(keyPair.Private), new SatoPublicKey(keyPair.Public)));
        }