static public int getCertLength(IntPtr username) { localhost.DSWS ws = new localhost.DSWS(); string myUsername = Marshal.PtrToStringAnsi(username); byte[] result = ws.GetUserCertificate(myUsername); return(result.Count()); }
static public IntPtr getCert(IntPtr username) { localhost.DSWS ws = new localhost.DSWS(); string myUsername = Marshal.PtrToStringAnsi(username); byte[] result = ws.GetUserCertificate(myUsername); IntPtr final = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * result.Count()); Marshal.Copy(result, 0, final, result.Count()); return(final); }