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


Java ASN1ObjectIdentifier.getId方法代码示例

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


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

示例1: extractDigesetAlgFromSigAlg

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static AlgorithmIdentifier extractDigesetAlgFromSigAlg( AlgorithmIdentifier sigAlgId)
        throws NoSuchAlgorithmException {
    ASN1ObjectIdentifier algOid = sigAlgId.getAlgorithm();

    ASN1ObjectIdentifier digestAlgOid;
    if (PKCSObjectIdentifiers.id_RSASSA_PSS.equals(algOid)) {
        ASN1Encodable asn1Encodable = sigAlgId.getParameters();
        RSASSAPSSparams param = RSASSAPSSparams.getInstance(asn1Encodable);
        digestAlgOid = param.getHashAlgorithm().getAlgorithm();
    } else {
        HashAlgoType digestAlg = sigAlgOidToDigestMap.get(algOid);
        if (digestAlg == null) {
            throw new NoSuchAlgorithmException("unknown signature algorithm " + algOid.getId());
        }
        digestAlgOid = digestAlg.oid();
    }

    return new AlgorithmIdentifier(digestAlgOid, DERNull.INSTANCE);
}
 
开发者ID:xipki,项目名称:xitk,代码行数:20,代码来源:AlgorithmUtil.java

示例2: getSignatureAlgoName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static String getSignatureAlgoName(AlgorithmIdentifier sigAlgId)
        throws NoSuchAlgorithmException {
    ParamUtil.requireNonNull("sigAlgId", sigAlgId);

    ASN1ObjectIdentifier algOid = sigAlgId.getAlgorithm();
    String name = null;
    if (PKCSObjectIdentifiers.id_RSASSA_PSS.equals(algOid)) {
        RSASSAPSSparams param = RSASSAPSSparams.getInstance(sigAlgId.getParameters());
        ASN1ObjectIdentifier digestAlgOid = param.getHashAlgorithm().getAlgorithm();
        name = digestOidToMgf1SigNameMap.get(digestAlgOid);
        if (name == null) {
            throw new NoSuchAlgorithmException("unsupported digest algorithm " + digestAlgOid);
        }
    } else {
        name = sigAlgOidToNameMap.get(algOid);
    }

    if (name == null) {
        throw new NoSuchAlgorithmException("unsupported signature algorithm " + algOid.getId());
    }
    return name;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:23,代码来源:AlgorithmUtil.java

示例3: getKeyAlgorithmName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
String getKeyAlgorithmName(ASN1ObjectIdentifier oid)
{

    String name = (String)symmetricKeyAlgNames.get(oid);

    if (name != null)
    {
        return name;
    }

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

示例4: GOST3410ParameterSpec

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public GOST3410ParameterSpec(
    String  keyParamSetID,
    String  digestParamSetOID,
    String  encryptionParamSetOID)
{
    GOST3410ParamSetParameters  ecP = null;
    
    try
    {
        ecP = GOST3410NamedParameters.getByOID(new ASN1ObjectIdentifier(keyParamSetID));
    }
    catch (IllegalArgumentException e)
    {
        ASN1ObjectIdentifier oid = GOST3410NamedParameters.getOID(keyParamSetID);
        if (oid != null)
        {
            keyParamSetID = oid.getId();
            ecP = GOST3410NamedParameters.getByOID(oid);
        }
    }
    
    if (ecP == null)
    {
        throw new IllegalArgumentException("no key parameter set for passed in name/OID.");
    }

    this.keyParameters = new GOST3410PublicKeyParameterSetSpec(
                                    ecP.getP(),
                                    ecP.getQ(),
                                    ecP.getA());
    
    this.keyParamSetOID = keyParamSetID;
    this.digestParamSetOID = digestParamSetOID;
    this.encryptionParamSetOID = encryptionParamSetOID;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:36,代码来源:GOST3410ParameterSpec.java

示例5: 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

示例6: getByOID

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
 * All named curves have the following oid format: 1.2.804.2.1.1.1.1.3.1.1.2.X
 * where X is the curve number 0-9
 */
public static ECDomainParameters getByOID(ASN1ObjectIdentifier oid)
{
    String oidStr = oid.getId();
    if (oidStr.startsWith(oidBase))
    {
        int index = Integer.parseInt(oidStr.substring(oidStr.length() - 1));
        return params[index];
    }
    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:15,代码来源:DSTU4145NamedCurves.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: P11MacContentSigner

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
P11MacContentSigner(P11CryptService cryptService, P11EntityIdentifier identityId,
        AlgorithmIdentifier macAlgId) throws XiSecurityException, P11TokenException {
    this.identityId = ParamUtil.requireNonNull("identityId", identityId);
    this.cryptService = ParamUtil.requireNonNull("cryptService", cryptService);
    this.algorithmIdentifier = ParamUtil.requireNonNull("macAlgId", macAlgId);
    try {
        this.encodedAlgorithmIdentifier = algorithmIdentifier.getEncoded();
    } catch (IOException ex) {
        throw new XiSecurityException("could not encode AlgorithmIdentifier", ex);
    }

    ASN1ObjectIdentifier oid = macAlgId.getAlgorithm();
    if (PKCSObjectIdentifiers.id_hmacWithSHA1.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA_1_HMAC;
    } else if (PKCSObjectIdentifiers.id_hmacWithSHA224.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA224_HMAC;
    } else if (PKCSObjectIdentifiers.id_hmacWithSHA256.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA256_HMAC;
    } else if (PKCSObjectIdentifiers.id_hmacWithSHA384.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA384_HMAC;
    } else if (PKCSObjectIdentifiers.id_hmacWithSHA512.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA512_HMAC;
    } else if (NISTObjectIdentifiers.id_hmacWithSHA3_224.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA3_224_HMAC;
    } else if (NISTObjectIdentifiers.id_hmacWithSHA3_256.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA3_256_HMAC;
    } else if (NISTObjectIdentifiers.id_hmacWithSHA3_384.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA3_384_HMAC;
    } else if (NISTObjectIdentifiers.id_hmacWithSHA3_512.equals(oid)) {
        mechanism = PKCS11Constants.CKM_SHA3_512_HMAC;
    } else {
        throw new IllegalArgumentException("unknown algorithm identifier " + oid.getId());
    }

    this.outputStream = new ByteArrayOutputStream();
}
 
开发者ID:xipki,项目名称:xitk,代码行数:37,代码来源:P11MacContentSigner.java

示例10: getDigestAlgName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
 * Return the digest algorithm using one of the standard JCA string
 * representations rather than the algorithm identifier (if possible).
 */
private String getDigestAlgName(
    ASN1ObjectIdentifier digestAlgOID)
{
    String algName = (String)digestAlgs.get(digestAlgOID);

    if (algName != null)
    {
        return algName;
    }

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

示例11: getEncryptionAlgName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
 * Return the digest encryption algorithm using one of the standard
 * JCA string representations rather the the algorithm identifier (if
 * possible).
 */
private String getEncryptionAlgName(
    ASN1ObjectIdentifier encryptionAlgOID)
{
    String algName = (String)encryptionAlgs.get(encryptionAlgOID);

    if (algName != null)
    {
        return algName;
    }

    return encryptionAlgOID.getId();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:DefaultCMSSignatureAlgorithmNameGenerator.java

示例12: getBaseCipherName

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
String getBaseCipherName(ASN1ObjectIdentifier algorithm)
{
    String name = (String)BASE_CIPHER_NAMES.get(algorithm);

    if (name == null)
    {
        return algorithm.getId();
    }

    return name;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:EnvelopedDataHelper.java

示例13: TimeStampTokenGenerator

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
/**
 * basic creation - only the default attributes will be included here.
 * @deprecated use SignerInfoGenerator constructor that takes a digest calculator.
 */
public TimeStampTokenGenerator(
    PrivateKey      key,
    X509Certificate cert,
    ASN1ObjectIdentifier          digestOID,
    String          tsaPolicyOID)
    throws IllegalArgumentException, TSPException
{
    this(key, cert, digestOID.getId(), tsaPolicyOID, null, null);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:TimeStampTokenGenerator.java

示例14: getCoreExtValue

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static byte[] getCoreExtValue(X509Certificate cert, ASN1ObjectIdentifier type)
        throws CertificateEncodingException {
    ParamUtil.requireNonNull("cert", cert);
    ParamUtil.requireNonNull("type", type);
    byte[] fullExtValue = cert.getExtensionValue(type.getId());
    if (fullExtValue == null) {
        return null;
    }
    try {
        return ASN1OctetString.getInstance(fullExtValue).getOctets();
    } catch (IllegalArgumentException ex) {
        throw new CertificateEncodingException("invalid extension " + type.getId() + ": "
                + ex.getMessage());
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:16,代码来源:X509Util.java

示例15: getHashOutputSizeInOctets

import org.bouncycastle.asn1.ASN1ObjectIdentifier; //导入方法依赖的package包/类
public static int getHashOutputSizeInOctets(ASN1ObjectIdentifier hashAlgo)
        throws NoSuchAlgorithmException {
    ParamUtil.requireNonNull("hashAlgo", hashAlgo);
    HashAlgoType hashAlgoType = HashAlgoType.getHashAlgoType(hashAlgo);
    if (hashAlgoType == null) {
        throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgo.getId());
    }
    return hashAlgoType.length();
}
 
开发者ID:xipki,项目名称:xitk,代码行数:10,代码来源:AlgorithmUtil.java


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