Search in sources :

Example 1 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQycdRenewCertificate_RNWC0300.

public void callQycdRenewCertificate_RNWC0300(final AppLogger _logger, final String _file) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ProgramCall program = new ProgramCall(m_conn);
    // Initialize the name of the program to run.
    final String programName = "/QSYS.LIB/QYCDRNWC.PGM";
    final String apiFormat = "RNWC0300";
    final AS400Structure arg0 = new AS400Structure(new AS400DataType[] { // 0 0 Binary (4) Offset to certificate path and file name
    new AS400Bin4(), // 4 4 Binary (4) Length of certificate path and file name
    new AS400Bin4(), // Char (*) Certificate path and file name
    new AS400Text(// TODO
    _file.length()) });
    // Set up the parms
    final ProgramParameter[] parameterList = new ProgramParameter[14];
    // 1 Certificate request data Input Char(*)
    parameterList[0] = new ProgramParameter(arg0.toBytes(new Object[] { 8, _file.length(), _file }));
    // 2 Length of certificate request data Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(arg0.getByteLength()));
    // 3 Format name Input Char(8)
    parameterList[2] = new ProgramParameter(new AS400Text(8).toBytes(apiFormat));
    // 4 Error Code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[3] = ec;
    program.setProgram(programName, parameterList);
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Structure(com.ibm.as400.access.AS400Structure) AS400Bin4(com.ibm.as400.access.AS400Bin4) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramCall(com.ibm.as400.access.ProgramCall)

Example 2 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQycdRemoveCertUsage.

public void callQycdRemoveCertUsage(final AppLogger _logger, final String _dcmStore, final String _dcmStorePw, final String _appId, final String _alias) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ServiceProgramCall program = new ServiceProgramCall(m_conn);
    // Initialize the name of the program to run.
    final String programName = "/QSYS.LIB/QICSS.LIB/QYCDCUSG.SRVPGM";
    final ProgramParameter[] parameterList = new ProgramParameter[7];
    // 1 Application ID Input Char(*)
    parameterList[0] = new ProgramParameter(new AS400Text(_appId.length()).toBytes(_appId));
    // 2 Length of application ID Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(_appId.length()));
    // 3 Certificate store name Input Char(*)
    parameterList[2] = new ProgramParameter(new AS400Text(_dcmStore.length()).toBytes(_dcmStore));
    // 4 Length of certificate store name Input Binary(4)
    parameterList[3] = new ProgramParameter(new AS400Bin4().toBytes(_dcmStore.length()));
    // 5 Certificate ID Input Char(*)
    parameterList[4] = new ProgramParameter(new AS400Text(_alias.length()).toBytes(_alias));
    // 6 Length of certificate ID Input Binary(4)
    parameterList[5] = new ProgramParameter(new AS400Bin4().toBytes(_alias.length()));
    // 7 Error code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[6] = ec;
    program.setProgram(programName, parameterList);
    program.setProcedureName("QycdRemoveCertUsage");
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Bin4(com.ibm.as400.access.AS400Bin4)

Example 3 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQykmImportKeyStore.

// QykmImportKeyStore
public void callQykmImportKeyStore(final AppLogger _logger, final String _dcmStore, final String _dcmStorePw, final String _dcmImportFile, final String _importFilePw) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ProgramCall program = new ProgramCall(m_conn);
    // Initialize the name of the program to run.
    final String programName = "/QSYS.LIB/QYKMIMPK.PGM";
    // Set up the parms
    final ProgramParameter[] parameterList = new ProgramParameter[14];
    // 1 Certificate store path and file Name Input Char(*)
    parameterList[0] = new ProgramParameter(new AS400Text(_dcmStore.length()).toBytes(_dcmStore));
    // 2 Length of certificate store path and file Name Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(_dcmStore.length()));
    // 3 Format of certificate store path and file Name Input Char(8)
    parameterList[2] = new ProgramParameter(new AS400Text(8).toBytes("OBJN0100"));
    // 4 Certificate store password Input Char(*)
    parameterList[3] = new ProgramParameter(new AS400Text(_dcmStorePw.length(), 1208).toBytes(_dcmStorePw));
    // 5 Length of certificate store password Input Binary(4)
    parameterList[4] = new ProgramParameter(new AS400Bin4().toBytes(_dcmStorePw.length()));
    // 6 CCSID of certificate store password Input Binary(4)
    parameterList[5] = new ProgramParameter(new AS400Bin4().toBytes(1208));
    // 7 Import path and file name Input Char(*)
    parameterList[6] = new ProgramParameter(new AS400Text(_dcmImportFile.length()).toBytes(_dcmImportFile));
    // 8 Length of import path and file name Input Binary(4)
    parameterList[7] = new ProgramParameter(new AS400Bin4().toBytes(_dcmImportFile.length()));
    // 9 Format of import path and file name Input Char(8)
    parameterList[8] = new ProgramParameter(new AS400Text(8).toBytes("OBJN0100"));
    // 10 Version of import file Input Char(10)
    parameterList[9] = new ProgramParameter(new AS400Text(10).toBytes("*PKCS12V3 "));
    // 11 Import file password Input Char(*)
    parameterList[10] = new ProgramParameter(new AS400Text(_importFilePw.length(), 1208).toBytes(_importFilePw));
    // 12 Length of import file password Input Binary(4)
    parameterList[11] = new ProgramParameter(new AS400Bin4().toBytes(_importFilePw.length()));
    // 13 CCSID of import file password Input Binary(4)
    parameterList[12] = new ProgramParameter(new AS400Bin4().toBytes(1208));
    // 14 Error code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[13] = ec;
    program.setProgram(programName, parameterList);
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Bin4(com.ibm.as400.access.AS400Bin4) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramCall(com.ibm.as400.access.ProgramCall)

