本文整理匯總了Java中org.bouncycastle.asn1.ASN1Sequence類的典型用法代碼示例。如果您正苦於以下問題:Java ASN1Sequence類的具體用法?Java ASN1Sequence怎麽用?Java ASN1Sequence使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ASN1Sequence類屬於org.bouncycastle.asn1包,在下文中一共展示了ASN1Sequence類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: McElieceCCA2PublicKey
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private McElieceCCA2PublicKey(ASN1Sequence seq)
{
oid = ((ASN1ObjectIdentifier)seq.getObjectAt(0));
BigInteger bigN = ((ASN1Integer)seq.getObjectAt(1)).getValue();
n = bigN.intValue();
BigInteger bigT = ((ASN1Integer)seq.getObjectAt(2)).getValue();
t = bigT.intValue();
matrixG = ((ASN1OctetString)seq.getObjectAt(3)).getOctets();
}
示例2: PKIStatusInfo
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private PKIStatusInfo(
ASN1Sequence seq)
{
this.status = ASN1Integer.getInstance(seq.getObjectAt(0));
this.statusString = null;
this.failInfo = null;
if (seq.size() > 2)
{
this.statusString = PKIFreeText.getInstance(seq.getObjectAt(1));
this.failInfo = DERBitString.getInstance(seq.getObjectAt(2));
}
else if (seq.size() > 1)
{
Object obj = seq.getObjectAt(1);
if (obj instanceof DERBitString)
{
this.failInfo = DERBitString.getInstance(obj);
}
else
{
this.statusString = PKIFreeText.getInstance(obj);
}
}
}
示例3: getUPNStringFromSequence
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的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
示例4: resolvePrincipalInternal
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
/**
* Retrieves Subject Alternative Name UPN extension as a principal id String.
*
* @param certificate X.509 certificate credential.
*
* @return Resolved principal ID or null if no SAN UPN extension is available in provided certificate.
*
* @see AbstractX509PrincipalResolver#resolvePrincipalInternal(java.security.cert.X509Certificate)
* @see java.security.cert.X509Certificate#getSubjectAlternativeNames()
*/
@Override
protected String resolvePrincipalInternal(final X509Certificate certificate) {
logger.debug("Resolving principal from Subject Alternative Name UPN for {}", certificate);
try {
final Collection<List<?>> subjectAltNames = certificate.getSubjectAlternativeNames();
if (subjectAltNames != null) {
for (final List<?> sanItem : subjectAltNames) {
final ASN1Sequence seq = getAltnameSequence(sanItem);
final String upnString = getUPNStringFromSequence(seq);
if (upnString != null) {
return upnString;
}
}
}
} catch (final CertificateParsingException e) {
logger.error("Error is encountered while trying to retrieve subject alternative names collection from certificate", e);
logger.debug("Returning null principal id...");
return null;
}
logger.debug("Returning null principal id...");
return null;
}
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:33,代碼來源:X509SubjectAlternativeNameUPNPrincipalResolver.java
示例5: DHParameter
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private DHParameter(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
p = ASN1Integer.getInstance(e.nextElement());
g = ASN1Integer.getInstance(e.nextElement());
if (e.hasMoreElements())
{
l = (ASN1Integer)e.nextElement();
}
else
{
l = null;
}
}
示例6: getInstance
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
public static NameOrPseudonym getInstance(Object obj)
{
if (obj == null || obj instanceof NameOrPseudonym)
{
return (NameOrPseudonym)obj;
}
if (obj instanceof ASN1String)
{
return new NameOrPseudonym(DirectoryString.getInstance(obj));
}
if (obj instanceof ASN1Sequence)
{
return new NameOrPseudonym((ASN1Sequence)obj);
}
throw new IllegalArgumentException("illegal object in getInstance: "
+ obj.getClass().getName());
}
示例7: getInstance
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
public static ProtectedPart getInstance(Object o)
{
if (o instanceof ProtectedPart)
{
return (ProtectedPart)o;
}
if (o != null)
{
return new ProtectedPart(ASN1Sequence.getInstance(o));
}
return null;
}
示例8: CscaMasterList
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private CscaMasterList(
ASN1Sequence seq)
{
if (seq == null || seq.size() == 0)
{
throw new IllegalArgumentException(
"null or empty sequence passed.");
}
if (seq.size() != 2)
{
throw new IllegalArgumentException(
"Incorrect sequence size: " + seq.size());
}
version = ASN1Integer.getInstance(seq.getObjectAt(0));
ASN1Set certSet = ASN1Set.getInstance(seq.getObjectAt(1));
certList = new Certificate[certSet.size()];
for (int i = 0; i < certList.length; i++)
{
certList[i]
= Certificate.getInstance(certSet.getObjectAt(i));
}
}
示例9: POPOSigningKey
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private POPOSigningKey(ASN1Sequence seq)
{
int index = 0;
if (seq.getObjectAt(index) instanceof ASN1TaggedObject)
{
ASN1TaggedObject tagObj
= (ASN1TaggedObject)seq.getObjectAt(index++);
if (tagObj.getTagNo() != 0)
{
throw new IllegalArgumentException(
"Unknown POPOSigningKeyInput tag: " + tagObj.getTagNo());
}
poposkInput = POPOSigningKeyInput.getInstance(tagObj.getObject());
}
algorithmIdentifier = AlgorithmIdentifier.getInstance(seq.getObjectAt(index++));
signature = DERBitString.getInstance(seq.getObjectAt(index));
}
示例10: addCRL
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
/**
* Add the CRLEntry objects contained in a previous CRL.
*
* @param other the X509CRL to source the other entries from.
*/
public void addCRL(X509CRL other)
throws CRLException
{
Set revocations = other.getRevokedCertificates();
if (revocations != null)
{
Iterator it = revocations.iterator();
while (it.hasNext())
{
X509CRLEntry entry = (X509CRLEntry)it.next();
ASN1InputStream aIn = new ASN1InputStream(entry.getEncoded());
try
{
tbsGen.addCRLEntry(ASN1Sequence.getInstance(aIn.readObject()));
}
catch (IOException e)
{
throw new CRLException("exception processing encoding of CRL: " + e.toString());
}
}
}
}
示例11: getInstance
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
public static Asn1SignTemplate getInstance(Object obj) throws BadAsn1ObjectException {
if (obj == null || obj instanceof Asn1SignTemplate) {
return (Asn1SignTemplate) obj;
}
try {
if (obj instanceof ASN1Sequence) {
return new Asn1SignTemplate((ASN1Sequence) obj);
} else if (obj instanceof byte[]) {
return getInstance(ASN1Primitive.fromByteArray((byte[]) obj));
} else {
throw new BadAsn1ObjectException("unknown object: " + obj.getClass().getName());
}
} catch (IOException | IllegalArgumentException ex) {
throw new BadAsn1ObjectException("unable to parse encoded object: " + ex.getMessage(),
ex);
}
}
示例12: Asn1NewKeyControl
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private Asn1NewKeyControl(ASN1Sequence seq) throws BadAsn1ObjectException {
control = new P11NewKeyControl();
final int size = seq.size();
for (int i = 0; i < size; i++) {
ASN1Encodable obj = seq.getObjectAt(i);
if (obj instanceof ASN1TaggedObject) {
continue;
}
ASN1TaggedObject tagObj = (ASN1TaggedObject) obj;
int tagNo = tagObj.getTagNo();
if (tagNo == 0) {
boolean bv = ((ASN1Boolean) tagObj.getObject()).isTrue();
control.setExtractable(bv);
}
}
}
示例13: getInstance
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
public static Asn1P11ObjectIdentifier getInstance(Object obj) throws BadAsn1ObjectException {
if (obj == null || obj instanceof Asn1P11ObjectIdentifier) {
return (Asn1P11ObjectIdentifier) obj;
}
try {
if (obj instanceof ASN1Sequence) {
return new Asn1P11ObjectIdentifier((ASN1Sequence) obj);
} else if (obj instanceof byte[]) {
return getInstance(ASN1Primitive.fromByteArray((byte[]) obj));
} else {
throw new BadAsn1ObjectException("unknown object: " + obj.getClass().getName());
}
} catch (IOException | IllegalArgumentException ex) {
throw new BadAsn1ObjectException("unable to parse encoded object: " + ex.getMessage(),
ex);
}
}
示例14: PKCS12SafeBagFactory
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
public PKCS12SafeBagFactory(ContentInfo info, InputDecryptorProvider inputDecryptorProvider)
throws PKCSException
{
if (info.getContentType().equals(PKCSObjectIdentifiers.encryptedData))
{
CMSEncryptedData encData = new CMSEncryptedData(org.bouncycastle.asn1.cms.ContentInfo.getInstance(info));
try
{
this.safeBagSeq = ASN1Sequence.getInstance(encData.getContent(inputDecryptorProvider));
}
catch (CMSException e)
{
throw new PKCSException("unable to extract data: " + e.getMessage(), e);
}
return;
}
throw new IllegalArgumentException("encryptedData requires constructor with decryptor.");
}
示例15: IssuerSerial
import org.bouncycastle.asn1.ASN1Sequence; //導入依賴的package包/類
private IssuerSerial(
ASN1Sequence seq)
{
if (seq.size() != 2 && seq.size() != 3)
{
throw new IllegalArgumentException("Bad sequence size: " + seq.size());
}
issuer = GeneralNames.getInstance(seq.getObjectAt(0));
serial = ASN1Integer.getInstance(seq.getObjectAt(1));
if (seq.size() == 3)
{
issuerUID = DERBitString.getInstance(seq.getObjectAt(2));
}
}