use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.
the class DPolicyInformationChooser method okPressed.
private void okPressed() {
ASN1ObjectIdentifier policyIdentifer = joiPolicyIdentifier.getObjectId();
if (policyIdentifer == null) {
JOptionPane.showMessageDialog(this, res.getString("DPolicyInformationChooser.PolicyIdentifierValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
List<PolicyQualifierInfo> policyQualifierInfo = jpqPolicyQualifiers.getPolicyQualifierInfo();
if (policyQualifierInfo.size() > 0) {
ASN1EncodableVector policyQualifiersVec = new ASN1EncodableVector();
for (PolicyQualifierInfo policyQualInfo : policyQualifierInfo) {
try {
policyQualifiersVec.add(policyQualInfo);
} catch (Exception ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
}
DERSequence policyQualifiersSeq = new DERSequence(policyQualifiersVec);
policyInformation = new PolicyInformation(policyIdentifer, policyQualifiersSeq);
} else {
policyInformation = new PolicyInformation(policyIdentifer);
}
closeDialog();
}
use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.
the class DPolicyQualifierInfoChooser method populate.
private void populate(PolicyQualifierInfo policyQualifierInfo) throws IOException {
if (policyQualifierInfo == null) {
jrbCps.setSelected(true);
} else {
ASN1ObjectIdentifier policyQualifierId = policyQualifierInfo.getPolicyQualifierId();
if (policyQualifierId.equals(new ASN1ObjectIdentifier(PKIX_CPS_POINTER_QUALIFIER.oid()))) {
jrbCps.setSelected(true);
jtfCps.setText(((DERIA5String) policyQualifierInfo.getQualifier()).getString());
jtfCps.setCaretPosition(0);
} else if (policyQualifierId.equals(new ASN1ObjectIdentifier(PKIX_USER_NOTICE_QUALIFIER.oid()))) {
jrbUserNotice.setSelected(true);
ASN1Encodable userNoticeObj = policyQualifierInfo.getQualifier();
UserNotice userNotice = UserNotice.getInstance(userNoticeObj);
junUserNotice.setUserNotice(userNotice);
} else {
jrbCps.setSelected(true);
}
}
}
use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.
the class JPolicyQualifierInfo method removeSelectedPolicyQualifierInfo.
private void removeSelectedPolicyQualifierInfo() {
int selectedRow = jtPolicyQualifierInfo.getSelectedRow();
if (selectedRow != -1) {
PolicyQualifierInfo policyQualInfo = (PolicyQualifierInfo) jtPolicyQualifierInfo.getValueAt(selectedRow, 0);
policyQualifierInfo.remove(policyQualInfo);
reloadPolicyQualifierInfoTable();
selectFirstPolicyQualifierInfoInTable();
updateButtonControls();
}
}
use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.
the class JPolicyQualifierInfo method editSelectedPolicQualifier.
private void editSelectedPolicQualifier() {
int selectedRow = jtPolicyQualifierInfo.getSelectedRow();
if (selectedRow != -1) {
PolicyQualifierInfo policyQualInfo = (PolicyQualifierInfo) jtPolicyQualifierInfo.getValueAt(selectedRow, 0);
Container container = getTopLevelAncestor();
try {
DPolicyQualifierInfoChooser dPolicyQualifierInfoChooser = null;
if (container instanceof JDialog) {
dPolicyQualifierInfoChooser = new DPolicyQualifierInfoChooser((JDialog) container, title, policyQualInfo);
dPolicyQualifierInfoChooser.setLocationRelativeTo(container);
dPolicyQualifierInfoChooser.setVisible(true);
} else if (container instanceof JFrame) {
dPolicyQualifierInfoChooser = new DPolicyQualifierInfoChooser((JFrame) container, title, policyQualInfo);
dPolicyQualifierInfoChooser.setLocationRelativeTo(container);
dPolicyQualifierInfoChooser.setVisible(true);
}
PolicyQualifierInfo newPolicyQualifierInfo = dPolicyQualifierInfoChooser.getPolicyQualifierInfo();
if (newPolicyQualifierInfo == null) {
return;
}
policyQualifierInfo.remove(policyQualInfo);
policyQualifierInfo.add(newPolicyQualifierInfo);
populate();
selectPolicyQualifierInfoInTable(newPolicyQualifierInfo);
} catch (IOException ex) {
DError dError = null;
if (container instanceof JDialog) {
dError = new DError((JDialog) container, ex);
} else {
dError = new DError((JFrame) container, ex);
}
dError.setLocationRelativeTo(container);
dError.setVisible(true);
}
}
}
use of org.bouncycastle.asn1.x509.PolicyQualifierInfo in project keystore-explorer by kaikramer.
the class PolicyQualifierInfoTableCellRend method getTableCellRendererComponent.
/**
* Returns the rendered cell.
*
* @param jtPolicyQualifierInfo
* The JTable
* @param value
* The value to assign to the cell
* @param isSelected
* True if cell is selected
* @param row
* The row of the cell to render
* @param col
* The column of the cell to render
* @param hasFocus
* If true, render cell appropriately
* @return The renderered cell
*/
@Override
public Component getTableCellRendererComponent(JTable jtPolicyQualifierInfo, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
JLabel cell = (JLabel) super.getTableCellRendererComponent(jtPolicyQualifierInfo, value, isSelected, hasFocus, row, col);
PolicyQualifierInfo policyQualifierInfo = (PolicyQualifierInfo) value;
try {
String policyQualifierInfoStr = PolicyInformationUtil.toString(policyQualifierInfo);
cell.setText(policyQualifierInfoStr);
cell.setToolTipText(policyQualifierInfoStr);
} catch (IOException ex) {
// We build this data so should not
throw new RuntimeException(ex);
// happen
}
cell.setHorizontalAlignment(LEFT);
cell.setBorder(new EmptyBorder(0, 5, 0, 5));
return cell;
}
Aggregations