Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

KeyPair.Generate failure tests #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions NSch.Tests/NSch.KeyPair/KeyGenTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.IO;
using System.Text;

namespace NSch.Tests.NSch.KeyPair
{
[NUnit.Framework.TestFixture]
public class KeyGenTests
{
[NUnit.Framework.Test]
public void KeyPairGenerate_RSA1024_GeneratesKeys()
{
var jsch = new global::NSch.JSch();
var keyPair = global::NSch.KeyPair.GenKeyPair(jsch, global::NSch.KeyPair.RSA, 1024);

string privateKey;
using (var keyStream = new MemoryStream())
{
keyPair.WritePrivateKey(keyStream);
privateKey = Encoding.UTF8.GetString(keyStream.ToArray());
}
string publicKey;
using (var keyStream = new MemoryStream())
{
keyPair.WritePublicKey(keyStream, "Test Comment");
publicKey = Encoding.UTF8.GetString(keyStream.ToArray());
}
NUnit.Framework.Assert.IsTrue(!String.IsNullOrEmpty(privateKey));
NUnit.Framework.Assert.IsTrue(!String.IsNullOrEmpty(publicKey));
}
}
}
65 changes: 65 additions & 0 deletions NSch.Tests/NSch.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B20CD429-6F1D-4572-8587-6FAC6DE70469}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NSch.Tests</RootNamespace>
<AssemblyName>NSch.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NSch.KeyPair\KeyGenTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NSch\NSch.csproj">
<Project>{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}</Project>
<Name>NSch</Name>
</ProjectReference>
<ProjectReference Include="..\Sharpen\Sharpen.csproj">
<Project>{72944A6C-45FF-4EF8-B349-8C9CABF519D4}</Project>
<Name>Sharpen</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
36 changes: 36 additions & 0 deletions NSch.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NSch.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PBL Media")]
[assembly: AssemblyProduct("NSch.Tests")]
[assembly: AssemblyCopyright("Copyright © PBL Media 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("53c7245e-0b0c-4088-a347-a11092351197")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
15 changes: 10 additions & 5 deletions NSch/NSch.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -29,8 +29,15 @@
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Math, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Mono.Math.dll</HintPath>
</Reference>
<Reference Include="Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Mono.Security" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
Expand Down Expand Up @@ -197,9 +204,7 @@
<Compile Include="NSch\LocalIdentityRepository.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="NSch\Sharpen\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\Sharpen\Sharpen.csproj">
<Project>{72944A6C-45FF-4EF8-B349-8C9CABF519D4}</Project>
Expand Down
20 changes: 15 additions & 5 deletions Sharpen/Sharpen.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -31,8 +31,20 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Math, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Mono.Math.dll</HintPath>
</Reference>
<Reference Include="Mono.Posix">
<HintPath>..\lib\Mono.Posix.dll</HintPath>
</Reference>
<Reference Include="Mono.Security">
<HintPath>..\lib\Mono.Security.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="ICSharpCode.SharpZipLib" />
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\lib\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Web" />
</ItemGroup>
Expand Down Expand Up @@ -157,7 +169,5 @@
<Compile Include="Sharpen\JavaCalendar.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="Sharpen\" />
</ItemGroup>
<ItemGroup />
</Project>
Binary file added lib/ICSharpCode.SharpZipLib.dll
Binary file not shown.
Binary file added lib/Mono.Math.dll
Binary file not shown.
Binary file added lib/Mono.Posix.dll
Binary file not shown.
Binary file added lib/Mono.Security.dll
Binary file not shown.
83 changes: 52 additions & 31 deletions ngit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,40 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpen.Test", "Sharpen.Tes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sharpen.Unix", "Sharpen.Unix\Sharpen.Unix.csproj", "{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NSch.Tests", "NSch.Tests\NSch.Tests.csproj", "{B20CD429-6F1D-4572-8587-6FAC6DE70469}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4D3FBBA4-95DD-424C-B54B-717AA30F22F3}"
ProjectSection(SolutionItems) = preProject
lib\ICSharpCode.SharpZipLib.dll = lib\ICSharpCode.SharpZipLib.dll
lib\Mono.Math.dll = lib\Mono.Math.dll
lib\Mono.Posix.dll = lib\Mono.Posix.dll
lib\Mono.Security.dll = lib\Mono.Security.dll
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
DebugWin|Any CPU = DebugWin|Any CPU
Release|Any CPU = Release|Any CPU
ReleaseWin|Any CPU = ReleaseWin|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Release|Any CPU.Build.0 = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Release|Any CPU.Build.0 = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Release|Any CPU.Build.0 = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Release|Any CPU.Build.0 = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -43,6 +55,14 @@ Global
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.Release|Any CPU.Build.0 = Release|Any CPU
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{A19E6F3F-A25B-4B01-8922-CF0CC35C781D}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.Release|Any CPU.Build.0 = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{72944A6C-45FF-4EF8-B349-8C9CABF519D4}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -51,22 +71,23 @@ Global
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.Release|Any CPU.Build.0 = Release|Any CPU
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{BCFC8586-1CE2-4E47-9DA1-79C336397E52}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.Release|Any CPU.Build.0 = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{E1FA8F29-5BAB-4FB7-8362-B8CE67ECF7C2}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.Release|Any CPU.Build.0 = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{E3BFF8B4-189C-496A-A817-7E8B31E22B91}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.Release|Any CPU.Build.0 = Release|Any CPU
{849AE05D-0058-4A8C-A0E8-77DC6BB12E52}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.DebugWin|Any CPU.ActiveCfg = Debug|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.DebugWin|Any CPU.Build.0 = Debug|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.Release|Any CPU.Build.0 = Release|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.ReleaseWin|Any CPU.ActiveCfg = Release|Any CPU
{B20CD429-6F1D-4572-8587-6FAC6DE70469}.ReleaseWin|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = NGit\NGit.csproj
Expand Down