當前位置: 首頁>>代碼示例>>Java>>正文


Java ASN1ObjectIdentifier.equals方法代碼示例

本文整理匯總了Java中org.bouncycastle.asn1.ASN1ObjectIdentifier.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ASN1ObjectIdentifier.equals方法的具體用法?Java ASN1ObjectIdentifier.equals怎麽用?Java ASN1ObjectIdentifier.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bouncycastle.asn1.ASN1ObjectIdentifier的用法示例。


在下文中一共展示了ASN1ObjectIdentifier.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generatePublic

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PublicKey generatePublic(SubjectPublicKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPublicKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPublicKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:23,代碼來源:KeyFactorySpi.java

示例2: generatePrivate

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PrivateKey generatePrivate(PrivateKeyInfo info)
    throws IOException
{
    ASN1ObjectIdentifier algOid = info.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(PKCSObjectIdentifiers.dhKeyAgreement))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(X9ObjectIdentifiers.dhpublicnumber))
    {
        return new BCElGamalPrivateKey(info);
    }
    else if (algOid.equals(OIWObjectIdentifiers.elGamalAlgorithm))
    {
        return new BCElGamalPrivateKey(info);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:23,代碼來源:KeyFactorySpi.java

示例3: generateParameterSpec

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
protected AlgorithmParameterSpec generateParameterSpec(ASN1ObjectIdentifier macOID, SecretKey encKey)
    throws CMSException
{
    try
    {
        if (macOID.equals(PKCSObjectIdentifiers.RC2_CBC))
        {
            byte[] iv = new byte[8];

            random.nextBytes(iv);

            return new RC2ParameterSpec(encKey.getEncoded().length * 8, iv);
        }

        AlgorithmParameterGenerator pGen = helper.createAlgorithmParameterGenerator(macOID);

        AlgorithmParameters p = pGen.generateParameters();

        return p.getParameterSpec(IvParameterSpec.class);
    }
    catch (GeneralSecurityException e)
    {
        return null;
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:26,代碼來源:JceCMSMacCalculatorBuilder.java

示例4: getConvertedValue

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
/**
 * Apply default coversion for the given value depending on the oid
 * and the character range of the value.
 * 
 * @param oid the object identifier for the DN entry
 * @param value the value associated with it
 * @return the ASN.1 equivalent for the string value.
 */
public ASN1Primitive getConvertedValue(
    ASN1ObjectIdentifier  oid,
    String               value)
{
    if (value.length() != 0 && value.charAt(0) == '#')
    {
        try
        {
            return convertHexEncoded(value, 1);
        }
        catch (IOException e)
        {
            throw new RuntimeException("can't recode value for oid " + oid.getId());
        }
    }
    else
    {
        if (value.length() != 0 && value.charAt(0) == '\\')
        {
            value = value.substring(1);
        }
        if (oid.equals(X509Name.EmailAddress) || oid.equals(X509Name.DC))
        {
            return new DERIA5String(value);
        }
        else if (oid.equals(X509Name.DATE_OF_BIRTH))  // accept time string as well as # (for compatibility)
        {
            return new DERGeneralizedTime(value);
        }
        else if (oid.equals(X509Name.C) || oid.equals(X509Name.SN) || oid.equals(X509Name.DN_QUALIFIER)
            || oid.equals(X509Name.TELEPHONE_NUMBER))
        {
             return new DERPrintableString(value);
        }
    }
    
    return new DERUTF8String(value);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:47,代碼來源:X509DefaultEntryConverter.java

示例5: findAttrNamesForOID

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public static String[] findAttrNamesForOID(
    ASN1ObjectIdentifier oid,
    Hashtable            lookup)
{
    int count = 0;
    for (Enumeration en = lookup.elements(); en.hasMoreElements();)
    {
        if (oid.equals(en.nextElement()))
        {
            count++;
        }
    }

    String[] aliases = new String[count];
    count = 0;

    for (Enumeration en = lookup.keys(); en.hasMoreElements();)
    {
        String key = (String)en.nextElement();
        if (oid.equals(lookup.get(key)))
        {
            aliases[count++] = key;
        }
    }

    return aliases;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:28,代碼來源:IETFUtils.java

示例6: atvAreEqual

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
private static boolean atvAreEqual(AttributeTypeAndValue atv1, AttributeTypeAndValue atv2)
{
    if (atv1 == atv2)
    {
        return true;
    }

    if (atv1 == null)
    {
        return false;
    }

    if (atv2 == null)
    {
        return false;
    }

    ASN1ObjectIdentifier o1 = atv1.getType();
    ASN1ObjectIdentifier o2 = atv2.getType();

    if (!o1.equals(o2))
    {
        return false;
    }

    String v1 = IETFUtils.canonicalize(IETFUtils.valueToString(atv1.getValue()));
    String v2 = IETFUtils.canonicalize(IETFUtils.valueToString(atv2.getValue()));

    if (!v1.equals(v2))
    {
        return false;
    }

    return true;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:36,代碼來源:IETFUtils.java

示例7: stringToValue

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public ASN1Encodable stringToValue(ASN1ObjectIdentifier oid, String value)
{
    if (value.length() != 0 && value.charAt(0) == '#')
    {
        try
        {
            return IETFUtils.valueFromHexString(value, 1);
        }
        catch (IOException e)
        {
            throw new RuntimeException("can't recode value for oid " + oid.getId());
        }
    }
    else
    {
        if (value.length() != 0 && value.charAt(0) == '\\')
        {
            value = value.substring(1);
        }
        if (oid.equals(dc))
        {
            return new DERIA5String(value);
        }
        else if (oid.equals(c) || oid.equals(serialNumber) || oid.equals(dnQualifier)
            || oid.equals(telephoneNumber))
        {
            return new DERPrintableString(value);
        }
    }

    return new DERUTF8String(value);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:33,代碼來源:RFC4519Style.java

示例8: stringToValue

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public ASN1Encodable stringToValue(ASN1ObjectIdentifier oid, String value)
{
    if (value.length() != 0 && value.charAt(0) == '#')
    {
        try
        {
            return IETFUtils.valueFromHexString(value, 1);
        }
        catch (IOException e)
        {
            throw new RuntimeException("can't recode value for oid " + oid.getId());
        }
    }
    else
    {
        if (value.length() != 0 && value.charAt(0) == '\\')
        {
            value = value.substring(1);
        }
        if (oid.equals(EmailAddress) || oid.equals(DC))
        {
            return new DERIA5String(value);
        }
        else if (oid.equals(DATE_OF_BIRTH))  // accept time string as well as # (for compatibility)
        {
            return new ASN1GeneralizedTime(value);
        }
        else if (oid.equals(C) || oid.equals(SN) || oid.equals(DN_QUALIFIER)
            || oid.equals(TELEPHONE_NUMBER))
        {
            return new DERPrintableString(value);
        }
    }

    return new DERUTF8String(value);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:37,代碼來源:BCStyle.java

示例9: getOtherRevocationInfo

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
Store getOtherRevocationInfo(ASN1ObjectIdentifier otherRevocationInfoFormat, ASN1Set crlSet)
{
    if (crlSet != null)
    {
        List    crlList = new ArrayList(crlSet.size());

        for (Enumeration en = crlSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1TaggedObject)
            {
                ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(obj);

                if (tObj.getTagNo() == 1)
                {
                    OtherRevocationInfoFormat other = OtherRevocationInfoFormat.getInstance(tObj, false);

                    if (otherRevocationInfoFormat.equals(other.getInfoFormat()))
                    {
                        crlList.add(other.getInfo());
                    }
                }
            }
        }

        return new CollectionStore(crlList);
    }

    return new CollectionStore(new ArrayList());
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:32,代碼來源:CMSSignedHelper.java

示例10: generatePublic

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo)
    throws IOException
{
    ASN1ObjectIdentifier algOid = keyInfo.getAlgorithm().getAlgorithm();

    if (algOid.equals(UAObjectIdentifiers.dstu4145le) || algOid.equals(UAObjectIdentifiers.dstu4145be))
    {
        return new BCDSTU4145PublicKey(keyInfo);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:15,代碼來源:KeyFactorySpi.java

示例11: generatePrivate

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo)
    throws IOException
{
    ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94))
    {
        return new BCGOST3410PrivateKey(keyInfo);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:15,代碼來源:KeyFactorySpi.java

示例12: generatePublic

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo)
    throws IOException
{
    ASN1ObjectIdentifier algOid = keyInfo.getAlgorithm().getAlgorithm();

    if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94))
    {
        return new BCGOST3410PublicKey(keyInfo);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:15,代碼來源:KeyFactorySpi.java

示例13: isDsaOid

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public static boolean isDsaOid(
    ASN1ObjectIdentifier algOid)
{
    for (int i = 0; i != dsaOids.length; i++)
    {
        if (algOid.equals(dsaOids[i]))
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:14,代碼來源:DSAUtil.java

示例14: isRsaOid

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public static boolean isRsaOid(
    ASN1ObjectIdentifier algOid)
{
    for (int i = 0; i != rsaOids.length; i++)
    {
        if (algOid.equals(rsaOids[i]))
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:14,代碼來源:RSAUtil.java

示例15: generatePrivate

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //導入方法依賴的package包/類
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo)
    throws IOException
{
    ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm();

    if (algOid.equals(X9ObjectIdentifiers.id_ecPublicKey))
    {
        return new BCECPrivateKey(algorithm, keyInfo, configuration);
    }
    else
    {
        throw new IOException("algorithm identifier " + algOid + " in key not recognised");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:15,代碼來源:KeyFactorySpi.java


注:本文中的org.bouncycastle.asn1.ASN1ObjectIdentifier.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。