Groups | Blog | Home
all groups > sql server reporting services > april 2005 >

sql server reporting services : CUSTOM ASSEMBLY IN RDL - ISSUE - NEED YOUR HELP!


BALAJI KRISHNAN via SQLMonster.com
4/1/2005 11:35:20 AM
Hi All MSTR Mentor's

I have a RDL, where the stored procedure returns 10 fields among that 1
field is the creditcard# which is encrypted, I need to decryt the
creditcard # and display it in the report.

I use a .net custom aseembly which has a decrypt function and it is added
as a reference to the rdl and it is WORKING FINE when i view the report in
the PREVIEW TAB of the report designer.

When I deploy the report to my ReportServer of the localmachine and view
the report it is showing #Error on the field value.

What could be the problem, plese help me on this issue.












using System;
using System.Text;
using System.Collections.Specialized;
using System.Configuration;
using System.Security.Cryptography;
using FCLX509 = System.Security.Cryptography.X509Certificates;
using WSEX509 = Microsoft.Web.Services2.Security.X509;
using WSECRY = Microsoft.Web.Services2.Security.Cryptography;

namespace RDLCustomCode
{
public class DataDecryptionClass
{

public DataDecryptionClass()
{

}

public static string DecryptCardInfo(string cc,string subjectName,string
storeName)
{
try
{
string sCreditCard = "";
WSEX509.X509CertificateStore.StoreLocation location =
WSEX509.X509CertificateStore.StoreLocation.CurrentUser;
WSEX509.X509CertificateStore.StoreProvider provider =
WSEX509.X509CertificateStore.StoreProvider.System;
WSEX509.X509CertificateStore store = new WSEX509.X509CertificateStore
(provider, location, storeName);

bool fopen = store.OpenRead();

if(fopen)
{
WSEX509.X509CertificateCollection certs =
store.FindCertificateBySubjectString(subjectName);
if (certs.Count > 0)
{
WSEX509.X509Certificate cer = certs[0];

WSECRY.RSACryptoServiceProvider rsaCsp =
(WSECRY.RSACryptoServiceProvider)cer.Key;

byte[] cipherData = Convert.FromBase64String(cc);
byte[] plainData = rsaCsp.Decrypt(cipherData, false);
sCreditCard = Encoding.UTF8.GetString(plainData);
}
}

if (store != null)
store.Close();

return sCreditCard;
}
catch
{
return "";
}
}

--
Dmitry Nechipor. [MCDBA]
4/1/2005 10:57:49 PM
Have you copied custom assembly to the ReportServer bin directory (e.g. to
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin)?

[quoted text, click to view]

Suneet
4/2/2005 11:19:04 AM
Please give CAS permission in file:
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\rssrvpolicy.xml

See Online book with RS installation for XML entry for your DLL



[quoted text, click to view]
BALAJI KRISHNAN via SQLMonster.com
4/2/2005 12:18:13 PM
Dmitry Nechipor,
Yes, I have copied the dll in C:\Program Files\Microsoft SQL Server\MSSQL\
ReportingServices\ReportServer\bin.

But still the same result.
Do I need to set CAS to the code..if so how to give the permission.

Balaji

--
BALAJI KRISHNAN via SQLMonster.com
4/4/2005 6:26:18 AM
Hi Sunnet,
I have added the CAS PERMISSION by adding this code group to the
rssrvpolicy.config file on C:\Program Files\Microsoft SQL Server\MSSQL\
Reporting Services\ReportServer

Here is the code I have added to the config file
</CodeGroup>
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="XMLCodeGroup"
Description="Code group for my XML data processing extension">
<IMembershipCondition class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\RDLCustomCode.dll" />
</CodeGroup>

But still I have the same problem.

Balaji

--
BALAJI KRISHNAN via SQLMonster.com
4/4/2005 1:02:45 PM
Hi Sunnet,

C:\Program Files\Microsoft SQL Server\MSSQL\
Reporting Services\ReportServer

I have changed class="AllMembershipCondition" instead of
class="UrlMembershipCondition"
Now, I am not seeing the #Error, but still i could not see the value, it is
blank now....

What could be the problem



<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="Report_Expressions_Default_Permissions"
Description="A special code group for my custom assembly.">
<IMembershipCondition
class="AllMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\RDLCustomCode.dll"
/>

--
AddThis Social Bookmark Button