本文整理汇总了Java中org.bouncycastle.asn1.ASN1ObjectIdentifier.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ASN1ObjectIdentifier.getInstance方法的具体用法?Java ASN1ObjectIdentifier.getInstance怎么用?Java ASN1ObjectIdentifier.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.ASN1ObjectIdentifier
的用法示例。
在下文中一共展示了ASN1ObjectIdentifier.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUPNStringFromSequence
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
* Get UPN String.
*
* @param seq ASN1Sequence abstraction representing subject alternative name.
* First element is the object identifier, second is the object itself.
*
* @return UPN string or null
*/
private String getUPNStringFromSequence(final ASN1Sequence seq) {
if (seq != null) {
// First in sequence is the object identifier, that we must check
final ASN1ObjectIdentifier id = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
if (id != null && UPN_OBJECTID.equals(id.getId())) {
final ASN1TaggedObject obj = (ASN1TaggedObject) seq.getObjectAt(1);
ASN1Primitive prim = obj.getObject();
// Due to bug in java cert.getSubjectAltName, it can be tagged an extra time
if (prim instanceof ASN1TaggedObject) {
prim = ASN1TaggedObject.getInstance(((ASN1TaggedObject) prim)).getObject();
}
if (prim instanceof ASN1OctetString) {
return new String(((ASN1OctetString) prim).getOctets());
} else if (prim instanceof ASN1String) {
return ((ASN1String) prim).getString();
} else{
return null;
}
}
}
return null;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:33,代码来源:X509SubjectAlternativeNameUPNPrincipalResolver.java
示例2: getUPNStringFromSequence
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
* Get UPN String.
*
* @param seq ASN1Sequence abstraction representing subject alternative name.
* First element is the object identifier, second is the object itself.
* @return UPN string or null
*/
private static String getUPNStringFromSequence(final ASN1Sequence seq) {
if (seq != null) {
// First in sequence is the object identifier, that we must check
final ASN1ObjectIdentifier id = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
if (id != null && UPN_OBJECTID.equals(id.getId())) {
final ASN1TaggedObject obj = (ASN1TaggedObject) seq.getObjectAt(1);
ASN1Primitive prim = obj.getObject();
// Due to bug in java cert.getSubjectAltName, it can be tagged an extra time
if (prim instanceof ASN1TaggedObject) {
prim = ASN1TaggedObject.getInstance(prim).getObject();
}
if (prim instanceof ASN1OctetString) {
return new String(((ASN1OctetString) prim).getOctets(), StandardCharsets.UTF_8);
}
if (prim instanceof ASN1String) {
return ((ASN1String) prim).getString();
}
return null;
}
}
return null;
}
示例3: ObjectDigestInfo
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
private ObjectDigestInfo(
ASN1Sequence seq)
{
if (seq.size() > 4 || seq.size() < 3)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
digestedObjectType = ASN1Enumerated.getInstance(seq.getObjectAt(0));
int offset = 0;
if (seq.size() == 4)
{
otherObjectTypeID = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(1));
offset++;
}
digestAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1 + offset));
objectDigest = DERBitString.getInstance(seq.getObjectAt(2 + offset));
}
示例4: PolicyInformation
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
private PolicyInformation(
ASN1Sequence seq)
{
if (seq.size() < 1 || seq.size() > 2)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
policyIdentifier = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
if (seq.size() > 1)
{
policyQualifiers = ASN1Sequence.getInstance(seq.getObjectAt(1));
}
}
示例5: getInstance
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static TypeOfBiometricData getInstance(Object obj)
{
if (obj == null || obj instanceof TypeOfBiometricData)
{
return (TypeOfBiometricData)obj;
}
if (obj instanceof ASN1Integer)
{
ASN1Integer predefinedBiometricTypeObj = ASN1Integer.getInstance(obj);
int predefinedBiometricType = predefinedBiometricTypeObj.getValue().intValue();
return new TypeOfBiometricData(predefinedBiometricType);
}
else if (obj instanceof ASN1ObjectIdentifier)
{
ASN1ObjectIdentifier BiometricDataID = ASN1ObjectIdentifier.getInstance(obj);
return new TypeOfBiometricData(BiometricDataID);
}
throw new IllegalArgumentException("unknown object in getInstance");
}
示例6: AlgorithmIdentifier
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
* @deprecated use AlgorithmIdentifier.getInstance()
* @param seq
*/
public AlgorithmIdentifier(
ASN1Sequence seq)
{
if (seq.size() < 1 || seq.size() > 2)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
objectId = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
if (seq.size() == 2)
{
parametersDefined = true;
parameters = seq.getObjectAt(1);
}
else
{
parameters = null;
}
}
示例7: getObjectIdentifier
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static ASN1ObjectIdentifier getObjectIdentifier(ASN1Encodable object)
throws BadAsn1ObjectException {
try {
return ASN1ObjectIdentifier.getInstance(object);
} catch (IllegalArgumentException ex) {
throw new BadAsn1ObjectException("invalid object ObjectIdentifier: " + ex.getMessage(),
ex);
}
}
示例8: InfoTypeAndValue
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
private InfoTypeAndValue(ASN1Sequence seq)
{
infoType = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
if (seq.size() > 1)
{
infoValue = (ASN1Encodable)seq.getObjectAt(1);
}
}
示例9: getInstance
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static CertPolicyId getInstance(Object o)
{
if (o instanceof CertPolicyId)
{
return (CertPolicyId)o;
}
else if (o != null)
{
return new CertPolicyId(ASN1ObjectIdentifier.getInstance(o));
}
return null;
}
示例10: SemanticsInformation
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
private SemanticsInformation(ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
if (seq.size() < 1)
{
throw new IllegalArgumentException("no objects in SemanticsInformation");
}
Object object = e.nextElement();
if (object instanceof ASN1ObjectIdentifier)
{
semanticsIdentifier = ASN1ObjectIdentifier.getInstance(object);
if (e.hasMoreElements())
{
object = e.nextElement();
}
else
{
object = null;
}
}
if (object != null)
{
ASN1Sequence generalNameSeq = ASN1Sequence.getInstance(object);
nameRegistrationAuthorities = new GeneralName[generalNameSeq.size()];
for (int i= 0; i < generalNameSeq.size(); i++)
{
nameRegistrationAuthorities[i] = GeneralName.getInstance(generalNameSeq.getObjectAt(i));
}
}
}
示例11: QCStatement
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
private QCStatement(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
// qcStatementId
qcStatementId = ASN1ObjectIdentifier.getInstance(e.nextElement());
// qcstatementInfo
if (e.hasMoreElements())
{
qcStatementInfo = (ASN1Encodable) e.nextElement();
}
}
示例12: X509Extensions
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
* Constructor from a table of extensions with ordering.
* <p>
* It's is assumed the table contains OID/String pairs.
* @deprecated use Extensions
*/
public X509Extensions(
Vector ordering,
Hashtable extensions)
{
Enumeration e;
if (ordering == null)
{
e = extensions.keys();
}
else
{
e = ordering.elements();
}
while (e.hasMoreElements())
{
this.ordering.addElement(ASN1ObjectIdentifier.getInstance(e.nextElement()));
}
e = this.ordering.elements();
while (e.hasMoreElements())
{
ASN1ObjectIdentifier oid = ASN1ObjectIdentifier.getInstance(e.nextElement());
X509Extension ext = (X509Extension)extensions.get(oid);
this.extensions.put(oid, ext);
}
}
示例13: getInstance
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static KeyPurposeId getInstance(Object o)
{
if (o instanceof KeyPurposeId)
{
return (KeyPurposeId)o;
}
else if (o != null)
{
return new KeyPurposeId(ASN1ObjectIdentifier.getInstance(o));
}
return null;
}
示例14: getInstance
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static DSTU4145Params getInstance(Object obj)
{
if (obj instanceof DSTU4145Params)
{
return (DSTU4145Params)obj;
}
if (obj != null)
{
ASN1Sequence seq = ASN1Sequence.getInstance(obj);
DSTU4145Params params;
if (seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
{
params = new DSTU4145Params(ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0)));
}
else
{
params = new DSTU4145Params(DSTU4145ECBinary.getInstance(seq.getObjectAt(0)));
}
if (seq.size() == 2)
{
params.dke = ASN1OctetString.getInstance(seq.getObjectAt(1)).getOctets();
if (params.dke.length != DSTU4145Params.DEFAULT_DKE.length)
{
throw new IllegalArgumentException("object parse error");
}
}
return params;
}
throw new IllegalArgumentException("object parse error");
}
示例15: getProfessionOIDs
import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
* @return Returns the professionOIDs.
*/
public ASN1ObjectIdentifier[] getProfessionOIDs()
{
if (professionOIDs == null)
{
return new ASN1ObjectIdentifier[0];
}
ASN1ObjectIdentifier[] oids = new ASN1ObjectIdentifier[professionOIDs.size()];
int count = 0;
for (Enumeration e = professionOIDs.getObjects(); e.hasMoreElements();)
{
oids[count++] = ASN1ObjectIdentifier.getInstance(e.nextElement());
}
return oids;
}