Moving micasa 1.5 trunk to Novell forge.

This commit is contained in:
Cameron (Kamran) Mashayekhi
2005-10-11 19:51:00 +00:00
parent 082db33275
commit efe0a5e13c
691 changed files with 116628 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,76 @@
/**************************************************************************
Copyright (c) [2005] Novell, Inc. All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, if not, contact Novell, Inc.
To contact Novell about this file by physical or electronic mail,
you may find current contact information at www.novell.com.
**************************************************************************/
using System.Reflection;
using System.Runtime.CompilerServices;
//
// 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("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

View File

@@ -0,0 +1,20 @@
#
# configure environment
#
TARGET = cSharpSample
CS_NAME = $(TARGET)$(xtra).exe
include global.mak
include defaults.$(PLAT)
include rules.mak
#
# target object and source files
#
include src.$(PLAT)
include objs.$(PLAT)
#
# targets
#
include target.cs

View File

@@ -0,0 +1,257 @@
/**************************************************************************
Copyright (c) [2005] Novell, Inc. All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software Foundation;
version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, if not, contact Novell, Inc.
To contact Novell about this file by physical or electronic mail,
you may find current contact information at www.novell.com.
**************************************************************************/
using System;
using Novell.CASA;
namespace cSharpTest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
private static string APPID = "cSharpAppID";
//private static string SHARED_ID = "cSharp_SharedID";
private static string USERNAME = "Admin.nov<6F>ll";
private static string PASSWORD = "PasswordFor<6F>Admin";
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("**************************************************");
Console.WriteLine("********** miCASA Sample written in C# ***********");
Console.WriteLine("**************************************************");
ShowMenu();
}
static private void ShowMenu()
{
while (true)
{
Console.WriteLine();
Console.WriteLine("********** Menu ***********");
Console.WriteLine("* 1. Add secret *");
Console.WriteLine("* 2. Display secret *");
Console.WriteLine("* 3. Remove secret *");
Console.WriteLine("* 4. Run automated test *");
Console.WriteLine("* 5. Quit *");
Console.WriteLine("***************************");
Console.WriteLine("Select option and Press enter");
String line = Console.ReadLine();
if (line.Length > 0)
{
char[] c = line.Substring(0, 1).ToCharArray();
if (c.Length > 0)
{
if (c[0].Equals('5'))
break;
if (c[0].Equals('1'))
AddSecret();
else if (c[0].Equals('2'))
DisplaySecret();
else if (c[0].Equals('3'))
RemoveSecret();
else if (c[0].Equals('4'))
RunTest();
}
}
}
}
static private void AddSecret()
{
while (true)
{
Console.Write("Enter SecretID: ");
String sID = Console.ReadLine();
Console.Write("Enter Username: ");
String sUsername = Console.ReadLine();
Console.Write("Enter Password: ");
String sPassword = Console.ReadLine();
if (sID != null && sUsername != null && sPassword != null)
{
try
{
//miCASA.SetBasicCredential(sID, null, sUsername, sPassword);
miCASA.SetCredential(0, sID, null, miCASA.USERNAME_TYPE_CN_F, sUsername, sPassword);
}
catch (miCasaException e)
{
Console.WriteLine(e.getMessage());
}
return;
}
else
{
Console.WriteLine("Invalid input, try again");
}
}
}
static private void RemoveSecret()
{
Console.Write("Enter SecretID to remove: ");
String sID = Console.ReadLine();
if (sID != null)
{
try
{
miCASA.RemoveBasicCredential(sID, null);
}
catch (miCasaException e)
{
Console.WriteLine(e.getMessage());
}
}
}
static private void DisplaySecret()
{
Console.Write("Enter SecretID to display: ");
String sID = Console.ReadLine();
if (sID != null)
{
try
{
BasicCredential bc;
//bc = miCASA.GetBasicCredential(sID, null);
bc = miCASA.GetCredential(0, sID, null, miCASA.USERNAME_TYPE_CN_F);
if (bc != null)
{
Console.WriteLine("Data for "+sID);
Console.WriteLine("------------------------");
Console.WriteLine("Username:" + bc.GetUsername());
Console.WriteLine("Password:" + bc.GetPassword());
Console.WriteLine("------------------------");
Console.WriteLine("Press the Enter key to continue");
Console.ReadLine();
}
else
Console.WriteLine(sID + " not found");
}
catch (miCasaException e)
{
Console.WriteLine(e.getMessage());
}
}
}
static private void RunTest()
{
int count = 1;
Console.Write("Enter times to run: ");
String sCount = Console.ReadLine();
try
{
int icount = int.Parse(sCount);
count = icount;
}
catch (Exception)
{
}
for (int i=0; i<count; i++)
{
Console.Write("Setting Credential .....");
try
{
miCASA.SetBasicCredential(APPID, null, USERNAME, PASSWORD);
Console.WriteLine("Succeeded");
}
catch (Exception e)
{
Console.WriteLine("Failed");
Console.WriteLine(e.ToString());
Console.WriteLine(e.StackTrace.ToString());
return;
}
Console.WriteLine("");
// did we get it the credential back
Console.WriteLine("Getting Credential .....");
try
{
BasicCredential bc = miCASA.GetBasicCredential(APPID, null);
if (bc != null)
{
if (bc.GetUsername().Equals(USERNAME))
Console.WriteLine(" Username matched : "+bc.GetUsername());
if (bc.GetPassword().Equals(PASSWORD))
Console.WriteLine(" Password matched : "+bc.GetPassword());
}
else
{
Console.WriteLine("Failed");
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
try
{
Console.WriteLine("\r\nRemoving Credential");
miCASA.RemoveBasicCredential(APPID, null);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
try
{
BasicCredential bc = miCASA.GetBasicCredential(APPID, null);
if (bc != null)
{
Console.WriteLine("\r\nCredential exists and should not - FAILED!");
}
else
Console.WriteLine("\r\nCredential not found as expected - SUCCESS!");
}
catch (Exception)
{
Console.WriteLine("\r\n Credential not found as expected - SUCCESS!");
}
Console.WriteLine("Test completed ");
}
}
}
}

View File

@@ -0,0 +1,109 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{3FB57160-F475-4650-A45C-19D020661A2D}"
>
<Build>
<Settings
ApplicationIcon = "App.ico"
AssemblyKeyContainerName = ""
AssemblyName = "CSharpSample"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "cSharpTest"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "Novell.CASA.miCASAWrapper"
Project = "{E21DD887-22F4-4935-9851-409715F663B0}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.ico"
BuildAction = "Content"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "cSharpSample.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,48 @@
<VisualStudioProject>
<CSHARP LastOpenVersion = "7.10.3077" >
<Build>
<Settings ReferencePath = "D:\ccm\SSClient\SecretStoreClient_src\c_sharp\NSSCSWrapper\bin\Debug\;D:\ccm\SSClient\SecretStoreClient_src\c_sharp\NSSCSWrapper\bin\Release\" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = "1"
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = "2"
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "false"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cSharpSample", "cSharpSample.csproj", "{3FB57160-F475-4650-A45C-19D020661A2D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{3FB57160-F475-4650-A45C-19D020661A2D}.Debug.ActiveCfg = Debug|.NET
{3FB57160-F475-4650-A45C-19D020661A2D}.Debug.Build.0 = Debug|.NET
{3FB57160-F475-4650-A45C-19D020661A2D}.Release.ActiveCfg = Release|.NET
{3FB57160-F475-4650-A45C-19D020661A2D}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,8 @@
OBJS=\
BasicCredential\
miCASA\
AssemblyInfo\
NativeCalls\
Secret\
SecretStore

View File

@@ -0,0 +1,4 @@
OBJS=\
cSharpSample\
AssemblyInfo

View File

@@ -0,0 +1,8 @@
SRC=\
BasicCredential.cs\
miCASA.cs\
AssemblyInfo.cs\
NativeCalls.cs\
Secret.cs\
SecretStore.cs

View File

@@ -0,0 +1,3 @@
SRC=\
cSharpSample.cs\
AssemblyInfo.cs