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


Java PKCSObjectIdentifiers类代码示例

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


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

示例1: generateUnwrappedKey

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public GenericKey generateUnwrappedKey(AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey)
    throws OperatorException
{
    AsymmetricBlockCipher keyCipher = createAsymmetricUnwrapper(this.getAlgorithmIdentifier().getAlgorithm());

    keyCipher.init(false, privateKey);
    try
    {
        byte[] key = keyCipher.processBlock(encryptedKey, 0, encryptedKey.length);

        if (encryptedKeyAlgorithm.getAlgorithm().equals(PKCSObjectIdentifiers.des_EDE3_CBC))
        {
            return new GenericKey(encryptedKeyAlgorithm, key);
        }
        else
        {
            return new GenericKey(encryptedKeyAlgorithm, key);
        }
    }
    catch (InvalidCipherTextException e)
    {
        throw new OperatorException("unable to recover secret key: " + e.getMessage(), e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:BcAsymmetricKeyUnwrapper.java

示例2: createRawSignature

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public Signature createRawSignature(AlgorithmIdentifier algorithm)
{
    Signature   sig;

    try
    {
        String algName = getSignatureName(algorithm);

        algName = "NONE" + algName.substring(algName.indexOf("WITH"));

        sig = helper.createSignature(algName);

        // RFC 4056
        // When the id-RSASSA-PSS algorithm identifier is used for a signature,
        // the AlgorithmIdentifier parameters field MUST contain RSASSA-PSS-params.
        if (algorithm.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
        {
            AlgorithmParameters params = helper.createAlgorithmParameters(algName);

            params.init(algorithm.getParameters().toASN1Primitive().getEncoded(), "ASN.1");

            PSSParameterSpec spec = (PSSParameterSpec)params.getParameterSpec(PSSParameterSpec.class);
            sig.setParameter(spec);
        }
    }
    catch (Exception e)
    {
        return null;
    }

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

示例3: getSignatureName

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

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
private X509AttributeCertificate readDERCertificate(
    InputStream in)
    throws IOException
{
    ASN1InputStream dIn = new ASN1InputStream(in);
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

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

            return getCertificate();
        }
    }

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

示例5: getSignatureName

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
static String getSignatureName(
    AlgorithmIdentifier sigAlgId) 
{
    ASN1Encodable params = sigAlgId.getParameters();
    
    if (params != null && !derNull.equals(params))
    {
        if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
        {
            RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params);
            
            return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1";
        }
        if (sigAlgId.getObjectId().equals(X9ObjectIdentifiers.ecdsa_with_SHA2))
        {
            ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params);
            
            return getDigestAlgName((DERObjectIdentifier)ecDsaParams.getObjectAt(0)) + "withECDSA";
        }
    }

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

示例6: readDERCertificate

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
private Certificate readDERCertificate(
    InputStream in)
    throws IOException, CertificateParsingException
{
    ASN1InputStream dIn = new ASN1InputStream(in);
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

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

            return getCertificate();
        }
    }

    return new X509CertificateObject(
                        org.bouncycastle.asn1.x509.Certificate.getInstance(seq));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:X509CertParser.java

示例7: readDERCRL

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
private CRL readDERCRL(
    InputStream in)
    throws IOException, CRLException
{
    ASN1InputStream dIn = new ASN1InputStream(in);
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

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

            return getCRL();
        }
    }

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

示例8: getSignatureName

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

示例9: PKCS12SafeBagFactory

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public PKCS12SafeBagFactory(ContentInfo info, InputDecryptorProvider inputDecryptorProvider)
    throws PKCSException
{
    if (info.getContentType().equals(PKCSObjectIdentifiers.encryptedData))
    {
        CMSEncryptedData encData = new CMSEncryptedData(org.bouncycastle.asn1.cms.ContentInfo.getInstance(info));

        try
        {
            this.safeBagSeq = ASN1Sequence.getInstance(encData.getContent(inputDecryptorProvider));
        }
        catch (CMSException e)
        {
            throw new PKCSException("unable to extract data: " + e.getMessage(), e);
        }
        return;
    }

    throw new IllegalArgumentException("encryptedData requires constructor with decryptor.");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:PKCS12SafeBagFactory.java

示例10: getOIDForHashAlgorithm

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public static ASN1ObjectIdentifier getOIDForHashAlgorithm(int hashAlgorithm)
{
    switch (hashAlgorithm)
    {
    case HashAlgorithm.md5:
        return PKCSObjectIdentifiers.md5;
    case HashAlgorithm.sha1:
        return X509ObjectIdentifiers.id_SHA1;
    case HashAlgorithm.sha224:
        return NISTObjectIdentifiers.id_sha224;
    case HashAlgorithm.sha256:
        return NISTObjectIdentifiers.id_sha256;
    case HashAlgorithm.sha384:
        return NISTObjectIdentifiers.id_sha384;
    case HashAlgorithm.sha512:
        return NISTObjectIdentifiers.id_sha512;
    default:
        throw new IllegalArgumentException("unknown HashAlgorithm");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:TlsUtils.java

示例11: configure

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-512", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512", "SHA-512");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512, "SHA-512");

    provider.addAlgorithm("MessageDigest.SHA-512/224", PREFIX + "$DigestT224");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512/224", "SHA-512/224");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_224, "SHA-512/224");

    provider.addAlgorithm("MessageDigest.SHA-512/256", PREFIX + "$DigestT256");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA512256", "SHA-512/256");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha512_256, "SHA-512/256");

    provider.addAlgorithm("Mac.OLDHMACSHA512", PREFIX + "$OldSHA512");

    addHMACAlgorithm(provider, "SHA512", PREFIX + "$HashMac",  PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA512", PKCSObjectIdentifiers.id_hmacWithSHA512);

    addHMACAlgorithm(provider, "SHA512/224", PREFIX + "$HashMacT224",  PREFIX + "$KeyGeneratorT224");
    addHMACAlgorithm(provider, "SHA512/256", PREFIX + "$HashMacT256",  PREFIX + "$KeyGeneratorT256");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:SHA512.java

示例12: configure

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
    provider.addAlgorithm("MessageDigest.SHA-1", PREFIX + "$Digest");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest.SHA", "SHA-1");
    provider.addAlgorithm("Alg.Alias.MessageDigest." + OIWObjectIdentifiers.idSHA1, "SHA-1");

    addHMACAlgorithm(provider, "SHA1", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
    addHMACAlias(provider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
    addHMACAlias(provider, "SHA1", IANAObjectIdentifiers.hmacSHA1);

    provider.addAlgorithm("Mac.PBEWITHHMACSHA", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Mac.PBEWITHHMACSHA1", PREFIX + "$SHA1Mac");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA1");
    provider.addAlgorithm("Alg.Alias.Mac." + OIWObjectIdentifiers.idSHA1, "PBEWITHHMACSHA");

    provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", PREFIX + "$PBEWithMacKeyFactory");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1", PREFIX + "$PBKDF2WithHmacSHA1UTF8");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + PKCSObjectIdentifiers.id_PBKDF2, "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
    provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:SHA1.java

示例13: readDERCertificate

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

示例14: readDERCRL

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
private CRL readDERCRL(
    ASN1InputStream aIn)
    throws IOException, CRLException
{
    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

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

            return getCRL();
        }
    }

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

示例15: getSignatureName

import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; //导入依赖的package包/类
static String getSignatureName(
    AlgorithmIdentifier sigAlgId) 
{
    ASN1Encodable params = sigAlgId.getParameters();
    
    if (params != null && !derNull.equals(params))
    {
        if (sigAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
        {
            RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params);
            
            return getDigestAlgName(rsaParams.getHashAlgorithm().getAlgorithm()) + "withRSAandMGF1";
        }
        if (sigAlgId.getAlgorithm().equals(X9ObjectIdentifiers.ecdsa_with_SHA2))
        {
            ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params);
            
            return getDigestAlgName((DERObjectIdentifier)ecDsaParams.getObjectAt(0)) + "withECDSA";
        }
    }

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


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