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


Java DERNull类代码示例

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


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

示例1: getSigAlgID

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
static AlgorithmIdentifier getSigAlgID(
    DERObjectIdentifier sigOid,
    String              algorithmName)
{
    if (noParams.contains(sigOid))
    {
        return new AlgorithmIdentifier(sigOid);
    }

    algorithmName = Strings.toUpperCase(algorithmName);

    if (params.containsKey(algorithmName))
    {
        return new AlgorithmIdentifier(sigOid, (ASN1Encodable)params.get(algorithmName));
    }
    else
    {
        return new AlgorithmIdentifier(sigOid, DERNull.INSTANCE);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:X509Util.java

示例2: getAlgorithmIdentifier

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
AlgorithmIdentifier getAlgorithmIdentifier(ASN1ObjectIdentifier encryptionOID, AlgorithmParameters params)
    throws CRMFException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        try
        {
            asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
        }
        catch (IOException e)
        {
            throw new CRMFException("cannot encode parameters: " + e.getMessage(), e);
        }
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        encryptionOID,
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:CRMFHelper.java

示例3: getSignatureName

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
private static String getSignatureName(
    AlgorithmIdentifier sigAlgId)
{
    ASN1Encodable params = sigAlgId.getParameters();

    if (params != null && !DERNull.INSTANCE.equals(params))
    {
        if (sigAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
        {
            RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params);
            return getDigestAlgName(rsaParams.getHashAlgorithm().getAlgorithm()) + "WITHRSAANDMGF1";
        }
    }

    if (oids.containsKey(sigAlgId.getAlgorithm()))
    {
        return (String)oids.get(sigAlgId.getAlgorithm());
    }

    return sigAlgId.getAlgorithm().getId();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:OperatorHelper.java

示例4: getSignatureName

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
static String getSignatureName(
    AlgorithmIdentifier sigAlgId)
{
    ASN1Encodable params = sigAlgId.getParameters();

    if (params != null && !DERNull.INSTANCE.equals(params))
    {
        if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
        {
            RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params);
            return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1";
        }
    }

    return sigAlgId.getObjectId().getId();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:PKCS10CertificationRequest.java

示例5: getEncoded

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
/**
 * Return the keyData to encode in the SubjectPublicKeyInfo structure.
 * <p/>
 * The ASN.1 definition of the key structure is
 * <p/>
 * <pre>
 *       McEliecePublicKey ::= SEQUENCE {
 *         n           Integer      -- length of the code
 *         t           Integer      -- error correcting capability
 *         matrixG     OctetString  -- generator matrix as octet string
 *       }
 * </pre>
 *
 * @return the keyData to encode in the SubjectPublicKeyInfo structure
 */
public byte[] getEncoded()
{
    McElieceCCA2PublicKey key = new McElieceCCA2PublicKey(new ASN1ObjectIdentifier(oid), n, t, g);
    AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(this.getOID(), DERNull.INSTANCE);

    try
    {
        SubjectPublicKeyInfo subjectPublicKeyInfo = new SubjectPublicKeyInfo(algorithmIdentifier, key);

        return subjectPublicKeyInfo.getEncoded();
    }
    catch (IOException e)
    {
        return null;
    }

}
 
开发者ID:Appdome,项目名称:ipack,代码行数:33,代码来源:BCMcElieceCCA2PublicKey.java

示例6: getEncoded

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
/**
 * Return the keyData to encode in the SubjectPublicKeyInfo structure.
 * <p/>
 * The ASN.1 definition of the key structure is
 * <p/>
 * <pre>
 *       McEliecePublicKey ::= SEQUENCE {
 *         n           Integer      -- length of the code
 *         t           Integer      -- error correcting capability
 *         matrixG     OctetString  -- generator matrix as octet string
 *       }
 * </pre>
 *
 * @return the keyData to encode in the SubjectPublicKeyInfo structure
 */
public byte[] getEncoded()
{
    McEliecePublicKey key = new McEliecePublicKey(new ASN1ObjectIdentifier(oid), n, t, g);
    AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(this.getOID(), DERNull.INSTANCE);

    try
    {
        SubjectPublicKeyInfo subjectPublicKeyInfo = new SubjectPublicKeyInfo(algorithmIdentifier, key);

        return subjectPublicKeyInfo.getEncoded();
    }
    catch (IOException e)
    {
        return null;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:32,代码来源:BCMcEliecePublicKey.java

示例7: get

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
public PKCS12MacCalculatorBuilder get(final AlgorithmIdentifier algorithmIdentifier)
{
    return new PKCS12MacCalculatorBuilder()
    {
        public MacCalculator build(final char[] password)
            throws OperatorCreationException
        {
            PKCS12PBEParams pbeParams = PKCS12PBEParams.getInstance(algorithmIdentifier.getParameters());

            return PKCS12PBEUtils.createMacCalculator(algorithmIdentifier.getAlgorithm(), digestProvider.get(algorithmIdentifier), pbeParams, password);
        }

        public AlgorithmIdentifier getDigestAlgorithmIdentifier()
        {
            return new AlgorithmIdentifier(algorithmIdentifier.getAlgorithm(), DERNull.INSTANCE);
        }
    };
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:BcPKCS12MacCalculatorBuilderProvider.java

示例8: generateBytes

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
public int generateBytes(byte[] out, int outOff, int len)
    throws DataLengthException, IllegalArgumentException
{
    // TODO Create an ASN.1 class for this (RFC3278)
    // ECC-CMS-SharedInfo
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(new AlgorithmIdentifier(algorithm, DERNull.INSTANCE));
    v.add(new DERTaggedObject(true, 2, new DEROctetString(Pack.intToBigEndian(keySize))));

    try
    {
        kdf.init(new KDFParameters(z, new DERSequence(v).getEncoded(ASN1Encoding.DER)));
    }
    catch (IOException e)
    {
        throw new IllegalArgumentException("unable to initialise kdf: " + e.getMessage());
    }

    return kdf.generateBytes(out, outOff, len);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:ECDHKEKGenerator.java

示例9: toASN1Primitive

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 *      AlgorithmIdentifier ::= SEQUENCE {
 *                            algorithm OBJECT IDENTIFIER,
 *                            parameters ANY DEFINED BY algorithm OPTIONAL }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector  v = new ASN1EncodableVector();

    v.add(objectId);

    if (parametersDefined)
    {
        if (parameters != null)
        {
            v.add(parameters);
        }
        else
        {
            v.add(DERNull.INSTANCE);
        }
    }

    return new DERSequence(v);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:AlgorithmIdentifier.java

示例10: ProofOfPossession

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
private ProofOfPossession(ASN1TaggedObject tagged)
{
    tagNo = tagged.getTagNo();
    switch (tagNo)
    {
    case 0:
        obj = DERNull.INSTANCE;
        break;
    case 1:
        obj = POPOSigningKey.getInstance(tagged, false);
        break;
    case 2:
    case 3:
        obj = POPOPrivKey.getInstance(tagged, true);
        break;
    default:
        throw new IllegalArgumentException("unknown tag: " + tagNo);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:ProofOfPossession.java

示例11: CertStatus

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
public CertStatus(
    ASN1TaggedObject    choice)
{
    this.tagNo = choice.getTagNo();

    switch (choice.getTagNo())
    {
    case 0:
        value = DERNull.INSTANCE;
        break;
    case 1:
        value = RevokedInfo.getInstance(choice, false);
        break;
    case 2:
        value = DERNull.INSTANCE;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:CertStatus.java

示例12: engineGetEncoded

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
/**
 * Return the PKCS#1 ASN.1 structure RSAES-OAEP-params.
 */
protected byte[] engineGetEncoded() 
{
    AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(
                                                    DigestFactory.getOID(currentSpec.getDigestAlgorithm()),
                                                    DERNull.INSTANCE);
    MGF1ParameterSpec mgfSpec = (MGF1ParameterSpec)currentSpec.getMGFParameters();
    AlgorithmIdentifier maskGenAlgorithm = new AlgorithmIdentifier(
                                                    PKCSObjectIdentifiers.id_mgf1,
                                                    new AlgorithmIdentifier(DigestFactory.getOID(mgfSpec.getDigestAlgorithm()), DERNull.INSTANCE));
    PSource.PSpecified      pSource = (PSource.PSpecified)currentSpec.getPSource();
    AlgorithmIdentifier pSourceAlgorithm = new AlgorithmIdentifier(
                                                    PKCSObjectIdentifiers.id_pSpecified, new DEROctetString(pSource.getValue()));
    RSAESOAEPparams oaepP = new RSAESOAEPparams(hashAlgorithm, maskGenAlgorithm, pSourceAlgorithm);
    
    try
    {
        return oaepP.getEncoded(ASN1Encoding.DER);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Error encoding OAEPParameters");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:AlgorithmParametersSpi.java

示例13: getAlgorithmIdentifier

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
protected AlgorithmIdentifier getAlgorithmIdentifier(String encryptionOID, AlgorithmParameters params) throws IOException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        new ASN1ObjectIdentifier(encryptionOID),
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:CMSEnvelopedGenerator.java

示例14: getAlgorithmIdentifier

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
AlgorithmIdentifier getAlgorithmIdentifier(ASN1ObjectIdentifier encryptionOID, AlgorithmParameters params)
    throws CMSException
{
    ASN1Encodable asn1Params;
    if (params != null)
    {
        try
        {
            asn1Params = ASN1Primitive.fromByteArray(params.getEncoded("ASN.1"));
        }
        catch (IOException e)
        {
            throw new CMSException("cannot encode parameters: " + e.getMessage(), e);
        }
    }
    else
    {
        asn1Params = DERNull.INSTANCE;
    }

    return new AlgorithmIdentifier(
        encryptionOID,
        asn1Params);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:EnvelopedDataHelper.java

示例15: getSigAlgId

import org.bouncycastle.asn1.DERNull; //导入依赖的package包/类
public static AlgorithmIdentifier getSigAlgId(String sigAlgName)
        throws NoSuchAlgorithmException {
    ParamUtil.requireNonNull("sigAlgName", sigAlgName);
    String algoS = sigAlgName.toUpperCase();
    algoS = canonicalizeAlgoText(algoS);

    AlgorithmIdentifier signatureAlgId;
    if (algoS.contains("MGF1")) {
        HashAlgoType ha = mgf1SigNameToDigestOidMap.get(algoS);
        if (ha == null) {
            throw new NoSuchAlgorithmException("unknown algorithm " + algoS);
        }

        signatureAlgId = buildRSAPSSAlgId(ha);
    } else {
        ASN1ObjectIdentifier algOid = sigAlgNameToOidMap.get(algoS);
        if (algOid == null) {
            throw new NoSuchAlgorithmException("unknown algorithm " + algoS);
        }
        boolean withNullParam = algoS.contains("RSA");
        signatureAlgId = withNullParam ? new AlgorithmIdentifier(algOid, DERNull.INSTANCE)
                : new AlgorithmIdentifier(algOid);
    }

    return signatureAlgId;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:27,代码来源:AlgorithmUtil.java


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