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