本文整理汇总了Java中org.bouncycastle.asn1.DERApplicationSpecific.getApplicationTag方法的典型用法代码示例。如果您正苦于以下问题:Java DERApplicationSpecific.getApplicationTag方法的具体用法?Java DERApplicationSpecific.getApplicationTag怎么用?Java DERApplicationSpecific.getApplicationTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.DERApplicationSpecific
的用法示例。
在下文中一共展示了DERApplicationSpecific.getApplicationTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CVCertificateRequest
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
private CVCertificateRequest(DERApplicationSpecific request)
throws IOException
{
if (request.getApplicationTag() == EACTags.AUTHENTIFICATION_DATA)
{
ASN1Sequence seq = ASN1Sequence.getInstance(request.getObject(BERTags.SEQUENCE));
initCertBody(DERApplicationSpecific.getInstance(seq.getObjectAt(0)));
outerSignature = DERApplicationSpecific.getInstance(seq.getObjectAt(seq.size() - 1)).getContents();
}
else
{
initCertBody(request);
}
}
示例2: asApplicationSpecific
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
static ASN1Primitive asApplicationSpecific(int tag, ASN1Encodable encodable) {
try {
DERApplicationSpecific specific = as(DERApplicationSpecific.class, encodable);
if (specific.getApplicationTag() == tag) {
return specific.getObject();
} else {
throw new IllegalArgumentException(
"tag mismatch, expected " + tag + " got " + specific.getApplicationTag());
}
} catch (IOException ex) {
throw new IllegalArgumentException(ex);
}
}
示例3: encodeTag
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public static int encodeTag(DERApplicationSpecific spec)
{
int retValue = BERTags.APPLICATION;
boolean constructed = spec.isConstructed();
if (constructed)
{
retValue |= BERTags.CONSTRUCTED;
}
int tag = spec.getApplicationTag();
if (tag > 31)
{
retValue |= 0x1F;
retValue <<= 8;
int currentByte = tag & 0x7F;
retValue |= currentByte;
tag >>= 7;
while (tag > 0)
{
retValue |= 0x80;
retValue <<= 8;
currentByte = tag & 0x7F;
tag >>= 7;
}
}
else
{
retValue |= tag;
}
return retValue;
}
示例4: initCertBody
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
private void initCertBody(DERApplicationSpecific request)
throws IOException
{
if (request.getApplicationTag() == EACTags.CARDHOLDER_CERTIFICATE)
{
ASN1Sequence seq = ASN1Sequence.getInstance(request.getObject(BERTags.SEQUENCE));
for (Enumeration en = seq.getObjects(); en.hasMoreElements();)
{
DERApplicationSpecific obj = DERApplicationSpecific.getInstance(en.nextElement());
switch (obj.getApplicationTag())
{
case EACTags.CERTIFICATE_CONTENT_TEMPLATE:
certificateBody = CertificateBody.getInstance(obj);
valid |= bodyValid;
break;
case EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP:
innerSignature = obj.getContents();
valid |= signValid;
break;
default:
throw new IOException("Invalid tag, not an CV Certificate Request element:" + obj.getApplicationTag());
}
}
}
else
{
throw new IOException("not a CARDHOLDER_CERTIFICATE in request:" + request.getApplicationTag());
}
}
示例5: setCertificateProfileIdentifier
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
private void setCertificateProfileIdentifier(DERApplicationSpecific certificateProfileIdentifier)
throws IllegalArgumentException
{
if (certificateProfileIdentifier.getApplicationTag() == EACTags.INTERCHANGE_PROFILE)
{
this.certificateProfileIdentifier = certificateProfileIdentifier;
certificateType |= CPI;
}
else
{
throw new IllegalArgumentException("Not an Iso7816Tags.INTERCHANGE_PROFILE tag :" + EACTags.encodeTag(certificateProfileIdentifier));
}
}
示例6: setCertificateHolderReference
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
private void setCertificateHolderReference(DERApplicationSpecific certificateHolderReference)
throws IllegalArgumentException
{
if (certificateHolderReference.getApplicationTag() == EACTags.CARDHOLDER_NAME)
{
this.certificateHolderReference = certificateHolderReference;
certificateType |= CHR;
}
else
{
throw new IllegalArgumentException("Not an Iso7816Tags.CARDHOLDER_NAME tag");
}
}
示例7: setCertificationAuthorityReference
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
/**
* set the CertificationAuthorityReference.
*
* @param certificationAuthorityReference
* the DERApplicationSpecific containing the CertificationAuthorityReference.
* @throws IllegalArgumentException if the DERApplicationSpecific is not valid.
*/
private void setCertificationAuthorityReference(
DERApplicationSpecific certificationAuthorityReference)
throws IllegalArgumentException
{
if (certificationAuthorityReference.getApplicationTag() == EACTags.ISSUER_IDENTIFICATION_NUMBER)
{
this.certificationAuthorityReference = certificationAuthorityReference;
certificateType |= CAR;
}
else
{
throw new IllegalArgumentException("Not an Iso7816Tags.ISSUER_IDENTIFICATION_NUMBER tag");
}
}
示例8: setCertificateEffectiveDate
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
/**
* set the date of the certificate generation
*
* @param ced DERApplicationSpecific containing the date of the certificate generation
* @throws IllegalArgumentException if the tag is not Iso7816Tags.APPLICATION_EFFECTIVE_DATE
*/
private void setCertificateEffectiveDate(DERApplicationSpecific ced)
throws IllegalArgumentException
{
if (ced.getApplicationTag() == EACTags.APPLICATION_EFFECTIVE_DATE)
{
this.certificateEffectiveDate = ced;
certificateType |= CEfD;
}
else
{
throw new IllegalArgumentException("Not an Iso7816Tags.APPLICATION_EFFECTIVE_DATE tag :" + EACTags.encodeTag(ced));
}
}
示例9: setCertificateExpirationDate
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
/**
* set the date after wich the certificate expires
*
* @param ced DERApplicationSpecific containing the date after wich the certificate expires
* @throws IllegalArgumentException if the tag is not Iso7816Tags.APPLICATION_EXPIRATION_DATE
*/
private void setCertificateExpirationDate(DERApplicationSpecific ced)
throws IllegalArgumentException
{
if (ced.getApplicationTag() == EACTags.APPLICATION_EXPIRATION_DATE)
{
this.certificateExpirationDate = ced;
certificateType |= CExD;
}
else
{
throw new IllegalArgumentException("Not an Iso7816Tags.APPLICATION_EXPIRATION_DATE tag");
}
}
示例10: CertificateHolderAuthorization
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
/**
* create an Iso7816CertificateHolderAuthorization according to the {@link DERApplicationSpecific}
*
* @param aSpe the DERApplicationSpecific containing the data
* @throws IOException
*/
public CertificateHolderAuthorization(DERApplicationSpecific aSpe)
throws IOException
{
if (aSpe.getApplicationTag() == EACTags.CERTIFICATE_HOLDER_AUTHORIZATION_TEMPLATE)
{
setPrivateData(new ASN1InputStream(aSpe.getContents()));
}
}
示例11: CVCertBody
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public CVCertBody(DERApplicationSpecific derApp) throws IllegalArgumentException, IOException {
if (derApp.getApplicationTag()!=0x4E) throw new IllegalArgumentException("contains no Certifcate Body with tag 0x7F4E");
else cvcbody = derApp;
ASN1Sequence bodySeq= (ASN1Sequence)cvcbody.getObject(BERTags.SEQUENCE);
profileIdentifier = (ASN1Integer) ((DERApplicationSpecific) bodySeq.getObjectAt(0)).getObject(BERTags.INTEGER);
authorityReference = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(1)).getObject(BERTags.IA5_STRING);
ASN1Sequence pkSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(2)).getObject(BERTags.SEQUENCE);
ASN1ObjectIdentifier pkOid = (ASN1ObjectIdentifier) pkSeq.getObjectAt(0);
if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.2")) {
publicKey = new AmECPublicKey(pkSeq);
}
else if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.1")) {
publicKey = new AmRSAPublicKey(pkSeq);
}
chr = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(3)).getObject(BERTags.IA5_STRING);
ASN1Sequence chatSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(4)).getObject(BERTags.SEQUENCE);
chat = new CertificateHolderAuthorizationTemplate(chatSeq);
effectiveDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(5)).getObject(BERTags.OCTET_STRING);
expirationDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(6)).getObject(BERTags.OCTET_STRING);
if (bodySeq.size()>7) {
extensions = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(7)).getObject(BERTags.SEQUENCE);
}
}
示例12: CallDetailRecord
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public CallDetailRecord(ASN1Sequence inSeq) throws UnsupportedEncodingException {
cdr = inSeq;
for (@SuppressWarnings("unchecked")
Enumeration<ASN1Encodable> en = cdr.getObjects(); en.hasMoreElements();) {
ASN1Encodable em = en.nextElement();
ASN1Primitive emp = em.toASN1Primitive();
DERApplicationSpecific emt = (DERApplicationSpecific)emp;
//System.out.println("emt.getApplicationTag(): "+emt.getApplicationTag());
switch (emt.getApplicationTag()) {
case 2: recordNumber = emt.getContents()[0];
break;
case 8: callingNumber = new String(emt.getContents(), "UTF-8");
break;
case 9: calledNumber = new String(emt.getContents(), "UTF-8");
break;
case 16: startDate = new String(emt.getContents(), "UTF-8");
break;
case 18: startTime = new String(emt.getContents(), "UTF-8");
break;
case 19: duration = emt.getContents()[0];
break;
default:
//Unknown application number. In production would either log or error.
break;
}
}
}
示例13: CallDetailRecord
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public CallDetailRecord(ASN1Sequence inSeq) throws UnsupportedEncodingException {
cdr = inSeq;
for (Enumeration<ASN1Encodable> en = cdr.getObjects(); en.hasMoreElements();) {
ASN1Encodable em = en.nextElement();
ASN1Primitive emp = em.toASN1Primitive();
DERApplicationSpecific emt = (DERApplicationSpecific)emp;
//System.out.println("emt.getApplicationTag(): "+emt.getApplicationTag());
switch (emt.getApplicationTag()) {
case 2: recordNumber = emt.getContents()[0];
break;
case 8: callingNumber = new String(emt.getContents(), "UTF-8");
break;
case 9: calledNumber = new String(emt.getContents(), "UTF-8");
break;
case 16: startDate = new String(emt.getContents(), "UTF-8");
break;
case 18: startTime = new String(emt.getContents(), "UTF-8");
break;
case 19: duration = emt.getContents()[0];
break;
default:
//Unknown application number. In production would either log or error.
break;
}
}
}
示例14: performTest
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public void performTest()
throws Exception
{
DERInteger value = new DERInteger(9);
DERApplicationSpecific tagged = new DERApplicationSpecific(false, 3, value);
if (!areEqual(impData, tagged.getEncoded()))
{
fail("implicit encoding failed");
}
DERInteger recVal = (DERInteger)tagged.getObject(BERTags.INTEGER);
if (!value.equals(recVal))
{
fail("implicit read back failed");
}
DERApplicationSpecific certObj = (DERApplicationSpecific)
ASN1Primitive.fromByteArray(certData);
if (!certObj.isConstructed() || certObj.getApplicationTag() != 33)
{
fail("parsing of certificate data failed");
}
byte[] encoded = certObj.getEncoded(ASN1Encoding.DER);
if (!Arrays.areEqual(certData, encoded))
{
fail("re-encoding of certificate data failed");
}
}
示例15: decodeApplicationSpecific
import org.bouncycastle.asn1.DERApplicationSpecific; //导入方法依赖的package包/类
public static DEREncodable decodeApplicationSpecific(DEREncodable enc)
{
// TODO
if (enc instanceof DERApplicationSpecific)
{
DERApplicationSpecific app = (DERApplicationSpecific) enc;
try
{
if (app.getApplicationTag() == IPAddress.APPLICATION_TAG) return IPAddress.fromApplicationSpecific(app);
else if (app.getApplicationTag() == TimeTicks.APPLICATION_TAG) return TimeTicks.fromApplicationSpecific(app);
else if (app.getApplicationTag() == Counter32.APPLICATION_TAG) return Counter32.fromApplicationSpecific(app);
else if (app.getApplicationTag() == Gauge32.APPLICATION_TAG) return Gauge32.fromApplicationSpecific(app);
else if (app.getApplicationTag() == Counter64.APPLICATION_TAG) return Counter64.fromApplicationSpecific(app);
}
catch (Exception e)
{
throw new RuntimeException("Failed to decode application specific entity", e);
}
}
else if (enc instanceof DERTaggedObject)
{
DERTaggedObject obj = (DERTaggedObject) enc;
if (obj.getTagNo() == NoSuchObject.TAG) return new NoSuchObject();
else if (obj.getTagNo() == NoSuchInstance.TAG) return new NoSuchInstance();
else if (obj.getTagNo() == EndOfMIBView.TAG) return new EndOfMIBView();
}
return enc;
}