当前位置: 首页>>代码示例>>Java>>正文


Java DERApplicationSpecific类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.DERApplicationSpecific的典型用法代码示例。如果您正苦于以下问题:Java DERApplicationSpecific类的具体用法?Java DERApplicationSpecific怎么用?Java DERApplicationSpecific使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DERApplicationSpecific类属于org.bouncycastle.asn1包,在下文中一共展示了DERApplicationSpecific类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseDG1

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void parseDG1(byte[] DG1) {
    try {
        ASN1InputStream bIn = new ASN1InputStream(DG1);
        org.bouncycastle.asn1.DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();

        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
        Enumeration secEnum = seq.getObjects();
        while (secEnum.hasMoreElements()) {
            ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
            byte[] data = seqObj.getEncoded();
            if (data[0]== 0x41) {
                Log.d("type approval number", ByteUtils.bytesToHex(data));
                this.set5F01(data);
            } else if (data[0] == 0x42) {
                byte[] input = Arrays.copyOfRange(data, 3, data.length);
                parse5F02(input);
            } else if (data[0] == 0x7F) {
                parse7F63(data);
            }
        }
        bIn.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:27,代码来源:DrivingLicence.java

示例2: parseNonce

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private byte[] parseNonce(byte[] data) {
    try (ASN1InputStream bIn = new ASN1InputStream(data)) {
        DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();

        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);

        byte[] tag80 = ((ASN1Primitive) seq.getObjects().nextElement()).getEncoded();

        if (tag80[0] == (byte) 0x80) {

            MessageDigest md = MessageDigest.getInstance("SHA-256");
            byte[] kpi =  md.digest(Bytes.concatenate(CAN.getBytes(), Bytes.bytes("00 00 00 03")));

            return AESUtils.decryptAESCBC(Bytes.allButFirst(tag80, 2), kpi);
        }
    } catch (IOException | NoSuchAlgorithmException e) {
        Log.e(getClass().getName(), "Failed to parse nonce from response data", e);
    }

    return null;
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:22,代码来源:PACEAPDUInterface.java

示例3: parseDG11

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void parseDG11(byte[] DG11) {
    try {
        ASN1InputStream bIn = new ASN1InputStream(DG11);
        org.bouncycastle.asn1.DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();

        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
        Enumeration secEnum = seq.getObjects();
        while (secEnum.hasMoreElements()) {
            ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
            byte[] data = seqObj.getEncoded();
            if (data[0]== 0x7F) {
                parseDG11(data);
            } else if (data[0] == (byte) 0x80) {
                this.setBSN(Arrays.copyOfRange(data, 2, data.length));
            }
        }
        bIn.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:23,代码来源:DrivingLicence.java

示例4: parseDG1

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void parseDG1(byte[] DG1) {
    try (ASN1InputStream bIn = new ASN1InputStream(DG1)) {

        org.bouncycastle.asn1.DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();

        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
        Enumeration secEnum = seq.getObjects();
        while (secEnum.hasMoreElements()) {
            ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
            byte[] data = seqObj.getEncoded();
            if (data[0]== 0x41) {
                Log.d("type approval number", ByteUtils.bytesToHex(data));
                this.set5F01(Bytes.allButFirst(data, 1));
            } else if (data[0] == 0x42) {
                byte[] input = Arrays.copyOfRange(data, 3, data.length);
                parse5F02(input);
            } else if (data[0] == 0x7F) {
                parse7F63(data);
            }
        }
    } catch (IOException e) {
        Log.e(getClass().getName(), e.getMessage(), e);
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:25,代码来源:DrivingLicence.java

示例5: parse7F63

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void parse7F63(byte[] input) {
    Log.d("input", ByteUtils.bytesToHex(input));
    try (ASN1InputStream bIn = new ASN1InputStream(input)) {
        ASN1Primitive obj = bIn.readObject();
        DERApplicationSpecific app = (DERApplicationSpecific) obj;
        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
        Enumeration secEnum = seq.getObjects();
        List<byte[]> categories = new ArrayList<>();
        while (secEnum.hasMoreElements()) {
            ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
            byte[] data = seqObj.getEncoded();
            Log.d("5F02data", ByteUtils.bytesToHex(data));
            switch (data[0]) {
                case 0x02:
                    Log.d("#CATEGORY","number of categories:" + data[data.length-1]);
                    break;
                case (byte) 0x87:
                    categories.add(Arrays.copyOfRange(data, 2, data.length));
                    break;
            }
        }
        this.set7F63(categories);
    } catch (IOException e) {
        Log.e(getClass().getName(), e.getMessage(), e);
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:27,代码来源:DrivingLicence.java

示例6: parseDG11

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void parseDG11(byte[] DG11) {
    try (ASN1InputStream bIn = new ASN1InputStream(DG11)) {
        DERApplicationSpecific app = (DERApplicationSpecific) bIn.readObject();

        ASN1Sequence seq = (ASN1Sequence) app.getObject(BERTags.SEQUENCE);
        Enumeration secEnum = seq.getObjects();
        while (secEnum.hasMoreElements()) {
            ASN1Primitive seqObj = (ASN1Primitive) secEnum.nextElement();
            byte[] data = seqObj.getEncoded();
            if (data[0]== 0x7F) {
                parseDG11(data);
            } else if (data[0] == (byte) 0x80) {
                this.setBSN(Arrays.copyOfRange(data, 2, data.length));
            }
        }
    } catch (IOException e) {
        Log.e(getClass().getName(), e.getMessage(), e);
    }
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:20,代码来源:DrivingLicence.java

示例7: 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);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:CVCertificateRequest.java

示例8: getInstance

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
public static CVCertificateRequest getInstance(Object obj)
{
    if (obj instanceof CVCertificateRequest)
    {
        return (CVCertificateRequest)obj;
    }
    else if (obj != null)
    {
        try
        {
            return new CVCertificateRequest(DERApplicationSpecific.getInstance(obj));
        }
        catch (IOException e)
        {
            throw new ASN1ParsingException("unable to parse data: " + e.getMessage(), e);
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:CVCertificateRequest.java

示例9: toASN1Primitive

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(certificateBody);

    try
    {
        v.add(new DERApplicationSpecific(false, EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP, new DEROctetString(innerSignature)));
    }
    catch (IOException e)
    {
        throw new IllegalStateException("unable to convert signature!");
    }

    return new DERApplicationSpecific(EACTags.CARDHOLDER_CERTIFICATE, v);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:CVCertificateRequest.java

示例10: initFrom

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void initFrom(ASN1InputStream aIS)
    throws IOException
{
    ASN1Primitive obj;
    while ((obj = aIS.readObject()) != null)
    {
        if (obj instanceof DERApplicationSpecific)
        {
            setPrivateData((DERApplicationSpecific)obj);
        }
        else
        {
            throw new IOException("Invalid Input Stream for creating an Iso7816CertificateStructure");
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:CVCertificate.java

示例11: getInstance

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
/**
 * Create an iso7816Certificate structure from an object.
 *
 * @param obj the Object to extract the certificate from.
 * @return the Iso7816CertificateStructure represented by the byte stream.
 * @throws IOException if there is a problem parsing the data.
 */
public static CVCertificate getInstance(Object obj)
{
    if (obj instanceof CVCertificate)
    {
        return (CVCertificate)obj;
    }
    else if (obj != null)
    {
        try
        {
            return new CVCertificate(DERApplicationSpecific.getInstance(obj));
        }
        catch (IOException e)
        {
            throw new ASN1ParsingException("unable to parse data: " + e.getMessage(), e);
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:CVCertificate.java

示例12: toASN1Primitive

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
/**
 * @see org.bouncycastle.asn1.ASN1Object#toASN1Primitive()
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (valid != (signValid | bodyValid))
    {
        return null;
    }
    v.add(certificateBody);

    try
    {
        v.add(new DERApplicationSpecific(false, EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP, new DEROctetString(signature)));
    }
    catch (IOException e)
    {
        throw new IllegalStateException("unable to convert signature!");
    }

    return new DERApplicationSpecific(EACTags.CARDHOLDER_CERTIFICATE, v);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:CVCertificate.java

示例13: setPrivateData

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
private void setPrivateData(ASN1InputStream cha)
    throws IOException
{
    ASN1Primitive obj;
    obj = cha.readObject();
    if (obj instanceof ASN1ObjectIdentifier)
    {
        this.oid = (ASN1ObjectIdentifier)obj;
    }
    else
    {
        throw new IllegalArgumentException("no Oid in CerticateHolderAuthorization");
    }
    obj = cha.readObject();
    if (obj instanceof DERApplicationSpecific)
    {
        this.accessRights = (DERApplicationSpecific)obj;
    }
    else
    {
        throw new IllegalArgumentException("No access rights in CerticateHolderAuthorization");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CertificateHolderAuthorization.java

示例14: getInstance

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
/**
 * Create an iso7816Certificate structure from an object.
 *
 * @param obj the Object to extract the certificate from.
 * @return the Iso7816CertificateStructure represented by the byte stream.
 */
public static CVCertificate getInstance(Object obj)
{
    if (obj instanceof CVCertificate)
    {
        return (CVCertificate)obj;
    }
    else if (obj != null)
    {
        try
        {
            return new CVCertificate(DERApplicationSpecific.getInstance(obj));
        }
        catch (IOException e)
        {
            throw new ASN1ParsingException("unable to parse data: " + e.getMessage(), e);
        }
    }

    return null;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:27,代码来源:CVCertificate.java

示例15: toASN1Primitive

import org.bouncycastle.asn1.DERApplicationSpecific; //导入依赖的package包/类
/**
 * @see org.bouncycastle.asn1.ASN1Object#toASN1Primitive()
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(certificateBody);

    try
    {
        v.add(new DERApplicationSpecific(false, EACTags.STATIC_INTERNAL_AUTHENTIFICATION_ONE_STEP, new DEROctetString(signature)));
    }
    catch (IOException e)
    {
        throw new IllegalStateException("unable to convert signature!");
    }

    return new DERApplicationSpecific(EACTags.CARDHOLDER_CERTIFICATE, v);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:21,代码来源:CVCertificate.java


注:本文中的org.bouncycastle.asn1.DERApplicationSpecific类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。