Smartcardio and reading a cert from a CAC

hey guys, i've managed to communicate successfully to the card reader, but i'm at a bit of a loss in how to read a certificate on the CAC itself. i just need to see the x509 cert and associated chain.
any help much appreciated, thanks!!!

Thanks Adriaan, to answer your questions:
1) CAC is Common Access Card, it has a chip as would be found in some credit cards (like AMEX Blue). It holds a public and private keep of a user. I have been able to get the user certificate in a web application, but I did not have to go directly to the smart card reader for this.
2) Right now I am developing on a Windows platform, but production is Linux and source code is open source. I have been leveraging javax.smartcardio
3) Not sure about this one, I know that for my code to work, the CardTerminal .connect had to be "T=0", hope that helps.
4) Not sure about the protocols really, but for DoD, each workstation has a card reader, and in order for you to log into the machine, you must have a valid CAC.
Here's is the output of my test code so far:
Card_Info: PC/SC card in SCM Microsystems Inc. SCRx31 USB Reader 0, protocol T=0, state OK
Card Protocol: T=0
ATR: [B@5afd29
ATR historical bytes: [B@1a2961b
response0: 6e 00

Similar Messages

  • Automate generation and installation of certs from AD CS over the web?

    We have an environment where there are dozens of separate AD forests, none of which have (or can have) any trust relationships.
    We also have an Active Directory Certificate Server that we use for generating internal certs. This AD CS server is available to all of the servers via the web console (https://some.url/certsrv), but there is no other connectivity to the AD CS other than
    port 443.
    The question is, are there any methods we can use to automate the generation and installation of certs from the AD CS server? Specifically, suppose I am sitting on SERVERX and I am running a script, is it possible to have that script generate and submit
    a cert request to https://some.url/certsrv, then retrieve and install the cert into the machine store?
    The research I have done so far shows that this is typically possible if the CA is part of the same AD forest and is reachable over more ports than just 443.
    Today we do an awkward launch of iexplore and some screen scraping, but it requires manual intervention to get it to work, and we'd like to fully automate the process.

    You should consider to use a certificate enrollment web services (which are intended for such scenarios):
    http://technet.microsoft.com/en-us/library/dd759209.aspx
    My weblog: en-us.sysadmins.lv
    PowerShell PKI Module: pspki.codeplex.com
    PowerShell Cmdlet Help Editor pscmdlethelpeditor.codeplex.com
    Check out new: SSL Certificate Verifier
    Check out new:
    PowerShell FCIV tool.

  • How to open and read many files from a directory and store contents in 2D array?

    I want to make a VI that opens and reads the data from various files contained in a directory (200 files each with 2 columns) and store these in a single 2D array. For file number 1 I want to store the data from both columns in the 2D array, but for files 2 to 200 I only want to store the second column of each file. Can someone please help?

    Hi Nadav,
    Thanks for your help. I have followed your instructions but i cannot get it to work. I used the LIST DIRECTORY to list the files in the directory - that works. However, how do I read each of the 200 files using READ FROM SPREADSHEET FILE without me having to manually select each of the 200 files? So, if I use LIST DIRECTORY to list all 200 files in an array, how do I get each of these to open and store the data in a 2D array? Here is what I have done (File called read_files.VI) Could you please help me? Thank you very much in advance.
    Attachments:
    read_files.vi ‏18 KB

  • How to get and read a file from META-INF directory

    how to get and read a file from META-INF directory in a EJB project

    Use this.getClass().getResourceAsStream("/META-INF/filename");This should work. Probably, you would need to set the Manifest Class-Path attribute.

  • How to write and read Xml file from database if possible?

    Hi all,
    I need to read the .Xml file when receives from Source systems and write the data into the table as well as write in the.xml file thru reading the data from table as per the client needs. I am stranger to this area. Since, please provide some examples how to approach the same.
    Thanks in advance !!
    Regards.
    Vissu.....

    The XML DB forum is better suited to your question.
    It also has a FAQ which details how to read and shred XML into tables as well as other common XML based questions...
    XML DB FAQ

  • Adding and reading the parameters from the WebDynpro Application URL

    Hi,
    I have a WebDynpro Application with two views. Based on the values populated by the user in the first view, I am pulling the data from database and populating the data in the second view. I do have a scenario where I have to skip the first screen and show the second screen directly. But, for the values that has to be populated in first screen, I am planning to append the  parameters in the url and provide the link to the users via email.
    Is it possible to add parameters to URL and read those Parameter values when user clicks on the URL.
    Thanks & Regards
    swetha.

    HI,
    Code for accessing params in webdynpro java:
    String urlParamVal = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("URL_PARAMETER");
    if((urlParamVal != null) && (urlParamVal.trim().length() > 0))
    <Write the code>
    Reading parameters:
    Re: Reading URL Parameter
    How to pass and fetch multiple parameter in the URL of the Web Dynpro
    Regards,
    Lavanya.G

  • How can i open and read  a books from i store on my mac

    Hi
    I whant to buy a books in i store and read them on my mac , but books are only for ipad and iphone , how can i do this

    You're welcome ...
    Check out this thread as well >  How Can I Read iBooks on my Laptop?: Apple Support Communities

  • X.509 cert from a CAC card?

    Our customer has multiple servers and the users will all soon be using their DOD CAC cards (SmartCards mandated by Dept of Defense) to provide an x.509 cert to the server. They don't like the fact that each time they move to another server, they have to pick the cert and provide a PIN number.
    Is there any way that a servlet can capture the user's cert and present it to the other servers in the farm so that the user only has to pick the cert once? I had thought about using an applet, but they are restricted in their connections to only hit the codebase server, therefore my only other real choice is a servlet running on their Domino server...(?)
    Thanks,
    Charlie

    Thanks Adriaan, to answer your questions:
    1) CAC is Common Access Card, it has a chip as would be found in some credit cards (like AMEX Blue). It holds a public and private keep of a user. I have been able to get the user certificate in a web application, but I did not have to go directly to the smart card reader for this.
    2) Right now I am developing on a Windows platform, but production is Linux and source code is open source. I have been leveraging javax.smartcardio
    3) Not sure about this one, I know that for my code to work, the CardTerminal .connect had to be "T=0", hope that helps.
    4) Not sure about the protocols really, but for DoD, each workstation has a card reader, and in order for you to log into the machine, you must have a valid CAC.
    Here's is the output of my test code so far:
    Card_Info: PC/SC card in SCM Microsystems Inc. SCRx31 USB Reader 0, protocol T=0, state OK
    Card Protocol: T=0
    ATR: [B@5afd29
    ATR historical bytes: [B@1a2961b
    response0: 6e 00

  • How to open and read Excel Sheet from SharePoint 2013 Document Library using C# Visual Studio 2012

    Hi,
    To achieve these are the steps that I had followed :
    1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
    2. Add Documnet Library link to Trusted Connection Proivder
    3. Open Visual Studio as Run as Administrator
    4.Create an SharePoint 2013 Empty Project.
    5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
    6.Service added successfully
    7.Create a class file and add the Service Reference namespace
    There is no such class as ExcelService to call. 
    Please let me know if somebody knows how to open the Excel file into C#(2012)  either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
    Requirement is :
    Need to read the excel sheet  from Document Library and transfer all data into DataTable.
    Please help asap. 

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

  • "Error 1 when trying to open and read datalog file from several subVi's

    So, I've been coding up this model based controller and have hit a snag:
    The program starts and opens a datalog file and passes the refnum to two loops.
    At a regular time interval (every 2 minutes), one loop (that's iterating once per second) writes the current information to a datalog file.
    Meanwhile, another loop (that's iterating continuously) checks to see if the file is big enough to support training of the model, if it is, then the training process begins. Once this happens a period of recent information is read from the file. Initially, this read would fail and return 0 data. However, this problem was fixed by passing in the data file path rather then the refnum and having the vi open,
    read, and close the data file. With the path, the vi was able to read all the data. However, still in the same loop, another vi downstream tries to read the file and returns error code 1, and no data is read. I tried passing that vi the path and seeing if it made any difference to open, read and close the file. But even then the read failed (with error code 1).
    I don't understand why it can read in one vi and not the other!
    Does anyone know what is going on here? It seems that semaphores would probably solve the problem, but would prefer a simpler solution. Thank you very much.

    Try passing the data to the continuous loop through a LV2-style global. That way you are only access the file in one place. But then that begs the question, if the data is passed internally, do you really need the file at all?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Having problem with adding and reading dates to/from database !!!

    Hi
    I am new in J2ME
    I am trying to code a simple software.
    My problem is with dates.
    I have a datefield on my menu and the user will choose the date from here. By default, datefield shows todays date. But when I try to write that date to database using rms, date value transforms to java.util.Date@acfdb0fe.
    As I read from tutorials this is common problem of date class, so I tried to use calendar class.
    But with Calendar class I cannot let user to choose date from screen like DateField. datefield dowsn't work with calendar.
    later, I will use that date for sorting records
    Summary : I need a sample code that read date from screen (preferably with datefield), write it to recordstore. and then read it from recordstore asnd write to screen.
    I searching internet for a sample code through days.
    Please help me
    Thanks

    Hi,
    The best i would suggest is instead of storing the date as 19 Jan 2004 or something like this better store the date in milliseconds.
    DateField df = new DateField();
    Date d = df.getDate();
    long ms = d.getTime();
    store the value of ms in RMS. This is the commonly used way to store date in RMS for j2me.
    You can get back date using
    Date d = new Date(ms);
    DateField df = new DateField();
    df.setDate(d);
    Prabhu.

  • How to select and read #define lines from a code file

    Hi,
    I would like to read a .m file
    and select the lines which begins with '#define PL-KEY', like
    {quote}
    #define PL-KEYTAG TAG_values
    #define PL-KEYGROUP GROUP_value
    #define PL-KEYINFO "INFO_ValueTxtMax120Char" // could be max 120 char
    ..... more PL-KEY keys
    {quote}
    and put the rest of that line until a '//' or '/*' , like
    {quote}
    TAG TAG_values
    GROUP GROUP_value
    INFO "INFO_ValueTxtMax120Char"
    {quote}
    into something like a list where my code above will loop through.
    I thought using something like
    cat "path/to/code.h" | while read line
    do
    #... what do I have to with "$line" ...
    if [[ "$line" == #define PL-KEY* ]] ; then
    # yes then... then what????
    done
    any suggestions?? I noticed today, I am still no shell expert
    Thanks again

    I can't help much with PlistBuddy, as I just recently found out about it myself.
    But for the code, here are some adjustments based on your comments.
    I stuck with shell scripting because you seem to be more comfortable with shell scripting, vs awk or perl.
    #!/usr/bin/env bash
    while read lb_def rest
    do
    if [[ "$lb_def" = #define && "$rest" = PL_KEY* ]]; then
    rest=${rest#PL_KEY}
    echo "${rest%/[/]}"
    fi
    if [[ "$lb_def" = # && "$rest" = define PL_KEY* ]]; then
    rest=${rest#define }
    rest=${rest#PL_KEY}
    echo "${rest%/[/]}"
    fi
    done </path/to/code.h
    If PL_KEY has stuff in front if it, like one of your posts where it was kPL_KEY, then you could modify the uses of PL_KEY to include the 'k', or you could wildcard it. If a single character, then
    if [[ "$lb_def" = #define && "$rest" = ?PL_KEY* ]]; then
    rest=${rest#?PL_KEY}
    If multiple characters could prefix PL_KEY, then you can use the multi-character wildcard
    if [[ "$lb_def" = #define && "$rest" = PL_KEY ]]; then
    rest=${rest#*PL_KEY}
    If you are worried, that PL_KEY might exist in the comment, then you could strip the comment before doing the tests
    #!/usr/bin/env bash
    while read lb_def rest
    do
    rest=${rest%/[/]} # remove comments.
    if [[ "$lb_def" = #define && "$rest" = PL_KEY ]]; then
    rest=${rest#*PL_KEY}
    echo "${rest}"
    fi
    if [[ "$lb_def" = # && "$rest" = define PL_KEY ]]; then
    rest=${rest#define }
    rest=${rest#*PL_KEY}
    echo "${rest}"
    fi
    done </path/to/code.h
    Is that better?
    Message was edited by: BobHarris

  • Create a continuous data stream from C++, and read it in LabView

    Hello all.
    I'm working on a project which involves connecting to a motion tracker and reading position and orientation data from it in realtime. The code to get the data is in c++, so I decided that the best way to do this would be to create a c++ DLL file which contains all the necessary functions to first connect to the device and read the data from it, and use the Call Library Function node to feed this data into Labview. 
    I'm having trouble though, since ideally I would like a continuous stream of data from the c++ code into Labview, and I'm not sure how to achieve this. Putting the call library function node in a while loop seems like an obvious solution, but if I do it this way I would have to reconnect to the device every time I get the data, which is quite a bit too slow. 
    So my question is, if I created c++ function which created a data stream, could I read this into Labview without having to continually call a function? I'd prefer to only have to call a function once, and then read the data stream until a stop command is given.
    I'm using Labview 2010, version 10.0.
    Apologies if the question is poorly phrased, many thanks for your help.
    Dave
    Solved!
    Go to Solution.

    dr8086 wrote:
    This method sounds like an excellent suggestion, but I do have a few questions where I dont think I've understood fully.
    From what I understand the basic premise is to use one call library function node to access a DLL which creates an instance of the device object, and passes a pointer too it into labview. Then a seperate call library function node would pass this pointer to another DLL which could access the device object, update it and read the data. This part could be in a while loop and carry on reading the data until a stop command is given.
    That's it. I'm including some skeleton code as an example. I'm also including the code because I don't know how much you have experience with multi threading, so I'm showing how you'd have to use critical sections to guard the interactions between threads so that they don't lead to issues.
    // exported function to access the devices
    extern "C" __declspec(dllexport) int __stdcall init(uintptr_t *ptrOut)
    *ptrOut= (uintptr_t)new CDevice();
    return 0;
    extern "C" __declspec(dllexport) int __stdcall get_data(uintptr_t ptr, double vals[], int size)
    return ((CDevice*)ptr)->get_data(vals, size);
    extern "C" __declspec(dllexport) int __stdcall close(uintptr_t ptr, double last_vals[], int size)
    int r= ((CDevice*)ptr)->close();
    ((CDevice*)ptr)->get_data(last_vals, size);
    delete (CDevice*)ptr;
    return r;
    // h file
    // Represents a device
    class CDevice
    public:
    virtual ~CDevice();
    int init();
    int get_data(double vals[], int size);
    int close();
    // only called by new thread
    int ThreadProc();
    private:
    CRITICAL_SECTION rBufferSafe; // Needed for thread saftey
    vhtTrackerEmulator *tracker;
    HANDLE hThread;
    double buffer[500];
    int buffer_used;
    bool done; // this HAS to be protected by critical section since 2 threads access it. Use a get/set method with critical sections inside
    //cpp file
    DWORD WINAPI DeviceProc(LPVOID lpParam)
    ((CDevice*)lpParam)->ThreadProc(); // Call the function to do the work
    return 0;
    CDevice::~CDevice()
    DeleteCriticalSection(&rBufferSafe);
    int CDevice::init()
    tracker = new vhtTrackerEmulator();
    InitializeCriticalSection(&rBufferSafe);
    buffer_used= 0;
    done= false;
    hThread = CreateThread(NULL, 0, DeviceProc, this, 0, NULL); // this thread will now be saving data to an internal buffer
    return 0;
    int CDevice::get_data(double vals[], int size)
    EnterCriticalSection(&rBufferSafe);
    if (vals) // provides a way to get the current used buffer size
    memcpy(vals, buffer, min(size, buffer_used));
    int len= min(size, buffer_used);
    buffer_used= 0; // Whatever wasn't read is erased
    } else // just return the buffer size
    int len= buffer_used;
    LeaveCriticalSection(&rBufferSafe);
    return len;
    int CDevice::close()
    done= true;
    WaitForSingleObject(hThread, INFINITE); // handle timeouts etc.
    delete tracker;
    tracker= NULL;
    return 0;
    int CDevice::ThreadProc()
    while (!bdone)
    tracker->update();
    EnterCriticalSection(&rBufferSafe);
    if (buffer_used<500)
    buffer[buffer_used++]= tracker->getRawData(0);
    LeaveCriticalSection(&rBufferSafe);
    Sleep(100);
    return 0;
    dr8086 wrote:
    My main concern is that the object may go out of memory or be deallocated, since it wouldnt be held in any namespace or anything.
    Since you create the object with new, the object won't expire until either the dll is unloaded or the process (LabVIEW) closes. So the object will stay valid between dll calls provided LabVIEW didn't unload the dll (which it does if the VIs are closed). When that happens, I'm not exactly sure what happens to live objects (i.e. if you forgot to call close), I imagine the system reclaims the memory but the device might still be open.
    What I do to make sure that everything gets closed when the dll unloads before I could call close and delete the object is to everytime I create a new object in the dll I add it to a list, when the dll unloads, if the object is still on the list I delete it.
    dr8086 wrote:
    I also have a more general programming question about the purpose of the buffer. Would the buffer basically be a big table of position values, which are stored until they can be read into the rest of the VI? 
    Yes, see the example code.
    However, depending on the frequency with which you need to collect data from the device you might not need this buffer at all. I.e. if you collect a sample about every 100ms then you could remove all threading and buffer related functions and instead read the data from the read function itself like this:
    double CDevice::get_data()
    tracker->update();
    return tracker->getRawData(0);
     Because you'd only need a buffer and a seperate thread if you collect data at a high frequency and you cannot lose any data.
    Matt

  • Problem using the Write to SGL VI and Read from SGL VI

    Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to SGL file. I am not able to figure out the minor problem I am facing. I am attaching a zip file which contains five files.
    1) Acquire_Current_Binary_Exp.vi -> This is the VI which I used to store my data using Write to SGL file.
    2) Retrive_BINARY_Data.vi -> This is the VI which I used to Read from SGL file and plot it
    3) Binary_Capture -> This is the captured data using (1) which can be plotted using (2) and what I observed is the plot is different and also the time scare is not as expected.
    4) Unexpected_Graph.png is the unexpected graph when I am using Write to SGL and Read from SGL to store and retrieve the data.
    5) Expected_Graph.png -> This is the expected data format I supposed to get. I have obtained this plot when I have used write to LVM and read from LVM file to store and retrieve the data.
    I tried a lot modifying the sub VI’s but it doesn’t work for me. What I think is I am doing some mistake while I am writing the data to SGL and Reading the data from SGL. Also, I don’t know the reason why my graph is not like (5) rather I am getting something like its in (4). Its totally different. You can also observe the difference between the time scale of (4) and (5).
    Have a Good Day
    Regards,
    Krishna
    Attachments:
    LABVIEW_Files.zip ‏552 KB

    As already discussed a while ago, your binary data does not contain timing information. You need to tell it the scan rate so it can reconstruct the time axis correcty.
    From the data, it seems the sample file was recorded at 0.5MHz. Take the inverse and set the time increment. Voila!
    Your sample file is two column data with one colum all zero. You need to set the number of columns to two, to only get the good data in channel 1.
    Your acquisition program contains unecessary FOR loops, you can remove the inner loops without change in result.
    It makes no sense to convert to SGL if you initialize the shift registers with an empty DBL array. You need to initialize with an empty SGL array.
    (The code could be simplified quite a bit more, but this should give you some directions).
    The attached zip shows some ideas (LabVIEW 7.1).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LabVIEW_FilesMOD.zip ‏195 KB

  • Writing the file using Write to SGL and reading the data using Read from SGL

    Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to SGL file. I am not able to figure out the minor problem I am facing.  I am attaching a zip file which contains five files.
    1)      Acquire_Current_Binary_Exp.vi -> This is the VI which I used to store my data using Write to SGL file.
    2)      Retrive_BINARY_Data.vi -> This is the VI which I used to Read from SGL file and plot it
    3)      Binary_Capture -> This is the captured data using (1) which can be plotted using (2) and what I observed is the plot is different and also the time scare is not as expected.
    4)      Unexpected_Graph.png is the unexpected graph when I am using Write to SGL and Read from SGL to store and retrieve the data.
    5)      Expected_Graph.png -> This is the expected data format I supposed to get. I have obtained this plot when I have used write to LVM and read from LVM file to store and retrieve the data.
    I tried a lot modifying the sub VI’s but it doesn’t work for me. What I think is I am doing some mistake while I am writing the data to SGL and Reading the data from SGL. Also, I don’t know the reason why my graph is not like (5) rather I am getting something like its in (4). Its totally different. You can also observe the difference between the time scale of (4) and (5).
    Attachments:
    Krishna_Files.zip ‏552 KB

    The binary data file has no time axis information, it is pure y data. Only the LVM file contains information about t(0) and dt. Since you throw away this information before saving to the binary file, it cannot be retrieved.
    Did you try wiring a 2 as suggested?
    (see also http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=925 )
    Message Edited by altenbach on 07-29-2005 11:35 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Retrive_BINARY_DataMOD2.vi ‏1982 KB

Maybe you are looking for