Example 4 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQykmExportKeyStore.

public void callQykmExportKeyStore(final AppLogger _logger, final String _dcmStore, final String _dcmStorePw, final String _exportFile, final String _exportFilePw) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ProgramCall program = new ProgramCall(m_conn);
    // Initialize the name of the program to run.
    final String programName = "/QSYS.LIB/QYKMEXPK.PGM";
    final ProgramParameter[] parameterList = new ProgramParameter[14];
    // 1 Certificate store path and file Name Input Char(*)
    parameterList[0] = new ProgramParameter(new AS400Text(_dcmStore.length()).toBytes(_dcmStore));
    // 2 Length of certificate store path and file Name Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(_dcmStore.length()));
    // 3 Format of certificate store path and file Name Input Char(8)
    parameterList[2] = new ProgramParameter(new AS400Text(8).toBytes("OBJN0100"));
    // 4 Certificate store password Input Char(*)
    parameterList[3] = new ProgramParameter(new AS400Text(_dcmStorePw.length(), 1208).toBytes(_dcmStorePw));
    // 5 Length of certificate store password Input Binary(4)
    parameterList[4] = new ProgramParameter(new AS400Bin4().toBytes(_dcmStorePw.length()));
    // 6 CCSID of certificate store password Input Binary(4)
    parameterList[5] = new ProgramParameter(new AS400Bin4().toBytes(1208));
    // 7 Export path and file name Input Char(*)
    parameterList[6] = new ProgramParameter(new AS400Text(_exportFile.length()).toBytes(_exportFile));
    // 8 Length of export path and file name Input Binary(4)
    parameterList[7] = new ProgramParameter(new AS400Bin4().toBytes(_exportFile.length()));
    // 9 Format of import path and file name Input Char(8)
    parameterList[8] = new ProgramParameter(new AS400Text(8).toBytes("OBJN0100"));
    // 10 Version of export file Input Char(10)
    parameterList[9] = new ProgramParameter(new AS400Text(10).toBytes("*PKCS12V3 "));
    // 11 Export file password Input Char(*)
    parameterList[10] = new ProgramParameter(new AS400Text(_exportFilePw.length(), 1208).toBytes(_exportFilePw));
    // 12 Length of export file password Input Binary(4)
    parameterList[11] = new ProgramParameter(new AS400Bin4().toBytes(_exportFilePw.length()));
    // 13 CCSID of export file password Input Binary(4)
    parameterList[12] = new ProgramParameter(new AS400Bin4().toBytes(1208));
    // 14 Error code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[13] = ec;
    program.setProgram(programName, parameterList);
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Bin4(com.ibm.as400.access.AS400Bin4) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramCall(com.ibm.as400.access.ProgramCall)

Example 5 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQycdAddCACertTrust.

public void callQycdAddCACertTrust(final AppLogger _logger, final String _dcmStore, final String _dcmStorePw, final String _appId, final String _alias) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ServiceProgramCall program = new ServiceProgramCall(m_conn);
    // Initialize the name of the program to run.
    final String programName = "/QSYS.LIB/QICSS.LIB/QYCDCUSG.SRVPGM";
    final ProgramParameter[] parameterList = new ProgramParameter[6];
    // 1 Application ID Input Char(*)
    parameterList[0] = new ProgramParameter(new AS400Text(_appId.length()).toBytes(_appId));
    // 2 Length of application ID Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(_appId.length()));
    // 3 Trusted CA certificate ID type Input Char(1)
    parameterList[2] = new ProgramParameter(new AS400Text(1).toBytes("1"));
    // 4 Trusted CA certificate ID Input Char(*)
    parameterList[3] = new ProgramParameter(new AS400Text(_alias.length()).toBytes(_alias));
    // 5 Length of trusted CA certificate ID Input Binary(4)
    parameterList[4] = new ProgramParameter(new AS400Bin4().toBytes(_alias.length()));
    // 6 Error code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[5] = ec;
    program.setProgram(programName, parameterList);
    program.setProcedureName("QycdAddCACertTrust");
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Bin4(com.ibm.as400.access.AS400Bin4)

Aggregations

AS400Bin4 (com.ibm.as400.access.AS400Bin4)6 AS400Text (com.ibm.as400.access.AS400Text)6 ErrorCodeParameter (com.ibm.as400.access.ErrorCodeParameter)6 ProgramParameter (com.ibm.as400.access.ProgramParameter)6 ServiceProgramCall (com.ibm.as400.access.ServiceProgramCall)6 ProgramCall (com.ibm.as400.access.ProgramCall)3 AS400 (com.ibm.as400.access.AS400)1 AS400SecurityException (com.ibm.as400.access.AS400SecurityException)1 AS400Structure (com.ibm.as400.access.AS400Structure)1 RequestNotSupportedException (com.ibm.as400.access.RequestNotSupportedException)1 SecureAS400 (com.ibm.as400.access.SecureAS400)1 IntrospectionException (java.beans.IntrospectionException)1 IOException (java.io.IOException)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 ConnectorException (org.identityconnectors.framework.common.exceptions.ConnectorException)1 ConnectorIOException (org.identityconnectors.framework.common.exceptions.ConnectorIOException)1 ConnectorSecurityException (org.identityconnectors.framework.common.exceptions.ConnectorSecurityException)1