本文整理汇总了Java中org.bouncycastle.asn1.x509.AccessDescription类的典型用法代码示例。如果您正苦于以下问题:Java AccessDescription类的具体用法?Java AccessDescription怎么用?Java AccessDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessDescription类属于org.bouncycastle.asn1.x509包,在下文中一共展示了AccessDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOCSPUrls
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
protected Vector getOCSPUrls(AuthorityInformationAccess authInfoAccess)
{
Vector urls = new Vector();
if (authInfoAccess != null)
{
AccessDescription[] ads = authInfoAccess.getAccessDescriptions();
for (int i = 0; i < ads.length; i++)
{
if (ads[i].getAccessMethod().equals(AccessDescription.id_ad_ocsp))
{
GeneralName name = ads[i].getAccessLocation();
if (name.getTagNo() == GeneralName.uniformResourceIdentifier)
{
String url = ((DERIA5String) name.getName()).getString();
urls.add(url);
}
}
}
}
return urls;
}
示例2: createAccessDescription
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
public static AccessDescription createAccessDescription(String accessMethodAndLocation)
throws BadInputException {
ParamUtil.requireNonNull("accessMethodAndLocation", accessMethodAndLocation);
ConfPairs pairs;
try {
pairs = new ConfPairs(accessMethodAndLocation);
} catch (IllegalArgumentException ex) {
throw new BadInputException("invalid accessMethodAndLocation "
+ accessMethodAndLocation);
}
Set<String> oids = pairs.names();
if (oids == null || oids.size() != 1) {
throw new BadInputException("invalid accessMethodAndLocation "
+ accessMethodAndLocation);
}
String accessMethodS = oids.iterator().next();
String taggedValue = pairs.value(accessMethodS);
ASN1ObjectIdentifier accessMethod = new ASN1ObjectIdentifier(accessMethodS);
GeneralName location = createGeneralName(taggedValue);
return new AccessDescription(accessMethod, location);
}
示例3: getAuthorityInfoAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
/**
* Returns the AuthorityInfoAccess extension value on list format.<br>
* Otherwise, returns <b>list empty</b>.<br>
* @return List Authority info access list
*/
public List<String> getAuthorityInfoAccess() {
List<String> address = new ArrayList<String>();
try {
byte[] authorityInfoAccess = certificate.getExtensionValue(Extension.authorityInfoAccess.getId());
if (authorityInfoAccess != null && authorityInfoAccess.length > 0) {
AuthorityInformationAccess infoAccess = AuthorityInformationAccess.getInstance(X509ExtensionUtil
.fromExtensionValue(authorityInfoAccess));
for (AccessDescription desc : infoAccess.getAccessDescriptions())
if (desc.getAccessLocation().getTagNo() == GeneralName.uniformResourceIdentifier)
address.add(((DERIA5String) desc.getAccessLocation().getName()).getString());
}
return address;
} catch (IOException error) {
logger.info(error.getMessage());
return address;
}
}
示例4: okPressed
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private void okPressed() {
List<AccessDescription> accessDescriptions = jadAccessDescriptions.getAccessDescriptions();
if (accessDescriptions.size() == 0) {
JOptionPane.showMessageDialog(this, res.getString("DSubjectInformationAccess.ValueReq.message"),
getTitle(), JOptionPane.WARNING_MESSAGE);
return;
}
SubjectInfoAccess subjectInformationAccess = new SubjectInfoAccess(accessDescriptions);
try {
value = subjectInformationAccess.getEncoded(ASN1Encoding.DER);
} catch (IOException ex) {
DError dError = new DError(this, ex);
dError.setLocationRelativeTo(this);
dError.setVisible(true);
return;
}
closeDialog();
}
示例5: getTableCellRendererComponent
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
/**
* Returns the rendered cell.
*
* @param jtAccessDescriptions
* 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 jtAccessDescriptions, Object value, boolean isSelected,
boolean hasFocus, int row, int col) {
JLabel cell = (JLabel) super.getTableCellRendererComponent(jtAccessDescriptions, value, isSelected, hasFocus,
row, col);
AccessDescription accessDescription = (AccessDescription) value;
if (col == 0) {
cell.setText(accessDescription.getAccessMethod().getId());
} else {
cell.setText(GeneralNameUtil.safeToString(accessDescription.getAccessLocation(), false));
}
cell.setHorizontalAlignment(LEFT);
cell.setBorder(new EmptyBorder(0, 5, 0, 5));
return cell;
}
示例6: addPressed
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private void addPressed() {
Container container = getTopLevelAncestor();
DAccessDescriptionChooser dAccessDescriptionChooser = null;
if (container instanceof JDialog) {
dAccessDescriptionChooser = new DAccessDescriptionChooser((JDialog) container, title, null);
dAccessDescriptionChooser.setLocationRelativeTo(container);
dAccessDescriptionChooser.setVisible(true);
} else if (container instanceof JFrame) {
dAccessDescriptionChooser = new DAccessDescriptionChooser((JFrame) container, title, null);
dAccessDescriptionChooser.setLocationRelativeTo(container);
dAccessDescriptionChooser.setVisible(true);
}
AccessDescription newAccessDescription = dAccessDescriptionChooser.getAccessDescription();
if (newAccessDescription == null) {
return;
}
accessDescriptions.add(newAccessDescription);
populate();
selectAccessDescriptionInTable(newAccessDescription);
}
示例7: load
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
/**
* Load the AccessDescriptionsTableModel with access descriptions.
*
* @param accessDescriptions
* The access descriptions
*/
public void load(List<AccessDescription> accessDescriptions) {
AccessDescription[] accessDescriptionsArray = accessDescriptions
.toArray(new AccessDescription[accessDescriptions.size()]);
Arrays.sort(accessDescriptionsArray, new AccessDescriptionMethodComparator());
data = new Object[accessDescriptionsArray.length][2];
int i = 0;
for (AccessDescription accessDescription : accessDescriptionsArray) {
data[i][0] = accessDescription;
data[i][1] = accessDescription;
i++;
}
fireTableDataChanged();
}
示例8: okPressed
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private void okPressed() {
ASN1ObjectIdentifier accessMethod = joiAccessMethod.getObjectId();
if (accessMethod == null) {
JOptionPane.showMessageDialog(this,
res.getString("DAccessDescriptionChooser.AccessMethodValueReq.message"), getTitle(),
JOptionPane.WARNING_MESSAGE);
return;
}
GeneralName accessLocation = jgnAccessLocation.getGeneralName();
if (accessLocation == null) {
JOptionPane.showMessageDialog(this,
res.getString("DAccessDescriptionChooser.AccessLocationValueReq.message"), getTitle(),
JOptionPane.WARNING_MESSAGE);
return;
}
accessDescription = new AccessDescription(accessMethod, accessLocation);
closeDialog();
}
示例9: extractAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
DERObject aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess
.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
DERObjectIdentifier acessMethod = accessDescription
.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例10: extractAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
public static void extractAuthorityInformationAccess(List<String> OCSPUrl,
ASN1Primitive aiaExt) {
AuthorityInformationAccess aia = AuthorityInformationAccess
.getInstance(aiaExt);
AccessDescription[] accessDescriptions = aia.getAccessDescriptions();
DERObjectIdentifier OCSPOid = new DERObjectIdentifier(
"1.3.6.1.5.5.7.48.1"); //$NON-NLS-1$
for (AccessDescription accessDescription : accessDescriptions) {
GeneralName generalName = accessDescription.getAccessLocation();
String nextName = generalName.getName().toString();
DERObjectIdentifier acessMethod = accessDescription
.getAccessMethod();
if (acessMethod.equals(OCSPOid)) {
OCSPUrl.add(nextName);
}
}
}
示例11: getAccessLocations
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private static List<String> getAccessLocations(final CertificateToken certificate, ASN1ObjectIdentifier aiaType) {
List<String> locationsUrls = new ArrayList<String>();
final byte[] authInfoAccessExtensionValue = certificate.getCertificate().getExtensionValue(Extension.authorityInfoAccess.getId());
if (null == authInfoAccessExtensionValue) {
return locationsUrls;
}
try {
ASN1Sequence asn1Sequence = DSSASN1Utils.getAsn1SequenceFromDerOctetString(authInfoAccessExtensionValue);
AuthorityInformationAccess authorityInformationAccess = AuthorityInformationAccess.getInstance(asn1Sequence);
AccessDescription[] accessDescriptions = authorityInformationAccess.getAccessDescriptions();
for (AccessDescription accessDescription : accessDescriptions) {
if (aiaType.equals(accessDescription.getAccessMethod())) {
GeneralName gn = accessDescription.getAccessLocation();
String location = parseGn(gn);
if (location != null) {
locationsUrls.add(location);
}
}
}
} catch (Exception e) {
LOG.error("Unable to parse authorityInfoAccess", e);
}
return locationsUrls;
}
示例12: getInformationAccessStringValue
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
/**
* Get Authority Information Access (1.3.6.1.5.5.7.1.1) or Subject Information Access (1.3.6.1.5.5.7.1.11) extension
* value as a string.
*
* @param bValue The octet string value
* @return Extension value as a string
* @throws IOException If an I/O problem occurs
*/
private String getInformationAccessStringValue(byte[] bValue)
throws IOException
{
AuthorityInformationAccess access = AuthorityInformationAccess.getInstance(bValue);
StringBuilder sb = new StringBuilder();
AccessDescription[] accDescs = access.getAccessDescriptions();
for (AccessDescription accDesc : accDescs)
{
if (sb.length() != 0)
{
sb.append("<br>");
}
String accOid = accDesc.getAccessMethod().toString();
String accMeth = getRes(accOid, "UnrecognisedAccessMethod");
LinkClass linkClass = LinkClass.BROWSER;
if (accOid.equals(AccessDescription.id_ad_ocsp.getId()))
{
linkClass = LinkClass.OCSP;
}
else if (accOid.equals(AccessDescription.id_ad_caIssuers.getId()))
{
linkClass = LinkClass.CERTIFICATE;
}
sb.append("<ul><li>");
sb.append(MessageFormat.format(accMeth, accOid));
sb.append(": <ul><li>");
sb.append(getGeneralNameString(accDesc.getAccessLocation(), linkClass));
sb.append("</li></ul></li></ul>");
}
return sb.toString();
}
示例13: addAuthorityInformationAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private void addAuthorityInformationAccess(String issuerName, X509v3CertificateBuilder v3CertGen) throws CertIOException {
AccessDescription caIssuers = new AccessDescription(AccessDescription.id_ad_caIssuers, new GeneralName(GeneralName.uniformResourceIdentifier, new DERIA5String(SERVER_BASE_REST_PKI_URL + issuerName + AIA_URL)));
ASN1EncodableVector aia_ASN = new ASN1EncodableVector();
aia_ASN.add(caIssuers);
v3CertGen.addExtension(Extension.authorityInfoAccess, false, new DERSequence(aia_ASN));
}
示例14: SubjectInfoAccess
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
private SubjectInfoAccess(ASN1Sequence seq) {
accessDescriptions = new Vector<AccessDescription>();
for (int i = 0; i != seq.size(); i++) {
accessDescriptions.add(AccessDescription.getInstance(seq.getObjectAt(i)));
}
}
示例15: toASN1Primitive
import org.bouncycastle.asn1.x509.AccessDescription; //导入依赖的package包/类
@Override
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector vec = new ASN1EncodableVector();
Iterator<AccessDescription> it = accessDescriptions.iterator();
while (it.hasNext()) {
vec.add(it.next().toASN1Primitive());
}
return new DERSequence(vec);
}