本文整理汇总了Java中org.bouncycastle.asn1.nist.NISTObjectIdentifiers类的典型用法代码示例。如果您正苦于以下问题:Java NISTObjectIdentifiers类的具体用法?Java NISTObjectIdentifiers怎么用?Java NISTObjectIdentifiers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NISTObjectIdentifiers类属于org.bouncycastle.asn1.nist包,在下文中一共展示了NISTObjectIdentifiers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: determineKeyEncAlg
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
static AlgorithmIdentifier determineKeyEncAlg(KeyParameter key)
{
int length = key.getKey().length * 8;
ASN1ObjectIdentifier wrapOid;
if (length == 128)
{
wrapOid = NISTObjectIdentifiers.id_aes128_wrap;
}
else if (length == 192)
{
wrapOid = NISTObjectIdentifiers.id_aes192_wrap;
}
else if (length == 256)
{
wrapOid = NISTObjectIdentifiers.id_aes256_wrap;
}
else
{
throw new IllegalArgumentException("illegal keysize in AES");
}
return new AlgorithmIdentifier(wrapOid); // parameters absent
}
示例2: getOIDForHashAlgorithm
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的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");
}
}
示例3: configure
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的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");
}
示例4: createRFC3211Wrapper
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的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);
}
}
示例5: isRSASigAlgId
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public static boolean isRSASigAlgId(AlgorithmIdentifier algId) {
ParamUtil.requireNonNull("algId", algId);
ASN1ObjectIdentifier oid = algId.getAlgorithm();
if (PKCSObjectIdentifiers.sha1WithRSAEncryption.equals(oid)
|| PKCSObjectIdentifiers.sha224WithRSAEncryption.equals(oid)
|| PKCSObjectIdentifiers.sha256WithRSAEncryption.equals(oid)
|| PKCSObjectIdentifiers.sha384WithRSAEncryption.equals(oid)
|| PKCSObjectIdentifiers.sha512WithRSAEncryption.equals(oid)
|| NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_224.equals(oid)
|| NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_256.equals(oid)
|| NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_384.equals(oid)
|| NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_512.equals(oid)
|| PKCSObjectIdentifiers.id_RSASSA_PSS.equals(oid)) {
return true;
}
return false;
}
示例6: isECDSASigAlg
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
private static boolean isECDSASigAlg(AlgorithmIdentifier algId) {
ParamUtil.requireNonNull("algId", algId);
ASN1ObjectIdentifier oid = algId.getAlgorithm();
if (X9ObjectIdentifiers.ecdsa_with_SHA1.equals(oid)
|| X9ObjectIdentifiers.ecdsa_with_SHA224.equals(oid)
|| X9ObjectIdentifiers.ecdsa_with_SHA256.equals(oid)
|| X9ObjectIdentifiers.ecdsa_with_SHA384.equals(oid)
|| X9ObjectIdentifiers.ecdsa_with_SHA512.equals(oid)
|| NISTObjectIdentifiers.id_ecdsa_with_sha3_224.equals(oid)
|| NISTObjectIdentifiers.id_ecdsa_with_sha3_256.equals(oid)
|| NISTObjectIdentifiers.id_ecdsa_with_sha3_384.equals(oid)
|| NISTObjectIdentifiers.id_ecdsa_with_sha3_512.equals(oid)) {
return true;
}
return false;
}
示例7: isDSASigAlg
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public static boolean isDSASigAlg(AlgorithmIdentifier algId) {
ParamUtil.requireNonNull("algId", algId);
ASN1ObjectIdentifier oid = algId.getAlgorithm();
if (X9ObjectIdentifiers.id_dsa_with_sha1.equals(oid)
|| NISTObjectIdentifiers.dsa_with_sha224.equals(oid)
|| NISTObjectIdentifiers.dsa_with_sha256.equals(oid)
|| NISTObjectIdentifiers.dsa_with_sha384.equals(oid)
|| NISTObjectIdentifiers.dsa_with_sha512.equals(oid)
|| NISTObjectIdentifiers.id_dsa_with_sha3_224.equals(oid)
|| NISTObjectIdentifiers.id_dsa_with_sha3_256.equals(oid)
|| NISTObjectIdentifiers.id_dsa_with_sha3_384.equals(oid)
|| NISTObjectIdentifiers.id_dsa_with_sha3_512.equals(oid)) {
return true;
}
return false;
}
示例8: getOIDForHashAlgorithm
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public static ASN1ObjectIdentifier getOIDForHashAlgorithm(short 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");
}
}
示例9: getValue
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
@Override
public Attribute getValue() throws SignerException {
try {
X509Certificate cert = (X509Certificate) certificates[0];
X509Certificate issuerCert = (X509Certificate) certificates[1];
Digest digest = DigestFactory.getInstance().factoryDefault();
digest.setAlgorithm(DigestAlgorithmEnum.SHA_256);
byte[] certHash = digest.digest(cert.getEncoded());
X500Name dirName = new X500Name(issuerCert.getSubjectX500Principal().getName());
GeneralName name = new GeneralName(dirName);
GeneralNames issuer = new GeneralNames(name);
ASN1Integer serialNumber = new ASN1Integer(cert.getSerialNumber());
IssuerSerial issuerSerial = new IssuerSerial(issuer, serialNumber);
AlgorithmIdentifier algId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256);// SHA-256
ESSCertIDv2 essCertIDv2 = new ESSCertIDv2(algId, certHash, issuerSerial);
// return new Attribute(new ASN1ObjectIdentifier(identifier), new DERSet(new DERSequence(essCertIDv2)));
return new Attribute(new ASN1ObjectIdentifier(identifier), new DERSet(new DERSequence(
new ASN1Encodable[] { new DERSequence(essCertIDv2) })));
} catch (CertificateEncodingException ex) {
throw new SignerException(ex.getMessage());
}
}
示例10: getAlgorithm
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
protected static String getAlgorithm(String algDetails)
{
if (algDetails.indexOf('[') > 0)
{
return algDetails.substring(0, algDetails.indexOf('['));
}
if (algDetails.startsWith(NISTObjectIdentifiers.aes.getId()))
{
return "AES";
}
if (algDetails.startsWith(GNUObjectIdentifiers.Serpent.getId()))
{
return "Serpent";
}
String name = (String)nameTable.get(Strings.toUpperCase(algDetails));
if (name != null)
{
return name;
}
return algDetails;
}
示例11: DefaultSecretKeyProvider
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
DefaultSecretKeyProvider()
{
Map keySizes = new HashMap();
keySizes.put(new ASN1ObjectIdentifier("1.2.840.113533.7.66.10"), Integers.valueOf(128));
keySizes.put(PKCSObjectIdentifiers.des_EDE3_CBC, Integers.valueOf(192));
keySizes.put(NISTObjectIdentifiers.id_aes128_CBC, Integers.valueOf(128));
keySizes.put(NISTObjectIdentifiers.id_aes192_CBC, Integers.valueOf(192));
keySizes.put(NISTObjectIdentifiers.id_aes256_CBC, Integers.valueOf(256));
keySizes.put(NTTObjectIdentifiers.id_camellia128_cbc, Integers.valueOf(128));
keySizes.put(NTTObjectIdentifiers.id_camellia192_cbc, Integers.valueOf(192));
keySizes.put(NTTObjectIdentifiers.id_camellia256_cbc, Integers.valueOf(256));
keySizes.put(CryptoProObjectIdentifiers.gostR28147_gcfb, Integers.valueOf(256));
KEY_SIZES = Collections.unmodifiableMap(keySizes);
}
示例12: DefaultSecretKeyProvider
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
DefaultSecretKeyProvider()
{
Map keySizes = new HashMap();
keySizes.put(new ASN1ObjectIdentifier("1.2.840.113533.7.66.10"), Integers.valueOf(128));
keySizes.put(PKCSObjectIdentifiers.des_EDE3_CBC.getId(), Integers.valueOf(192));
keySizes.put(NISTObjectIdentifiers.id_aes128_CBC, Integers.valueOf(128));
keySizes.put(NISTObjectIdentifiers.id_aes192_CBC, Integers.valueOf(192));
keySizes.put(NISTObjectIdentifiers.id_aes256_CBC, Integers.valueOf(256));
keySizes.put(NTTObjectIdentifiers.id_camellia128_cbc, Integers.valueOf(128));
keySizes.put(NTTObjectIdentifiers.id_camellia192_cbc, Integers.valueOf(192));
keySizes.put(NTTObjectIdentifiers.id_camellia256_cbc, Integers.valueOf(256));
keySizes.put(CryptoProObjectIdentifiers.gostR28147_gcfb, Integers.valueOf(256));
KEY_SIZES = Collections.unmodifiableMap(keySizes);
}
示例13: configure
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("MessageDigest.SHA-384", PREFIX + "$Digest");
provider.addAlgorithm("Alg.Alias.MessageDigest.SHA384", "SHA-384");
provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha384, "SHA-384");
provider.addAlgorithm("Mac.OLDHMACSHA384", PREFIX + "$OldSHA384");
addHMACAlgorithm(provider, "SHA384", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
addHMACAlias(provider, "SHA384", PKCSObjectIdentifiers.id_hmacWithSHA384);
}
示例14: configure
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("MessageDigest.SHA-224", PREFIX + "$Digest");
provider.addAlgorithm("Alg.Alias.MessageDigest.SHA224", "SHA-224");
provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha224, "SHA-224");
addHMACAlgorithm(provider, "SHA224", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
addHMACAlias(provider, "SHA224", PKCSObjectIdentifiers.id_hmacWithSHA224);
}
示例15: configure
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; //导入依赖的package包/类
public void configure(ConfigurableProvider provider)
{
provider.addAlgorithm("MessageDigest.SHA-256", PREFIX + "$Digest");
provider.addAlgorithm("Alg.Alias.MessageDigest.SHA256", "SHA-256");
provider.addAlgorithm("Alg.Alias.MessageDigest." + NISTObjectIdentifiers.id_sha256, "SHA-256");
provider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA256", PREFIX + "$PBEWithMacKeyFactory");
provider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA-256", "PBEWITHHMACSHA256");
provider.addAlgorithm("Alg.Alias.SecretKeyFactory." + NISTObjectIdentifiers.id_sha256, "PBEWITHHMACSHA256");
addHMACAlgorithm(provider, "SHA256", PREFIX + "$HashMac", PREFIX + "$KeyGenerator");
addHMACAlias(provider, "SHA256", PKCSObjectIdentifiers.id_hmacWithSHA256);
addHMACAlias(provider, "SHA256", NISTObjectIdentifiers.id_sha256);
}