本文整理匯總了Java中org.bouncycastle.asn1.x509.GeneralName類的典型用法代碼示例。如果您正苦於以下問題:Java GeneralName類的具體用法?Java GeneralName怎麽用?Java GeneralName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GeneralName類屬於org.bouncycastle.asn1.x509包,在下文中一共展示了GeneralName類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: matchesDN
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private boolean matchesDN(X500Principal subject, GeneralNames targets)
{
GeneralName[] names = targets.getNames();
for (int i = 0; i != names.length; i++)
{
GeneralName gn = names[i];
if (gn.getTagNo() == GeneralName.directoryName)
{
try
{
if (new X500Principal(((ASN1Encodable)gn.getName()).toASN1Primitive().getEncoded()).equals(subject))
{
return true;
}
}
catch (IOException e)
{
}
}
}
return false;
}
示例2: createAccessDescription
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的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: matchesDN
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private boolean matchesDN(X509Principal subject, GeneralNames targets)
{
GeneralName[] names = targets.getNames();
for (int i = 0; i != names.length; i++)
{
GeneralName gn = names[i];
if (gn.getTagNo() == GeneralName.directoryName)
{
try
{
if (new X509Principal(((ASN1Encodable)gn.getName()).toASN1Primitive()
.getEncoded()).equals(subject))
{
return true;
}
}
catch (IOException e)
{
}
}
}
return false;
}
示例4: getNames
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private Object[] getNames(GeneralName[] names)
{
List l = new ArrayList(names.length);
for (int i = 0; i != names.length; i++)
{
if (names[i].getTagNo() == GeneralName.directoryName)
{
try
{
l.add(new X500Principal(
((ASN1Encodable)names[i].getName()).toASN1Primitive().getEncoded()));
}
catch (IOException e)
{
throw new RuntimeException("badly formed Name object");
}
}
}
return l.toArray(new Object[l.size()]);
}
示例5: extractGeneralNames
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private Set extractGeneralNames(Collection names)
throws IOException
{
if (names == null || names.isEmpty())
{
return new HashSet();
}
Set temp = new HashSet();
for (Iterator it = names.iterator(); it.hasNext();)
{
Object o = it.next();
if (o instanceof GeneralName)
{
temp.add(o);
}
else
{
temp.add(GeneralName.getInstance(ASN1Primitive.fromByteArray((byte[])o)));
}
}
return temp;
}
示例6: getCRLDistUrls
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
protected Vector getCRLDistUrls(CRLDistPoint crlDistPoints)
{
Vector urls = new Vector();
if (crlDistPoints != null)
{
DistributionPoint[] distPoints = crlDistPoints.getDistributionPoints();
for (int i = 0; i < distPoints.length; i++)
{
DistributionPointName dp_name = distPoints[i].getDistributionPoint();
if (dp_name.getType() == DistributionPointName.FULL_NAME)
{
GeneralName[] generalNames = GeneralNames.getInstance(dp_name.getName()).getNames();
for (int j = 0; j < generalNames.length; j++)
{
if (generalNames[j].getTagNo() == GeneralName.uniformResourceIdentifier)
{
String url = ((DERIA5String) generalNames[j].getName()).getString();
urls.add(url);
}
}
}
}
}
return urls;
}
示例7: getOCSPUrls
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的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;
}
示例8: matchesDN
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private boolean matchesDN(X500Name subject, GeneralNames targets)
{
GeneralName[] names = targets.getNames();
for (int i = 0; i != names.length; i++)
{
GeneralName gn = names[i];
if (gn.getTagNo() == GeneralName.directoryName)
{
if (X500Name.getInstance(gn.getName()).equals(subject))
{
return true;
}
}
}
return false;
}
示例9: PKIArchiveControlBuilder
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
/**
* Basic constructor - specify the contents of the PKIArchiveControl structure.
*
* @param privateKeyInfo the private key to be archived.
* @param generalName the general name to be associated with the private key.
*/
public PKIArchiveControlBuilder(PrivateKeyInfo privateKeyInfo, GeneralName generalName)
{
EncKeyWithID encKeyWithID = new EncKeyWithID(privateKeyInfo, generalName);
try
{
this.keyContent = new CMSProcessableByteArray(CRMFObjectIdentifiers.id_ct_encKeyWithID, encKeyWithID.getEncoded());
}
catch (IOException e)
{
throw new IllegalStateException("unable to encode key and general name info");
}
this.envGen = new CMSEnvelopedDataGenerator();
}
示例10: addAdditionalStoresFromAltNames
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
protected static void addAdditionalStoresFromAltNames(
X509Certificate cert,
ExtendedPKIXParameters pkixParams)
throws CertificateParsingException
{
// if in the IssuerAltName extension an URI
// is given, add an additinal X.509 store
if (cert.getIssuerAlternativeNames() != null)
{
Iterator it = cert.getIssuerAlternativeNames().iterator();
while (it.hasNext())
{
// look for URI
List list = (List)it.next();
if (list.get(0).equals(Integers.valueOf(GeneralName.uniformResourceIdentifier)))
{
// found
String temp = (String)list.get(1);
CertPathValidatorUtilities.addAdditionalStoreFromLocation(temp, pkixParams);
}
}
}
}
示例11: EncKeyWithID
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private EncKeyWithID(ASN1Sequence seq)
{
this.privKeyInfo = PrivateKeyInfo.getInstance(seq.getObjectAt(0));
if (seq.size() > 1)
{
if (!(seq.getObjectAt(1) instanceof DERUTF8String))
{
this.identifier = GeneralName.getInstance(seq.getObjectAt(1));
}
else
{
this.identifier = (ASN1Encodable)seq.getObjectAt(1);
}
}
else
{
this.identifier = null;
}
}
示例12: POPOSigningKeyInput
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
private POPOSigningKeyInput(ASN1Sequence seq)
{
ASN1Encodable authInfo = (ASN1Encodable)seq.getObjectAt(0);
if (authInfo instanceof ASN1TaggedObject)
{
ASN1TaggedObject tagObj = (ASN1TaggedObject)authInfo;
if (tagObj.getTagNo() != 0)
{
throw new IllegalArgumentException(
"Unknown authInfo tag: " + tagObj.getTagNo());
}
sender = GeneralName.getInstance(tagObj.getObject());
}
else
{
publicKeyMAC = PKMACValue.getInstance(authInfo);
}
publicKey = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(1));
}
示例13: TSTInfo
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
public TSTInfo(ASN1ObjectIdentifier tsaPolicyId, MessageImprint messageImprint,
ASN1Integer serialNumber, ASN1GeneralizedTime genTime,
Accuracy accuracy, ASN1Boolean ordering, ASN1Integer nonce,
GeneralName tsa, Extensions extensions)
{
version = new ASN1Integer(1);
this.tsaPolicyId = tsaPolicyId;
this.messageImprint = messageImprint;
this.serialNumber = serialNumber;
this.genTime = genTime;
this.accuracy = accuracy;
this.ordering = ordering;
this.nonce = nonce;
this.tsa = tsa;
this.extensions = extensions;
}
示例14: SubjectAlternativeNameImpl
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
public SubjectAlternativeNameImpl(X509Certificate cert) throws IOException {
DNSNames = new ArrayList<>();
byte[] extVal = cert.getExtensionValue(Extension.subjectAlternativeName.getId());
if (extVal == null)
return;
GeneralNames gn = GeneralNames.getInstance(X509ExtensionUtil.fromExtensionValue(extVal));
GeneralName[] names = gn.getNames();
for (GeneralName name : names) {
if (name.getTagNo() == GeneralName.dNSName) {
String dns = name.getName().toString();
DNSNames.add(dns);
}
}
}
示例15: CRLDistributionPointsImpl
import org.bouncycastle.asn1.x509.GeneralName; //導入依賴的package包/類
public CRLDistributionPointsImpl(X509Certificate cert) throws CertificateException, IOException {
URINames = new ArrayList<>();
byte[] extVal = cert.getExtensionValue(Extension.cRLDistributionPoints.getId());
if (extVal == null)
return;
CRLDistPoint crlDistPoint = CRLDistPoint.getInstance(X509ExtensionUtil.fromExtensionValue(extVal));
DistributionPoint[] points = crlDistPoint.getDistributionPoints();
for (DistributionPoint p : points) {
GeneralNames tmp = p.getCRLIssuer();
if (tmp != null) {
GeneralName[] crlIssers = tmp.getNames();
for (int i = 0; i < crlIssers.length; i++) {
if (crlIssers[i].getTagNo() == GeneralName.uniformResourceIdentifier) {
String issuerUrl = crlIssers[i].toString();
URINames.add(issuerUrl);
}
}
}
}
}