Java 类org.bouncycastle.asn1.x509.UserNotice 实例源码

项目:keystore-explorer    文件:DPolicyQualifierInfoChooser.java   
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);
        }
    }
}
项目:keystore-explorer    文件:PolicyInformationUtil.java   
/**
 * Get string representation of policy qualifier info.
 *
 * @param policyQualifierInfo
 *            Policy qualifier info
 * @return String representation of policy qualifier info
 * @throws IOException
 *             If policy qualifier info is invalid
 */
public static String toString(PolicyQualifierInfo policyQualifierInfo) throws IOException {
    StringBuffer sbPolicyQualifier = new StringBuffer();

    ASN1ObjectIdentifier policyQualifierId = policyQualifierInfo.getPolicyQualifierId();

    CertificatePolicyQualifierType certificatePolicyQualifierType = CertificatePolicyQualifierType
            .resolveOid(policyQualifierId.getId());

    if (certificatePolicyQualifierType == PKIX_CPS_POINTER_QUALIFIER) {
        DERIA5String cpsPointer = ((DERIA5String) policyQualifierInfo.getQualifier());

        sbPolicyQualifier
        .append(MessageFormat.format(res.getString("PolicyInformationUtil.CpsPointer"), cpsPointer));
    } else if (certificatePolicyQualifierType == PKIX_USER_NOTICE_QUALIFIER) {
        ASN1Encodable userNoticeObj = policyQualifierInfo.getQualifier();

        UserNotice userNotice = UserNotice.getInstance(userNoticeObj);

        sbPolicyQualifier.append(MessageFormat.format(res.getString("PolicyInformationUtil.UserNotice"),
                toString(userNotice)));
    }

    return sbPolicyQualifier.toString();
}
项目:keystore-explorer    文件:JUserNotice.java   
private void editUserNotice() {
    Container container = getTopLevelAncestor();

    DUserNoticeChooser dUserNoticeChooser = null;

    if (container instanceof JDialog) {
        dUserNoticeChooser = new DUserNoticeChooser((JDialog) container, title, userNotice);
        dUserNoticeChooser.setLocationRelativeTo(container);
        dUserNoticeChooser.setVisible(true);
    } else if (container instanceof JFrame) {
        dUserNoticeChooser = new DUserNoticeChooser((JFrame) container, title, userNotice);
        dUserNoticeChooser.setLocationRelativeTo(container);
        dUserNoticeChooser.setVisible(true);
    }

    UserNotice newUserNotice = dUserNoticeChooser.getUserNotice();

    if (newUserNotice == null) {
        return;
    }

    setUserNotice(newUserNotice);
}
项目:keystore-explorer    文件:DUserNoticeChooser.java   
private void populate(UserNotice userNotice) {
    if (userNotice != null) {
        NoticeReference noticeReference = userNotice.getNoticeRef();

        if (noticeReference != null) {
            DisplayText organization = noticeReference.getOrganization();

            if (organization != null) {
                jtfOrganization.setText(organization.getString());
                jtfOrganization.setCaretPosition(0);
            }

            populateNoticeNumbers(noticeReference);
        }

        DisplayText explicitText = userNotice.getExplicitText();

        if (explicitText != null) {
            jtfExplicitText.setText(explicitText.getString());
            jtfExplicitText.setCaretPosition(0);
        }
    }
}
项目:keystore-explorer    文件:PolicyInformationUtil.java   
/**
 * Get string representation of user notice.
 *
 * @param userNotice
 *            User notice
 * @return String representation of user notice
 */
public static String toString(UserNotice userNotice) {
    StringBuffer sbUserNotice = new StringBuffer();

    NoticeReference noticeReference = userNotice.getNoticeRef();

    if (noticeReference != null) {
        DisplayText organization = noticeReference.getOrganization();

        if (organization != null) {
            sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.Organization"),
                    organization.getString()));

            if ((noticeReference.getNoticeNumbers() != null) || (userNotice.getExplicitText() != null)) {
                sbUserNotice.append(", ");
            }
        }

        ASN1Integer[] noticeNumbers = noticeReference.getNoticeNumbers();

        StringBuffer sbNoticeNumbers = new StringBuffer();

        if (noticeNumbers != null) {
            for (int i = 0; i < noticeNumbers.length; i++) {
                ASN1Integer noticeNumber = noticeNumbers[i];

                sbNoticeNumbers.append(noticeNumber.getValue().intValue());

                if ((i + 1) < noticeNumbers.length) {
                    sbNoticeNumbers.append(" ");
                }
            }

            sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.NoticeNumbers"),
                    sbNoticeNumbers.toString()));

            if (userNotice.getExplicitText() != null) {
                sbUserNotice.append(", ");
            }
        }
    }

    DisplayText explicitText = userNotice.getExplicitText();

    if (explicitText != null) {
        sbUserNotice.append(MessageFormat.format(res.getString("PolicyInformationUtil.ExplicitText"),
                explicitText.getString()));
    }

    return sbUserNotice.toString();
}
项目:keystore-explorer    文件:JUserNotice.java   
/**
 * Get user notice.
 *
 * @return User notice, or null if none chosen
 */
public UserNotice getUserNotice() {
    return userNotice;
}
项目:keystore-explorer    文件:JUserNotice.java   
/**
 * Set user notice.
 *
 * @param userNotice
 *            User notice
 */
public void setUserNotice(UserNotice userNotice) {
    this.userNotice = userNotice;
    populate();
}
项目:keystore-explorer    文件:DUserNoticeChooser.java   
/**
 * Constructs a new DUserNoticeChooser dialog.
 *
 * @param parent
 *            The parent frame
 * @param title
 *            The dialog title
 * @param userNotice
 *            User notice
 */
public DUserNoticeChooser(JFrame parent, String title, UserNotice userNotice) {
    super(parent, title, ModalityType.DOCUMENT_MODAL);
    initComponents(userNotice);
}
项目:keystore-explorer    文件:DUserNoticeChooser.java   
/**
 * Constructs a new DUserNoticeChooser dialog.
 *
 * @param parent
 *            The parent dialog
 * @param title
 *            The dialog title
 * @param userNotice
 *            User notice
 */
public DUserNoticeChooser(JDialog parent, String title, UserNotice userNotice) {
    super(parent, title, Dialog.ModalityType.DOCUMENT_MODAL);
    initComponents(userNotice);
}
项目:keystore-explorer    文件:DUserNoticeChooser.java   
/**
 * Get selected user notice.
 *
 * @return User notice, or null if none
 */
public UserNotice getUserNotice() {
    return userNotice;
}