Exemplo n.º 1
0
        public SshFormattingProvider(ISshKeyProvider sshKeyProvider, EncodingWrapper encoding, Ssh2ContentFormatter ssh2ContentFormatter, OpenSshContentFormatter openSshContentFormatter, Base64Wrapper base64)
        {
            this.sshKeyProvider          = sshKeyProvider;
            this.encoding                = encoding;
            this.ssh2ContentFormatter    = ssh2ContentFormatter;
            this.openSshContentFormatter = openSshContentFormatter;
            this.base64 = base64;

            supportedSshHeaders = new[] { "---- BEGIN SSH2 PUBLIC", "ssh-rsa ", "ssh-dss ", "ssh-ed25519 ", "ecdsa-sha2-nistp256 ", "ecdsa-sha2-nistp384 ", "ecdsa-sha2-nistp521 " };
        }
            public void ShouldAddFormattedKeyContent()
            {
                var    openSshContentFormatter = new OpenSshContentFormatter();
                string keyContent      = sshKeyProvider.GetOpenSshEd25519PrivateKey(keyPair, "key comment");
                string expectedContent = openSshContentFormatter.FormatToOpenSshKeyContentLength(keyContent);

                IEnumerable <string> headers = new[]
                {
                    "-----BEGIN OPENSSH PRIVATE KEY-----",
                    "-----END OPENSSH PRIVATE KEY-----"
                };

                string content = string.Join("\n", resultLines.Except(headers));

                Assert.AreEqual(expectedContent, content);
            }
 public void SetupContentFormatterTest()
 {
     formatter = new OpenSshContentFormatter();
 }