Java Code Examples for org.bouncycastle.asn1.x509.UserNotice

The following are top voted examples for showing how to use org.bouncycastle.asn1.x509.UserNotice. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: keystore-explorer   File: DPolicyQualifierInfoChooser.java   View source code 7 votes vote down vote up
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);
		}
	}
}
 
Example 2
Project: keystore-explorer   File: PolicyInformationUtil.java   View source code 6 votes vote down vote up
/**
 * 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();
}
 
Example 3
Project: keystore-explorer   File: JUserNotice.java   View source code 6 votes vote down vote up
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);
}
 
Example 4
Project: keystore-explorer   File: DUserNoticeChooser.java   View source code 6 votes vote down vote up
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);
		}
	}
}
 
Example 5
Project: keystore-explorer   File: PolicyInformationUtil.java   View source code 4 votes vote down vote up
/**
 * 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();
}
 
Example 6
Project: keystore-explorer   File: JUserNotice.java   View source code 2 votes vote down vote up
/**
 * Get user notice.
 *
 * @return User notice, or null if none chosen
 */
public UserNotice getUserNotice() {
	return userNotice;
}
 
Example 7
Project: keystore-explorer   File: JUserNotice.java   View source code 2 votes vote down vote up
/**
 * Set user notice.
 *
 * @param userNotice
 *            User notice
 */
public void setUserNotice(UserNotice userNotice) {
	this.userNotice = userNotice;
	populate();
}
 
Example 8
Project: keystore-explorer   File: DUserNoticeChooser.java   View source code 2 votes vote down vote up
/**
 * 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);
}
 
Example 9
Project: keystore-explorer   File: DUserNoticeChooser.java   View source code 2 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: keystore-explorer   File: DUserNoticeChooser.java   View source code 2 votes vote down vote up
/**
 * Get selected user notice.
 *
 * @return User notice, or null if none
 */
public UserNotice getUserNotice() {
	return userNotice;
}