當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。