SPBImportCertificate.java

Exemplo de importação de certificado SPB.

Veja Nota sobre os exemplos.
package doxy.examples;
import java.io.FileInputStream;
public class SPBImportCertificate {
private static String strAddr = "10.0.62.17";
private static String strUsrId = "tjava";
private static String strPwd = "12345678";
private static int nPort = 4433;
private static String szDomain = "SPR";
public static void main(String[] args) {
int nFlags = 0;
Dinamo api = new Dinamo();
try {
api.openSession(strAddr, strUsrId, strPwd, nPort, nFlags);
FileInputStream fis = new FileInputStream("ABC.cer");
byte[] buffer = new byte[(int) fis.getChannel().size()];
fis.read(buffer);
fis.close();
api.SPBImportCertificate(szDomain, buffer);
api.closeSession();
} catch (TacException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}