Clean up C# wrappers for NSL use.
This commit is contained in:
parent
3d1b7f16e7
commit
52ccbd37a7
@ -48,7 +48,7 @@ namespace Novell.CASA.DataEngines
|
||||
{
|
||||
|
||||
//TBD: What happens here at miCASA end ?
|
||||
store = SecretStore.getInstance();
|
||||
store = SecretStore.GetInstance();
|
||||
}
|
||||
|
||||
public XmlNode Aggregate()
|
||||
@ -69,7 +69,7 @@ namespace Novell.CASA.DataEngines
|
||||
doc.AppendChild(elem);
|
||||
|
||||
|
||||
StringCollection sc = store.enumerateSecretIDs();
|
||||
StringCollection sc = store.EnumerateSecretIDs();
|
||||
if (sc != null)
|
||||
{
|
||||
// Adding Keychain
|
||||
@ -89,8 +89,8 @@ namespace Novell.CASA.DataEngines
|
||||
{
|
||||
|
||||
|
||||
Secret secret = store.getSecret(se.Current);
|
||||
NameValueCollection nvc = secret.getKeyValueCollection();
|
||||
Secret secret = store.GetSecret(se.Current);
|
||||
NameValueCollection nvc = secret.GetKeyValueCollection();
|
||||
|
||||
mi_secret = doc.CreateElement(ConstStrings.CCF_SECRET);
|
||||
synchAttr = doc.CreateAttribute(ConstStrings.CCF_SYNCH);
|
||||
@ -189,10 +189,10 @@ namespace Novell.CASA.DataEngines
|
||||
{
|
||||
|
||||
XmlAttributeCollection atcol = secret.Attributes;
|
||||
String secretid = atcol["ID"].InnerXml;
|
||||
Secret secretVal = store.getSecret(secretid);
|
||||
String secretid = atcol["ID"].InnerXml;
|
||||
Secret secretVal = store.GetSecret(secretid);
|
||||
|
||||
NameValueCollection nvc = secretVal.getKeyValueCollection();
|
||||
NameValueCollection nvc = secretVal.GetKeyValueCollection();
|
||||
ArrayList existingKeyList;
|
||||
|
||||
if (nvc.Count == 0)
|
||||
@ -229,18 +229,18 @@ namespace Novell.CASA.DataEngines
|
||||
string key = (string)etor.Current;
|
||||
if(KeyInNewList(newNVC,key) == false)
|
||||
{
|
||||
secretVal.removeKey(key,0);
|
||||
secretVal.RemoveKey(key,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i = 0 ; i < newNVC.Count ; i++)
|
||||
{
|
||||
string key = newNVC.GetKey(i);
|
||||
secretVal.setKeyValuePair(key,newNVC.Get(key));
|
||||
secretVal.SetKeyValuePair(key,newNVC.Get(key));
|
||||
}
|
||||
|
||||
// TBD: Return Value ??
|
||||
store.setSecret(0, secretVal, Secret.SS_CREDSET);
|
||||
store.SetSecret(0, secretVal, Secret.SS_CREDSET);
|
||||
|
||||
return ConstStrings.CASA_SUCCESS;
|
||||
|
||||
@ -266,8 +266,8 @@ namespace Novell.CASA.DataEngines
|
||||
XmlAttributeCollection atcol = secret.Attributes;
|
||||
String secretid = atcol["ID"].InnerXml;
|
||||
|
||||
Secret secretVal = store.getSecret(secretid);
|
||||
NameValueCollection nvc = secretVal.getKeyValueCollection();
|
||||
Secret secretVal = store.GetSecret(secretid);
|
||||
NameValueCollection nvc = secretVal.GetKeyValueCollection();
|
||||
|
||||
if (nvc.Count == 0)
|
||||
{
|
||||
@ -358,7 +358,7 @@ namespace Novell.CASA.DataEngines
|
||||
String secretid = atcol["ID"].InnerXml;
|
||||
|
||||
//TBD: Why no other overloaded API
|
||||
store.removeSecret(secretid.Substring(secretid.IndexOf(":")+1), Secret.SS_CREDSET);
|
||||
store.RemoveSecret(secretid.Substring(secretid.IndexOf(":")+1), Secret.SS_CREDSET);
|
||||
|
||||
|
||||
XmlNode root = secret.ParentNode;
|
||||
|
@ -98,9 +98,9 @@ namespace Novell.CASA.GUI
|
||||
|
||||
// check for conflicts
|
||||
if (m_ss == null)
|
||||
m_ss = SecretStore.getInstance();
|
||||
m_ss = SecretStore.GetInstance();
|
||||
|
||||
m_scConflicts = m_ss.enumerateSecretIDs(SecretStore.SSCS_CONFLICT_KEYCHAIN);
|
||||
m_scConflicts = m_ss.EnumerateSecretIDs(SecretStore.SSCS_CONFLICT_KEYCHAIN);
|
||||
if (m_scConflicts.Count > 0)
|
||||
{
|
||||
HandleConficts(m_ss, m_scConflicts);
|
||||
@ -188,9 +188,9 @@ namespace Novell.CASA.GUI
|
||||
|
||||
// check for conflicts
|
||||
if (m_ss == null)
|
||||
m_ss = SecretStore.getInstance();
|
||||
m_ss = SecretStore.GetInstance();
|
||||
|
||||
m_scConflicts = m_ss.enumerateSecretIDs(SecretStore.SSCS_CONFLICT_KEYCHAIN);
|
||||
m_scConflicts = m_ss.EnumerateSecretIDs(SecretStore.SSCS_CONFLICT_KEYCHAIN);
|
||||
if (m_scConflicts.Count > 0)
|
||||
{
|
||||
HandleConficts(m_ss, m_scConflicts);
|
||||
@ -226,7 +226,7 @@ namespace Novell.CASA.GUI
|
||||
while (sEnum.MoveNext())
|
||||
{
|
||||
string sSecretID = sEnum.Current;
|
||||
Secret currentSecret = store.getSecret(sSecretID);
|
||||
Secret currentSecret = store.GetSecret(sSecretID);
|
||||
|
||||
string sConflictSecretID;
|
||||
if (sSecretID.StartsWith("SS_CredSet"))
|
||||
@ -237,11 +237,11 @@ namespace Novell.CASA.GUI
|
||||
{
|
||||
sConflictSecretID = sSecretID;
|
||||
}
|
||||
Secret conflictSecret = store.getSecret(SecretStore.SSCS_CONFLICT_KEYCHAIN, 0, sConflictSecretID, Secret.SS_CREDSET, "");
|
||||
Secret conflictSecret = store.GetSecret(SecretStore.SSCS_CONFLICT_KEYCHAIN, 0, sConflictSecretID, Secret.SS_CREDSET, "");
|
||||
|
||||
// add this conflict to the treestore
|
||||
NameValueCollection nvcConflict = conflictSecret.getKeyValueCollection();
|
||||
NameValueCollection nvcCurrent = currentSecret.getKeyValueCollection();
|
||||
NameValueCollection nvcConflict = conflictSecret.GetKeyValueCollection();
|
||||
NameValueCollection nvcCurrent = currentSecret.GetKeyValueCollection();
|
||||
for (int i = 0; i < nvcConflict.Count; i++)
|
||||
{
|
||||
String sConflictKey = nvcConflict.GetKey(i);
|
||||
@ -419,7 +419,7 @@ namespace Novell.CASA.GUI
|
||||
{
|
||||
sSecretID = sSecretID.Substring(11);
|
||||
}
|
||||
m_ss.removeSecret(0, SecretStore.SSCS_CONFLICT_KEYCHAIN, null, sSecretID, Secret.SS_CREDSET);
|
||||
m_ss.RemoveSecret(0, SecretStore.SSCS_CONFLICT_KEYCHAIN, null, sSecretID, Secret.SS_CREDSET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ public class MiCasa : Store
|
||||
|
||||
for( int i=0; i< keys.Length; i++ )
|
||||
{
|
||||
Secret secret = ss.getSecret(selected);
|
||||
Secret secret = ss.GetSecret(selected);
|
||||
|
||||
Hashtable ht = secret.GetLinkedKeys(keys[i]);
|
||||
|
||||
@ -1171,7 +1171,7 @@ public class MiCasa : Store
|
||||
|
||||
// show secretIDs
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
StringCollection sc = ss.enumerateSecretIDs();
|
||||
StringCollection sc = ss.EnumerateSecretIDs();
|
||||
StringEnumerator se = sc.GetEnumerator();
|
||||
se.Reset();
|
||||
while (se.MoveNext())
|
||||
@ -1195,7 +1195,7 @@ public class MiCasa : Store
|
||||
tvLinkedKeys.AppendColumn("Key", new CellRendererText(), "text", 1);
|
||||
tvLinkedKeys.Model=tsLinkedKeys;
|
||||
|
||||
Secret secret = ss.getSecret(entrySecretID.Text);
|
||||
Secret secret = ss.GetSecret(entrySecretID.Text);
|
||||
ShowLinkedKeys(secret, selected);
|
||||
|
||||
// display info on this secret
|
||||
@ -1242,8 +1242,8 @@ public class MiCasa : Store
|
||||
if(selected != null && selected.Length > 0)
|
||||
{
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
Secret secret = ss.getSecret(selected);
|
||||
NameValueCollection nvc = secret.getKeyValueCollection();
|
||||
Secret secret = ss.GetSecret(selected);
|
||||
NameValueCollection nvc = secret.GetKeyValueCollection();
|
||||
for (int i=0; i<nvc.Count; i++)
|
||||
{
|
||||
// don't allow linking this key to ourself.
|
||||
@ -1281,7 +1281,7 @@ public class MiCasa : Store
|
||||
LinkedKeyInfo lki = new LinkedKeyInfo(selectedSecret, selectedKey);
|
||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_SET_LINKED_KEY, null, labelLinkSecretID.Text, labelLinkKeyID.Text, lki);
|
||||
|
||||
Secret secret = GetMiCasaStore().getSecret(entrySecretID.Text);
|
||||
Secret secret = GetMiCasaStore().GetSecret(entrySecretID.Text);
|
||||
ShowLinkedKeys(secret, labelLinkKeyID.Text);
|
||||
AggregateStore();
|
||||
}
|
||||
@ -1304,7 +1304,7 @@ public class MiCasa : Store
|
||||
LinkedKeyInfo lki = new LinkedKeyInfo(selectedSecret, selectedKey);
|
||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_LINKED_KEY, null, labelLinkSecretID.Text, labelLinkKeyID.Text, lki);
|
||||
|
||||
Secret secret = GetMiCasaStore().getSecret(entrySecretID.Text);
|
||||
Secret secret = GetMiCasaStore().GetSecret(entrySecretID.Text);
|
||||
ShowLinkedKeys(secret, labelLinkKeyID.Text);
|
||||
AggregateStore();
|
||||
}
|
||||
@ -1313,7 +1313,7 @@ public class MiCasa : Store
|
||||
private SecretStore GetMiCasaStore()
|
||||
{
|
||||
if (m_store == null)
|
||||
m_store = SecretStore.getInstance();
|
||||
m_store = SecretStore.GetInstance();
|
||||
|
||||
return m_store;
|
||||
}
|
||||
@ -1333,9 +1333,9 @@ public class MiCasa : Store
|
||||
if (sNewKeyValue != null)
|
||||
{
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
Secret secret = ss.getSecret(labelLinkSecretID.Text);
|
||||
secret.setKeyValuePair(labelLinkKeyID.Text, sNewKeyValue);
|
||||
ss.setSecret(0, secret, Secret.SS_CREDSET);
|
||||
Secret secret = ss.GetSecret(labelLinkSecretID.Text);
|
||||
secret.SetKeyValuePair(labelLinkKeyID.Text, sNewKeyValue);
|
||||
ss.SetSecret(0, secret, Secret.SS_CREDSET);
|
||||
sNewKeyValue = null;
|
||||
}
|
||||
}
|
||||
@ -1429,8 +1429,8 @@ public class MiCasa : Store
|
||||
{
|
||||
// read value from store
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
Secret secret = ss.getSecret(entrySecretID.Text);
|
||||
value = secret.getKeyValue(selected);
|
||||
Secret secret = ss.GetSecret(entrySecretID.Text);
|
||||
value = secret.GetKeyValue(selected);
|
||||
|
||||
// strip of header data
|
||||
byte[] baValue = System.Text.Encoding.ASCII.GetBytes(value);
|
||||
|
@ -56,8 +56,8 @@ namespace Novell.CASA.GUI
|
||||
applybuttonPersistent.Sensitive = false;
|
||||
|
||||
// load store
|
||||
SecretStore ss = SecretStore.getInstance();
|
||||
StringCollection sc = ss.enumerateSecretIDs();
|
||||
SecretStore ss = SecretStore.GetInstance();
|
||||
StringCollection sc = ss.EnumerateSecretIDs();
|
||||
StringEnumerator senum = sc.GetEnumerator();
|
||||
|
||||
// load policy
|
||||
|
@ -222,8 +222,8 @@ namespace Novell.CASA
|
||||
|
||||
private const string NDK_LIBRARY = "micasa";
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASARemoveCredential
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASARemoveCredential
|
||||
(
|
||||
[In] uint ssFlags, // IN
|
||||
[In] SSCS_SECRET_ID_T appSecretID,
|
||||
@ -233,8 +233,8 @@ namespace Novell.CASA
|
||||
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAGetCredential
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAGetCredential
|
||||
(
|
||||
[In] uint ssFlags, // IN
|
||||
[In] SSCS_SECRET_ID_T appSecretID,
|
||||
@ -245,8 +245,8 @@ namespace Novell.CASA
|
||||
);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASASetCredential
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASASetCredential
|
||||
(
|
||||
[In] uint ssFlags, // IN
|
||||
[In] SSCS_SECRET_ID_T appSecretID,
|
||||
@ -255,24 +255,24 @@ namespace Novell.CASA
|
||||
[In] IntPtr credential,
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASASetMasterPasscode
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASASetMasterPasscode
|
||||
(
|
||||
[In] uint ssFlags,
|
||||
[In] SSCS_PASSCODE_T passcode,
|
||||
[In] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAIsSecretPersistent
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAIsSecretPersistent
|
||||
(
|
||||
[In] uint ssFlags,
|
||||
[In] SSCS_SECRET_ID_T secretID,
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern IntPtr miCASAOpenSecretStoreCache
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern IntPtr miCASAOpenSecretStoreCache
|
||||
(
|
||||
[In, Out] SSCS_SECRET_STORE_ID_T ssid,
|
||||
uint ssFlags,
|
||||
@ -289,8 +289,8 @@ namespace Novell.CASA
|
||||
);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY) ]
|
||||
public static extern int miCASAReadSecret
|
||||
[DllImport(NDK_LIBRARY) ]
|
||||
internal static extern int miCASAReadSecret
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] SSCS_KEYCHAIN_ID_T keyChainID,
|
||||
@ -304,8 +304,8 @@ namespace Novell.CASA
|
||||
|
||||
|
||||
// TODO: check the order of these paramters
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASARemoveSecret
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASARemoveSecret
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] SSCS_KEYCHAIN_ID_T keyChainID,
|
||||
@ -316,8 +316,8 @@ namespace Novell.CASA
|
||||
);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAWriteSecret
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAWriteSecret
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] SSCS_KEYCHAIN_ID_T keyChainID,
|
||||
@ -328,8 +328,8 @@ namespace Novell.CASA
|
||||
[In] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAGetStoreInformation
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAGetStoreInformation
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -337,8 +337,8 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAEnumerateSecretIDs
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAEnumerateSecretIDs
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] SSCS_KEYCHAIN_ID_T keyChainID,
|
||||
@ -348,8 +348,8 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAEnumerateKeyChainIDs
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAEnumerateKeyChainIDs
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -358,16 +358,16 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASARemoveSecretStore
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASARemoveSecretStore
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASASetMasterPassword
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASASetMasterPassword
|
||||
(
|
||||
[In] uint ssFlags,
|
||||
[In] SSCS_PASSWORD_T password,
|
||||
@ -384,16 +384,16 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASALockStore
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASALockStore
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAUnlockStore
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAUnlockStore
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -402,8 +402,8 @@ namespace Novell.CASA
|
||||
);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASARemoveKeyChain
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASARemoveKeyChain
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -411,8 +411,8 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASAAddKeyChain
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASAAddKeyChain
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -424,16 +424,16 @@ namespace Novell.CASA
|
||||
//* Support Functions for processing (populating or extracting)
|
||||
//* data components from a Shared Secret
|
||||
//**************************************************************
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern IntPtr miCASA_CreateSHSHandle();
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern IntPtr miCASA_CreateSHSHandle();
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASA_DestroySHSHandle(
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASA_DestroySHSHandle(
|
||||
[In] IntPtr secretHandle);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None) ]
|
||||
public static extern int miCASA_GetNextSHSEntry
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None) ]
|
||||
internal static extern int miCASA_GetNextSHSEntry
|
||||
(
|
||||
[In] int restart, //* in (set to 1 to begin from head of list)
|
||||
[In] IntPtr secretHandle, //* in
|
||||
@ -444,8 +444,8 @@ namespace Novell.CASA
|
||||
);
|
||||
|
||||
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None)]
|
||||
public static extern int miCASA_AddSHSEntry
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None)]
|
||||
internal static extern int miCASA_AddSHSEntry
|
||||
(
|
||||
[In] IntPtr secretHandle, //* in]
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
@ -455,8 +455,8 @@ namespace Novell.CASA
|
||||
string val //* in /uchar
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None)]
|
||||
public static extern int miCASAWriteKey
|
||||
[DllImport(NDK_LIBRARY, CharSet=CharSet.None)]
|
||||
internal static extern int miCASAWriteKey
|
||||
(
|
||||
[In] IntPtr context,
|
||||
[In] uint ssFlags,
|
||||
@ -472,8 +472,8 @@ namespace Novell.CASA
|
||||
[In, Out] SSCS_EXT_T ext
|
||||
);
|
||||
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
public static extern int miCASA_RemoveSHSEntry
|
||||
[DllImport(NDK_LIBRARY)]
|
||||
internal static extern int miCASA_RemoveSHSEntry
|
||||
(
|
||||
[In] IntPtr secretHandle, //* in
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
@ -486,7 +486,7 @@ namespace Novell.CASA
|
||||
|
||||
|
||||
// Methods start here
|
||||
internal IntPtr openSecretStore(string sSecretStoreName)
|
||||
internal IntPtr OpenSecretStore(string sSecretStoreName)
|
||||
{
|
||||
|
||||
//check params
|
||||
@ -510,13 +510,13 @@ namespace Novell.CASA
|
||||
}
|
||||
}
|
||||
|
||||
internal void closeSecretStore(IntPtr hSC)
|
||||
internal void CloseSecretStore(IntPtr hSC)
|
||||
{
|
||||
SSCS_EXT_T ext = new SSCS_EXT_T();
|
||||
miCASACloseSecretStoreCache(hSC, 0, ext);
|
||||
}
|
||||
|
||||
internal Secret getSecret(
|
||||
internal Secret GetSecret(
|
||||
IntPtr pHsc,
|
||||
string sKeyChainID,
|
||||
uint iFlags,
|
||||
@ -572,19 +572,19 @@ namespace Novell.CASA
|
||||
|
||||
// create new secret
|
||||
Secret temp = new Secret(pHsc, sKeyChainID, iFlags, pSecretHandle, sSharedSecretID, sharedSecretID.type, sEPPassword);
|
||||
temp.setTimeStamps(readData.crtStamp, readData.lmtStamp, readData.latStamp);
|
||||
temp.SetTimeStamps(readData.crtStamp, readData.lmtStamp, readData.latStamp);
|
||||
|
||||
|
||||
// if read was sucessful, read key value pairs
|
||||
if (rcode == 0)
|
||||
loadKeyValuePairs(temp);
|
||||
LoadKeyValuePairs(temp);
|
||||
// else
|
||||
// throw new Exception();
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
internal void loadKeyValuePairs(Secret secret)
|
||||
internal void LoadKeyValuePairs(Secret secret)
|
||||
{
|
||||
int rcode=0;
|
||||
int iStart = 1;
|
||||
@ -636,7 +636,7 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
if (sKey != null && sValue != null)
|
||||
secret.setKeyValuePair(sKey, sValue);
|
||||
secret.SetKeyValuePair(sKey, sValue);
|
||||
|
||||
|
||||
iStart = 0;
|
||||
@ -647,7 +647,7 @@ namespace Novell.CASA
|
||||
Marshal.FreeHGlobal(theValue);
|
||||
}
|
||||
|
||||
internal static int removeKeyValue(
|
||||
internal static int RemoveKeyValue(
|
||||
IntPtr pSecretHandle,
|
||||
string sKey,
|
||||
string sValue,
|
||||
@ -781,7 +781,7 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
|
||||
internal int setSecret(
|
||||
internal int SetSecret(
|
||||
IntPtr pHsc,
|
||||
string sKeyChainID,
|
||||
uint iFlags,
|
||||
@ -807,15 +807,15 @@ namespace Novell.CASA
|
||||
// setup keychainid
|
||||
keyChainID.len = sKeyChainID.Length + 1;
|
||||
|
||||
String tempStr = secret.getID();
|
||||
String tempStr = secret.GetID();
|
||||
sharedSecretID.name = tempStr;
|
||||
sharedSecretID.len = (tempStr.Length + 1) * 2;
|
||||
sharedSecretID.type = iSecretType; // TODO: type APP(1), CRED(2), or Binary(4)
|
||||
|
||||
if (secret.getEnhancedProtectionPassword() != null)
|
||||
if (secret.GetEnhancedProtectionPassword() != null)
|
||||
{
|
||||
epPassword.pword = secret.getEnhancedProtectionPassword();
|
||||
epPassword.pwordLen = (uint)secret.getEnhancedProtectionPassword().Length + 1;
|
||||
epPassword.pword = secret.GetEnhancedProtectionPassword();
|
||||
epPassword.pwordLen = (uint)secret.GetEnhancedProtectionPassword().Length + 1;
|
||||
epPassword.pwordType = 0;
|
||||
}
|
||||
else
|
||||
@ -831,12 +831,12 @@ namespace Novell.CASA
|
||||
rcode = miCASA_AddSHSEntry(
|
||||
secret.m_secretHandle,
|
||||
"SS_Binary",
|
||||
(uint)secret.getBinaryValue().Length,
|
||||
secret.getBinaryValue().ToString());
|
||||
(uint)secret.GetBinaryValue().Length,
|
||||
secret.GetBinaryValue().ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
NameValueCollection nvc = secret.getKeyValueCollection();
|
||||
NameValueCollection nvc = secret.GetKeyValueCollection();
|
||||
if (nvc != null)
|
||||
{
|
||||
for (int i=0; i<nvc.Count; i++)
|
||||
@ -852,7 +852,7 @@ namespace Novell.CASA
|
||||
{
|
||||
object o = MiCasaRequestReply.Send(MiCasaRequestReply.VERB_WRITE_KEY,
|
||||
sKeyChainID,
|
||||
secret.getID(),
|
||||
secret.GetID(),
|
||||
sKey,
|
||||
EscapeReservedChars(sValue));
|
||||
|
||||
@ -882,7 +882,7 @@ namespace Novell.CASA
|
||||
try
|
||||
{
|
||||
|
||||
ArrayList keyList = (ArrayList)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_KEY_LIST,sKeyChainID,secret.getID(),null,null);
|
||||
ArrayList keyList = (ArrayList)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_KEY_LIST,sKeyChainID,secret.GetID(),null,null);
|
||||
|
||||
if( null != keyList )
|
||||
{
|
||||
@ -892,7 +892,7 @@ namespace Novell.CASA
|
||||
string key = (string)etor.Current;
|
||||
if(KeyInNewList(nvc,key) == false)
|
||||
{
|
||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_KEY,sKeyChainID,secret.getID(),key, null );
|
||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_KEY,sKeyChainID,secret.GetID(),key, null );
|
||||
}
|
||||
|
||||
}
|
||||
@ -1043,9 +1043,9 @@ namespace Novell.CASA
|
||||
Marshal.FreeHGlobal(idList.secretIDList);
|
||||
return sc;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKeyChain(
|
||||
}
|
||||
|
||||
internal void AddKeyChain(
|
||||
IntPtr context,
|
||||
uint ssFlags,
|
||||
string sKeyChainID)
|
||||
@ -1060,10 +1060,10 @@ namespace Novell.CASA
|
||||
|
||||
SSCS_EXT_T ext = new SSCS_EXT_T();
|
||||
int rcode = miCASAAddKeyChain(context, ssFlags, keyChainID, ext);
|
||||
}
|
||||
|
||||
|
||||
public static BasicCredential GetCredential(
|
||||
}
|
||||
|
||||
|
||||
internal static BasicCredential GetCredential(
|
||||
uint ssFlags,
|
||||
string sAppSecretID,
|
||||
string sSharedSecretID,
|
||||
@ -1130,10 +1130,10 @@ namespace Novell.CASA
|
||||
throw new miCasaException(rcode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void SetCredential(
|
||||
}
|
||||
|
||||
|
||||
internal static void SetCredential(
|
||||
uint ssFlags,
|
||||
string sAppSecretID,
|
||||
string sSharedSecretID,
|
||||
@ -1188,7 +1188,7 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
|
||||
public static void RemoveCredential(
|
||||
internal static void RemoveCredential(
|
||||
uint ssFlags,
|
||||
string sAppSecretID,
|
||||
string sSharedSecretID)
|
||||
@ -1255,8 +1255,8 @@ namespace Novell.CASA
|
||||
//Console.WriteLine(e.ToString());
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
public static int SetMasterPassword(
|
||||
}
|
||||
internal static int SetMasterPassword(
|
||||
uint ssFlags,
|
||||
string mPasswd)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
|
||||
public void openSocket(string serverAddr, string sPort)
|
||||
public void OpenSocket(string serverAddr, string sPort)
|
||||
{
|
||||
// Create a channel for communicating w/ the remote object
|
||||
// Notice no port is specified on the client
|
||||
@ -63,7 +63,7 @@ namespace Novell.CASA
|
||||
"tcp://"+serverAddr + ":" + sPort + "/enumerateSecretIDs" );
|
||||
}
|
||||
|
||||
public void closeSocket()
|
||||
public void CloseSocket()
|
||||
{
|
||||
if (chan != null)
|
||||
{
|
||||
@ -73,7 +73,7 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
|
||||
public StringCollection getRemoteSecretIDS()
|
||||
public StringCollection GetRemoteSecretIDS()
|
||||
{
|
||||
// Use the object
|
||||
try
|
||||
@ -86,7 +86,7 @@ namespace Novell.CASA
|
||||
else
|
||||
{
|
||||
//Console.WriteLine(obj.enumerateSecretIDs());
|
||||
return obj.enumerateSecretIDs();
|
||||
return obj.EnumerateSecretIDs();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -95,7 +95,7 @@ namespace Novell.CASA
|
||||
}
|
||||
}
|
||||
|
||||
public Secret getRemoteSecret(string id)
|
||||
public Secret GetRemoteSecret(string id)
|
||||
{
|
||||
|
||||
if (obj.Equals(null))
|
||||
@ -104,7 +104,7 @@ namespace Novell.CASA
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj.getSecret(id);
|
||||
return obj.GetSecret(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace Novell.CASA
|
||||
//
|
||||
}
|
||||
|
||||
public void startServer(int port)
|
||||
public void StartServer(int port)
|
||||
{
|
||||
int iPort = port;
|
||||
if (iPort == 0)
|
||||
@ -75,7 +75,7 @@ namespace Novell.CASA
|
||||
//return 0;
|
||||
}
|
||||
|
||||
public void stopServer()
|
||||
public void StopServer()
|
||||
{
|
||||
if (channel != null)
|
||||
{
|
||||
|
@ -87,12 +87,12 @@ namespace Novell.CASA
|
||||
|
||||
// TO clean up SecretHandle
|
||||
|
||||
public string getID()
|
||||
public string GetID()
|
||||
{
|
||||
return m_secretID;
|
||||
}
|
||||
|
||||
public void setKeyValuePair(string sKey, string sKeyValue)
|
||||
public void SetKeyValuePair(string sKey, string sKeyValue)
|
||||
{
|
||||
if (m_type == Secret.SS_APP)
|
||||
m_nvc.Add(sKey, sKeyValue);
|
||||
@ -100,13 +100,13 @@ namespace Novell.CASA
|
||||
m_nvc.Set(sKey, sKeyValue);
|
||||
}
|
||||
|
||||
public byte[] getBinaryValue()
|
||||
public byte[] GetBinaryValue()
|
||||
{
|
||||
return m_baValue;
|
||||
}
|
||||
|
||||
// used for binary secrets, throws exception if not
|
||||
public void setBinaryValue(byte[] baData)
|
||||
public void SetBinaryValue(byte[] baData)
|
||||
{
|
||||
// make sure this is a binary secret
|
||||
if (this.m_type == SS_BINARY)
|
||||
@ -119,17 +119,17 @@ namespace Novell.CASA
|
||||
}
|
||||
}
|
||||
|
||||
public string[] getKeyValues(string sKey)
|
||||
public string[] GetKeyValues(string sKey)
|
||||
{
|
||||
return m_nvc.GetValues(sKey);
|
||||
}
|
||||
|
||||
public string getKeyValue(string sKey)
|
||||
public string GetKeyValue(string sKey)
|
||||
{
|
||||
return m_nvc.Get(sKey);
|
||||
}
|
||||
|
||||
public int getSecretType()
|
||||
public int GetSecretType()
|
||||
{
|
||||
return this.m_type;
|
||||
}
|
||||
@ -140,28 +140,28 @@ namespace Novell.CASA
|
||||
// // should be only one key in the NameValueCollection
|
||||
// }
|
||||
|
||||
public NameValueCollection getKeyValueCollection()
|
||||
public NameValueCollection GetKeyValueCollection()
|
||||
{
|
||||
return m_nvc;
|
||||
}
|
||||
|
||||
public void mergeKeyValueCollection(NameValueCollection nvc)
|
||||
public void MergeKeyValueCollection(NameValueCollection nvc)
|
||||
{
|
||||
//if (m_nvc == null)
|
||||
m_nvc = nvc;
|
||||
}
|
||||
|
||||
public void setEnhancedProtectionPassword(string sEPPassword)
|
||||
public void SetEnhancedProtectionPassword(string sEPPassword)
|
||||
{
|
||||
m_epPassword = sEPPassword;
|
||||
}
|
||||
|
||||
internal string getEnhancedProtectionPassword()
|
||||
internal string GetEnhancedProtectionPassword()
|
||||
{
|
||||
return m_epPassword;
|
||||
}
|
||||
|
||||
public bool isEnhancedProtected()
|
||||
public bool IsEnhancedProtected()
|
||||
{
|
||||
if (m_epPassword != null)
|
||||
return true;
|
||||
@ -169,16 +169,16 @@ namespace Novell.CASA
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeKey(string sKey, uint ctxFlags)
|
||||
public void RemoveKey(string sKey, uint ctxFlags)
|
||||
{
|
||||
//call the ndk to remove that one too.
|
||||
NativeCalls.removeKeyValue(this.m_secretHandle, sKey, m_nvc.Get(sKey), ctxFlags);
|
||||
NativeCalls.RemoveKeyValue(this.m_secretHandle, sKey, m_nvc.Get(sKey), ctxFlags);
|
||||
|
||||
// remove from our collection
|
||||
m_nvc.Remove(sKey);
|
||||
}
|
||||
|
||||
internal void setTimeStamps(uint uiCreated, uint uiModified, uint uiAccessed)
|
||||
internal void SetTimeStamps(uint uiCreated, uint uiModified, uint uiAccessed)
|
||||
{
|
||||
m_iCreateTime = uiCreated;
|
||||
m_iModifyTime = uiModified;
|
||||
@ -228,7 +228,7 @@ namespace Novell.CASA
|
||||
null);
|
||||
return dt;
|
||||
}
|
||||
private uint getAccessTime()
|
||||
private uint GetAccessTime()
|
||||
{
|
||||
return m_iAccessTime;
|
||||
}
|
||||
@ -237,7 +237,7 @@ namespace Novell.CASA
|
||||
{
|
||||
Hashtable htLinkedKeys = (Hashtable)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_LINKED_KEYS,
|
||||
null,
|
||||
this.getID(),
|
||||
this.GetID(),
|
||||
sKey,
|
||||
null);
|
||||
|
||||
|
@ -43,17 +43,17 @@ namespace Novell.CASA
|
||||
|
||||
public SecretStore()
|
||||
{
|
||||
doSetup();
|
||||
DoSetup();
|
||||
}
|
||||
|
||||
private void doSetup()
|
||||
private void DoSetup()
|
||||
{
|
||||
m_NativeCalls = new NativeCalls();
|
||||
m_hsc = m_NativeCalls.openSecretStore("SecretStore");
|
||||
m_hsc = m_NativeCalls.OpenSecretStore("SecretStore");
|
||||
//Console.WriteLine("Session handle: {0}", m_hsc);
|
||||
}
|
||||
|
||||
public static SecretStore getInstance()
|
||||
public static SecretStore GetInstance()
|
||||
{
|
||||
SecretStore newSS = new SecretStore();
|
||||
return newSS;
|
||||
@ -62,7 +62,7 @@ namespace Novell.CASA
|
||||
public void ReleaseInstance()
|
||||
{
|
||||
if (m_hsc != IntPtr.Zero)
|
||||
m_NativeCalls.closeSecretStore(m_hsc);
|
||||
m_NativeCalls.CloseSecretStore(m_hsc);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -74,17 +74,17 @@ namespace Novell.CASA
|
||||
*/
|
||||
|
||||
|
||||
public Secret getSecret(string sKeyChainID, uint ssFlags, string sSecretID, int iSecretType, string sEPPassword)
|
||||
public Secret GetSecret(string sKeyChainID, uint ssFlags, string sSecretID, int iSecretType, string sEPPassword)
|
||||
{
|
||||
if (m_NativeCalls != null)
|
||||
return m_NativeCalls.getSecret(m_hsc, sKeyChainID, ssFlags, sSecretID, iSecretType, sEPPassword);
|
||||
return m_NativeCalls.GetSecret(m_hsc, sKeyChainID, ssFlags, sSecretID, iSecretType, sEPPassword);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Secret getSecret(string id)
|
||||
public Secret GetSecret(string id)
|
||||
{
|
||||
string sSecretId = id;
|
||||
int iSecretType = Secret.SS_BINARY;
|
||||
@ -101,42 +101,42 @@ namespace Novell.CASA
|
||||
iSecretType = Secret.SS_APP;
|
||||
}
|
||||
|
||||
return getSecret(0, sSecretId, iSecretType, "");
|
||||
return GetSecret(0, sSecretId, iSecretType, "");
|
||||
}
|
||||
|
||||
public Secret getSecret(uint ssFlags, string sSecretID, int iSecretType, string sEPPassword)
|
||||
public Secret GetSecret(uint ssFlags, string sSecretID, int iSecretType, string sEPPassword)
|
||||
{
|
||||
return getSecret(SESSION_KEY_CHAIN, ssFlags, sSecretID, iSecretType, sEPPassword);
|
||||
return GetSecret(SESSION_KEY_CHAIN, ssFlags, sSecretID, iSecretType, sEPPassword);
|
||||
}
|
||||
|
||||
public void setSecret(uint flags, string sKeyChainID, Secret secret, int iSecretType)
|
||||
public void SetSecret(uint flags, string sKeyChainID, Secret secret, int iSecretType)
|
||||
{
|
||||
m_NativeCalls.setSecret(m_hsc, sKeyChainID, flags, secret, iSecretType);
|
||||
m_NativeCalls.SetSecret(m_hsc, sKeyChainID, flags, secret, iSecretType);
|
||||
}
|
||||
|
||||
public void setSecret(uint flags, Secret secret, int iSecretType)
|
||||
public void SetSecret(uint flags, Secret secret, int iSecretType)
|
||||
{
|
||||
// call the native calls to write this secret
|
||||
m_NativeCalls.setSecret(m_hsc, SESSION_KEY_CHAIN, flags, secret, iSecretType);
|
||||
m_NativeCalls.SetSecret(m_hsc, SESSION_KEY_CHAIN, flags, secret, iSecretType);
|
||||
}
|
||||
|
||||
private void setSecret(uint flags, string sSecretID, string sEPPassword)
|
||||
private void SetSecret(uint flags, string sSecretID, string sEPPassword)
|
||||
{
|
||||
//setSecret(flags, SESSION_KEY_CHAIN, sSecretID, sEPPassword);
|
||||
}
|
||||
|
||||
public void removeSecret(uint ssFlags, string sKeyChainID, string sEPPassword, string sSecretID, int iSecretType)
|
||||
public void RemoveSecret(uint ssFlags, string sKeyChainID, string sEPPassword, string sSecretID, int iSecretType)
|
||||
{
|
||||
m_NativeCalls.RemoveSecret(m_hsc, ssFlags, sKeyChainID, sEPPassword, sSecretID, iSecretType);
|
||||
}
|
||||
|
||||
public void removeSecret(string sSecretID, int iSecretType)
|
||||
public void RemoveSecret(string sSecretID, int iSecretType)
|
||||
{
|
||||
removeSecret(0, SESSION_KEY_CHAIN, "", sSecretID, iSecretType);
|
||||
RemoveSecret(0, SESSION_KEY_CHAIN, "", sSecretID, iSecretType);
|
||||
}
|
||||
|
||||
|
||||
private void enumerateKeychainIDs(string sSearchSting)
|
||||
private void EnumerateKeychainIDs(string sSearchSting)
|
||||
{
|
||||
if (m_NativeCalls != null)
|
||||
{
|
||||
@ -145,22 +145,22 @@ namespace Novell.CASA
|
||||
}
|
||||
|
||||
|
||||
public void setMasterPassword(string sMasterPassword)
|
||||
public void SetMasterPassword(string sMasterPassword)
|
||||
{
|
||||
m_sMasterPassword = sMasterPassword;
|
||||
}
|
||||
|
||||
public StringCollection enumerateSecretIDs()
|
||||
public StringCollection EnumerateSecretIDs()
|
||||
{
|
||||
return enumerateSecretIDs(SESSION_KEY_CHAIN);
|
||||
return EnumerateSecretIDs(SESSION_KEY_CHAIN);
|
||||
}
|
||||
|
||||
|
||||
public StringCollection enumerateSecretIDs(string sKeyChainID)
|
||||
public StringCollection EnumerateSecretIDs(string sKeyChainID)
|
||||
{
|
||||
return m_NativeCalls.EnumerateSecretIDs(m_hsc, 0, sKeyChainID, "");
|
||||
}
|
||||
public void addKeyChain(string sKeyChainID)
|
||||
public void AddKeyChain(string sKeyChainID)
|
||||
{
|
||||
m_NativeCalls.AddKeyChain(m_hsc, 0, sKeyChainID);
|
||||
}
|
||||
|
@ -336,17 +336,17 @@ namespace Novell.CASA
|
||||
m_iException = iException;
|
||||
}
|
||||
|
||||
public string getMessage()
|
||||
public string GetMessage()
|
||||
{
|
||||
return getMessage(m_iException);
|
||||
return GetMessage(m_iException);
|
||||
}
|
||||
|
||||
public int getErrorCode()
|
||||
public int GetErrorCode()
|
||||
{
|
||||
return m_iException;
|
||||
}
|
||||
|
||||
public string getMessage(int iException)
|
||||
public string GetMessage(int iException)
|
||||
{
|
||||
switch (iException)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user