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


Java ASN1ObjectIdentifier类代码示例

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


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

示例1: getByName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
public static X9ECParameters getByName(
    String  name)
{
    ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)objIds.get(Strings.toUpperCase(name));

    if (oid != null)
    {
        return getByOID(oid);
    }

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

示例2: calculatePbeMac

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
private static byte[] calculatePbeMac(
    ASN1ObjectIdentifier oid,
    byte[] salt,
    int itCount,
    char[] password,
    boolean wrongPkcs12Zero,
    byte[] data)
    throws Exception
{
    SecretKeyFactory keyFact = SecretKeyFactory.getInstance(oid.getId(), bcProvider);
    PBEParameterSpec defParams = new PBEParameterSpec(salt, itCount);
    PBEKeySpec pbeSpec = new PBEKeySpec(password);
    BCPBEKey key = (BCPBEKey)keyFact.generateSecret(pbeSpec);
    key.setTryWrongPKCS12Zero(wrongPkcs12Zero);

    Mac mac = Mac.getInstance(oid.getId(), bcProvider);
    mac.init(key, defParams);
    mac.update(data);
    return mac.doFinal();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:PKCS12KeyStoreSpi.java

示例3: getExtensionOIDs

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
private ASN1ObjectIdentifier[] getExtensionOIDs(boolean isCritical)
{
    Vector oidVec = new Vector();

    for (int i = 0; i != ordering.size(); i++)
    {
        Object oid = ordering.elementAt(i);

        if (((X509Extension)extensions.get(oid)).isCritical() == isCritical)
        {
            oidVec.addElement(oid);
        }
    }

    return toOidArray(oidVec);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:X509Extensions.java

示例4: PolicyMappings

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
/**
 * Creates a new <code>PolicyMappings</code> instance.
 *
 * @param mappings a <code>HashMap</code> value that maps
 *                 <code>String</code> oids
 *                 to other <code>String</code> oids.
 * @deprecated use CertPolicyId constructors.
 */
public PolicyMappings(Hashtable mappings)
{
    ASN1EncodableVector dev = new ASN1EncodableVector();
    Enumeration it = mappings.keys();

    while (it.hasMoreElements())
    {
        String idp = (String)it.nextElement();
        String sdp = (String)mappings.get(idp);
        ASN1EncodableVector dv = new ASN1EncodableVector();
        dv.add(new ASN1ObjectIdentifier(idp));
        dv.add(new ASN1ObjectIdentifier(sdp));
        dev.add(new DERSequence(dv));
    }

    seq = new DERSequence(dev);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:PolicyMappings.java

示例5: getNamedCurveByOid

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = X962NamedCurves.getByOID(oid);
    
    if (params == null)
    {
        params = SECNamedCurves.getByOID(oid);
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

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

示例6: generatePublic

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo)
    throws IOException
{
    ASN1ObjectIdentifier algOid = keyInfo.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCDHPublicKey(keyInfo);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCDHPublicKey(keyInfo);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:KeyFactorySpi.java

示例7: createAlgorithmParameterGenerator

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
AlgorithmParameterGenerator createAlgorithmParameterGenerator(ASN1ObjectIdentifier algorithm)
    throws GeneralSecurityException
{
    String algorithmName = (String)BASE_CIPHER_NAMES.get(algorithm);

    if (algorithmName != null)
    {
        try
        {
            // this is reversed as the Sun policy files now allow unlimited strength RSA
            return helper.createAlgorithmParameterGenerator(algorithmName);
        }
        catch (NoSuchAlgorithmException e)
        {
            // Ignore
        }
    }
    return helper.createAlgorithmParameterGenerator(algorithm.getId());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:EnvelopedDataHelper.java

示例8: readDERCertificate

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
private java.security.cert.Certificate readDERCertificate(
    ASN1InputStream dIn)
    throws IOException, CertificateParsingException
{
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

    if (seq.size() > 1
            && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
    {
        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
        {
            sData = SignedData.getInstance(ASN1Sequence.getInstance(
                (ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();

            return getCertificate();
        }
    }

    return new X509CertificateObject(
                        Certificate.getInstance(seq));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:CertificateFactory.java

示例9: setPrivateData

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的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

示例10: add

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
/**
 * Return a new table with the passed in attribute added.
 *
 * @param attrType
 * @param attrValue
 * @return
 */
public AttributeTable add(ASN1ObjectIdentifier attrType, ASN1Encodable attrValue)
{
    AttributeTable newTable = new AttributeTable(attributes);

    newTable.addAttribute(attrType, new Attribute(attrType, new DERSet(attrValue)));

    return newTable;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:AttributeTable.java

示例11: getExtensionValue

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
public byte[] getExtensionValue(String oid)
{
    Extension ext = getExtension(new ASN1ObjectIdentifier(oid));

    if (ext != null)
    {
        try
        {
            return ext.getExtnValue().getEncoded();
        }
        catch (Exception e)
        {
            throw new RuntimeException("error encoding " + e.toString());
        }
    }

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

示例12: createCipherParameters

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
static CipherParameters createCipherParameters(ASN1ObjectIdentifier algorithm, ExtendedDigest digest, int blockSize, PKCS12PBEParams pbeParams, char[] password)
{
    PKCS12ParametersGenerator pGen = new PKCS12ParametersGenerator(digest);

    pGen.init(PKCS12ParametersGenerator.PKCS12PasswordToBytes(password), pbeParams.getIV(), pbeParams.getIterations().intValue());

    CipherParameters params;

    if (PKCS12PBEUtils.hasNoIv(algorithm))
    {
        params = pGen.generateDerivedParameters(PKCS12PBEUtils.getKeySize(algorithm));
    }
    else
    {
        params = pGen.generateDerivedParameters(PKCS12PBEUtils.getKeySize(algorithm), blockSize * 8);

        if (PKCS12PBEUtils.isDesAlg(algorithm))
        {
            DESedeParameters.setOddParity(((KeyParameter)((ParametersWithIV)params).getParameters()).getKey());
        }
    }
    return params;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:PKCS12PBEUtils.java

示例13: addKeyAgreementRecipients

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
/**
 * Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure).
 *
 * @deprecated use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
 * @param agreementAlgorithm key agreement algorithm to use.
 * @param senderPrivateKey private key to initialise sender side of agreement with.
 * @param senderPublicKey sender public key to include with message.
 * @param recipientCerts recipients' public key certificates.
 * @param cekWrapAlgorithm OID for key wrapping algorithm to use.
 * @param provider provider to use for the agreement calculation.
 * @exception NoSuchAlgorithmException if the algorithm requested cannot be found
 * @exception InvalidKeyException if the keys are inappropriate for the algorithm specified
 */
public void addKeyAgreementRecipients(
    String           agreementAlgorithm,
    PrivateKey       senderPrivateKey,
    PublicKey        senderPublicKey,
    Collection       recipientCerts,
    String           cekWrapAlgorithm,
    Provider         provider)
    throws NoSuchAlgorithmException, InvalidKeyException
{
    JceKeyAgreeRecipientInfoGenerator recipientInfoGenerator = new JceKeyAgreeRecipientInfoGenerator(new ASN1ObjectIdentifier(agreementAlgorithm), senderPrivateKey, senderPublicKey, new ASN1ObjectIdentifier(cekWrapAlgorithm)).setProvider(provider);

    for (Iterator it = recipientCerts.iterator(); it.hasNext();)
    {
        try
        {
            recipientInfoGenerator.addRecipient((X509Certificate)it.next());
        }
        catch (CertificateEncodingException e)
        {
            throw new IllegalArgumentException("unable to encode certificate: " + e.getMessage());
        }
    }

    oldRecipientInfoGenerators.add(recipientInfoGenerator);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:39,代码来源:CMSEnvelopedGenerator.java

示例14: getASN1EncodableVector

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的package包/类
public ASN1EncodableVector getASN1EncodableVector(ASN1ObjectIdentifier oid, boolean publicPointOnly)
{
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(oid);

    if (!publicPointOnly)
    {
        v.add(new UnsignedInteger(0x01, getPrimeModulusP()));
        v.add(new UnsignedInteger(0x02, getFirstCoefA()));
        v.add(new UnsignedInteger(0x03, getSecondCoefB()));
        v.add(new DERTaggedObject(false, 0x04, new DEROctetString(getBasePointG())));
        v.add(new UnsignedInteger(0x05, getOrderOfBasePointR()));
    }
    v.add(new DERTaggedObject(false, 0x06, new DEROctetString(getPublicPointY())));
    if (!publicPointOnly)
    {
        v.add(new UnsignedInteger(0x07, getCofactorF()));
    }

    return v;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:ECDSAPublicKey.java

示例15: getAlgorithmIdentifier

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入依赖的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


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