Search code examples
blackberrysecurityexceptionsim-cardapdu

java.lang.SecurityException: JSR 177 access for this connection is not permitted


I'm trying to communicate with a SIM card using the APDUConnection with the SAT target, but I get this exception:

"java.lang.SecurityException: JSR 177 access for this connection is not permitted"

public void Test() {
 APDUConnection acn = null;
 try     {
    //Create an APDUConnection object
    acn = (APDUConnection)  Connector.open("apdu:0;target=SAT");        
    // ...      
 }
 catch( SecurityException e) {
    String exceptionMsg = "SecurityException: " + e.toString();
    System.err.println(exceptionMsg);
 }
 // ...
}

I have this problem with the SIM card that I am trying to communicate with, but on other SIM cards, such as my Carrier's (Rogers), I can open the APDU connection just fine.


Solution

  • Your SIM's ACF (Access Control File) has some restrictions which Roger's SIM doesn't have. You have to sign your midlet by using a certificate path provided by the MNO (SIM owner) in order to access to SAT.