本文整理汇总了Java中org.bouncycastle.asn1.oiw.OIWObjectIdentifiers类的典型用法代码示例。如果您正苦于以下问题:Java OIWObjectIdentifiers类的具体用法?Java OIWObjectIdentifiers怎么用?Java OIWObjectIdentifiers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OIWObjectIdentifiers类属于org.bouncycastle.asn1.oiw包,在下文中一共展示了OIWObjectIdentifiers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRFC3211Wrapper
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
static Wrapper createRFC3211Wrapper(ASN1ObjectIdentifier algorithm)
throws CMSException
{
if (NISTObjectIdentifiers.id_aes128_CBC.equals(algorithm)
|| NISTObjectIdentifiers.id_aes192_CBC.equals(algorithm)
|| NISTObjectIdentifiers.id_aes256_CBC.equals(algorithm))
{
return new RFC3211WrapEngine(new AESEngine());
}
else if (PKCSObjectIdentifiers.des_EDE3_CBC.equals(algorithm))
{
return new RFC3211WrapEngine(new DESedeEngine());
}
else if (OIWObjectIdentifiers.desCBC.equals(algorithm))
{
return new RFC3211WrapEngine(new DESEngine());
}
else if (PKCSObjectIdentifiers.RC2_CBC.equals(algorithm))
{
return new RFC3211WrapEngine(new RC2Engine());
}
else
{
throw new CMSException("cannot recognise wrapper: " + algorithm);
}
}
示例2: configure
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的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");
}
示例3: configure
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("AlgorithmParameterGenerator.ELGAMAL", PREFIX + "AlgorithmParameterGeneratorSpi");
provider.addAlgorithm("AlgorithmParameterGenerator.ElGamal", PREFIX + "AlgorithmParameterGeneratorSpi");
provider.addAlgorithm("AlgorithmParameters.ELGAMAL", PREFIX + "AlgorithmParametersSpi");
provider.addAlgorithm("AlgorithmParameters.ElGamal", PREFIX + "AlgorithmParametersSpi");
provider.addAlgorithm("Cipher.ELGAMAL", PREFIX + "CipherSpi$NoPadding");
provider.addAlgorithm("Cipher.ElGamal", PREFIX + "CipherSpi$NoPadding");
provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
provider.addAlgorithm("Alg.Alias.Cipher.ELGAMAL/NONE/NOPADDING", "ELGAMAL");
provider.addAlgorithm("Cipher.ELGAMAL/PKCS1", PREFIX + "CipherSpi$PKCS1v1_5Padding");
provider.addAlgorithm("KeyFactory.ELGAMAL", PREFIX + "KeyFactorySpi");
provider.addAlgorithm("KeyFactory.ElGamal", PREFIX + "KeyFactorySpi");
provider.addAlgorithm("KeyPairGenerator.ELGAMAL", PREFIX + "KeyPairGeneratorSpi");
provider.addAlgorithm("KeyPairGenerator.ElGamal", PREFIX + "KeyPairGeneratorSpi");
AsymmetricKeyInfoConverter keyFact = new KeyFactorySpi();
registerOid(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL", keyFact);
registerOidAlgorithmParameters(provider, OIWObjectIdentifiers.elGamalAlgorithm, "ELGAMAL");
}
示例4: generatePrivate
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的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");
}
}
示例5: generatePublic
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的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");
}
}
示例6: configure
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的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.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2withASCII", "PBKDF2WithHmacSHA1And8BIT");
provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBKDF2with8BIT", "PBKDF2WithHmacSHA1And8BIT");
}
示例7: createTimeStampToken
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public static TimeStampToken createTimeStampToken(PrivateKey privateKey, List<X509Certificate> certificateChain)
throws Exception {
Store certs = new JcaCertStore(certificateChain);
TimeStampRequestGenerator requestGen = new TimeStampRequestGenerator();
requestGen.setCertReq(true);
TimeStampRequest request = requestGen.generate(TSPAlgorithms.SHA1, new byte[20], BigInteger.valueOf(100));
TimeStampTokenGenerator tsTokenGen = new TimeStampTokenGenerator(
new JcaSimpleSignerInfoGeneratorBuilder().build("SHA1withRSA", privateKey, certificateChain.get(0)),
new JcaDigestCalculatorProviderBuilder().build()
.get(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1)),
new ASN1ObjectIdentifier("1.2"));
tsTokenGen.addCertificates(certs);
return tsTokenGen.generate(request, BigInteger.ONE, new Date());
}
示例8: configure
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的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.PBKDF2WithHmacSHA1AndUTF8", "PBKDF2WithHmacSHA1");
provider.addAlgorithm("SecretKeyFactory.PBKDF2WithHmacSHA1And8BIT", PREFIX + "$PBKDF2WithHmacSHA18BIT");
}
示例9: getHashAlgorithm
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public AlgorithmIdentifier getHashAlgorithm()
{
if (null == this.otherHash)
{
return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
}
return this.otherHash.getHashAlgorithm();
}
示例10: getEncoded
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
/**
* Return a PKCS8 representation of the key. The sequence returned
* represents a full PrivateKeyInfo object.
*
* @return a PKCS8 representation of the key.
*/
public byte[] getEncoded()
{
try
{
PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(getX()));
return info.getEncoded(ASN1Encoding.DER);
}
catch (IOException e)
{
return null;
}
}
示例11: getEncoded
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public byte[] getEncoded()
{
try
{
SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(y));
return info.getEncoded(ASN1Encoding.DER);
}
catch (IOException e)
{
return null;
}
}
示例12: TimeStampTokenGenerator
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
/**
* basic creation - only the default attributes will be included here.
* @deprecated use SignerInfoGenerator constructor that takes a digest calculator
*/
public TimeStampTokenGenerator(
final SignerInfoGenerator signerInfoGen,
ASN1ObjectIdentifier tsaPolicy)
throws IllegalArgumentException, TSPException
{
this(new DigestCalculator()
{
private ByteArrayOutputStream bOut = new ByteArrayOutputStream();
public AlgorithmIdentifier getAlgorithmIdentifier()
{
return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE);
}
public OutputStream getOutputStream()
{
return bOut;
}
public byte[] getDigest()
{
try
{
return MessageDigest.getInstance("SHA-1").digest(bOut.toByteArray());
}
catch (NoSuchAlgorithmException e)
{
throw new IllegalStateException("cannot find sha-1: "+ e.getMessage());
}
}
}, signerInfoGen, tsaPolicy);
}
示例13: getHashAlgorithm
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public AlgorithmIdentifier getHashAlgorithm()
{
if (certID != null)
{
return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
}
else
{
return certIDv2.getHashAlgorithm();
}
}
示例14: getAlgorithmHash
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
public AlgorithmIdentifier getAlgorithmHash()
{
if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString)
{
// SHA-1
return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
}
else
{
return DigestInfo.getInstance(otherCertHash).getAlgorithmId();
}
}
示例15: addKeyIdentifiers
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; //导入依赖的package包/类
private void addKeyIdentifiers(SubjectPublicKeyInfo subjectPubKeyInfo, SubjectPublicKeyInfo issuerPubKeyInfo, X509v3CertificateBuilder v3CertGen) throws OperatorCreationException, CertIOException {
DigestCalculator digCalc = new BcDigestCalculatorProvider().get(new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1));
X509ExtensionUtils x509ExtensionUtils = new X509ExtensionUtils(digCalc);
v3CertGen.addExtension(Extension.subjectKeyIdentifier, false, x509ExtensionUtils.createSubjectKeyIdentifier(subjectPubKeyInfo));
v3CertGen.addExtension(Extension.authorityKeyIdentifier, false, x509ExtensionUtils.createAuthorityKeyIdentifier(issuerPubKeyInfo));
}