本文整理汇总了Java中org.bouncycastle.asn1.ASN1Null类的典型用法代码示例。如果您正苦于以下问题:Java ASN1Null类的具体用法?Java ASN1Null怎么用?Java ASN1Null使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASN1Null类属于org.bouncycastle.asn1包,在下文中一共展示了ASN1Null类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
public static SignaturePolicyIdentifier getInstance(
Object obj)
{
if (obj instanceof SignaturePolicyIdentifier)
{
return (SignaturePolicyIdentifier)obj;
}
else if (obj instanceof ASN1Null || hasEncodedTagValue(obj, BERTags.NULL))
{
return new SignaturePolicyIdentifier();
}
else if (obj != null)
{
return new SignaturePolicyIdentifier(SignaturePolicyId.getInstance(obj));
}
return null;
}
示例2: getInstance
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
public static PKIConfirmContent getInstance(Object o)
{
if (o == null || o instanceof PKIConfirmContent)
{
return (PKIConfirmContent)o;
}
if (o instanceof ASN1Null)
{
return new PKIConfirmContent((ASN1Null)o);
}
throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
示例3: createContentMac
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
Mac createContentMac(final Key sKey, final AlgorithmIdentifier macAlgId)
throws CMSException
{
return (Mac)execute(new JCECallback()
{
public Object doInJCE()
throws CMSException, InvalidAlgorithmParameterException,
InvalidKeyException, InvalidParameterSpecException, NoSuchAlgorithmException,
NoSuchPaddingException, NoSuchProviderException
{
Mac mac = createMac(macAlgId.getAlgorithm());
ASN1Encodable sParams = macAlgId.getParameters();
String macAlg = macAlgId.getAlgorithm().getId();
if (sParams != null && !(sParams instanceof ASN1Null))
{
try
{
AlgorithmParameters params = createAlgorithmParameters(macAlgId.getAlgorithm());
CMSUtils.loadParameters(params, sParams);
mac.init(sKey, params.getParameterSpec(IvParameterSpec.class));
}
catch (NoSuchAlgorithmException e)
{
throw e;
}
}
else
{
mac.init(sKey);
}
return mac;
}
});
}
示例4: dump
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
/**
* Get dump of the supplied ASN.1 object.
*
* @param asn1Object
* ASN.1 object
* @return Dump of object
* @throws Asn1Exception
* A problem was encountered getting the ASN.1 dump
* @throws IOException
* If an I/O problem occurred
*/
public String dump(ASN1Primitive asn1Object) throws Asn1Exception, IOException {
// Get dump of the supplied ASN.1 object incrementing the indent level of the output
try {
indentLevel++;
if (asn1Object instanceof DERBitString) { // special case of ASN1String
return dumpBitString((DERBitString) asn1Object);
} else if (asn1Object instanceof ASN1String) {
return dumpString((ASN1String) asn1Object);
} else if (asn1Object instanceof ASN1UTCTime) {
return dumpUTCTime((ASN1UTCTime) asn1Object);
} else if (asn1Object instanceof ASN1GeneralizedTime) {
return dumpGeneralizedTime((ASN1GeneralizedTime) asn1Object);
} else if (asn1Object instanceof ASN1Sequence ||
asn1Object instanceof ASN1Set ) {
return dumpSetOrSequence(asn1Object);
} else if (asn1Object instanceof ASN1TaggedObject) {
return dumpTaggedObject((ASN1TaggedObject) asn1Object);
} else if (asn1Object instanceof ASN1Boolean) {
return dumpBoolean((ASN1Boolean) asn1Object);
} else if (asn1Object instanceof ASN1Enumerated) {
return dumpEnumerated((ASN1Enumerated) asn1Object);
} else if (asn1Object instanceof ASN1Integer) {
return dumpInteger((ASN1Integer) asn1Object);
} else if (asn1Object instanceof ASN1Null) {
return dumpNull((ASN1Null) asn1Object);
} else if (asn1Object instanceof ASN1ObjectIdentifier) {
return dumpObjectIdentifier((ASN1ObjectIdentifier) asn1Object);
} else if (asn1Object instanceof ASN1OctetString) {
return dumpOctetString((ASN1OctetString) asn1Object);
} else {
throw new Asn1Exception("Unknown ASN.1 object: " + asn1Object.toString());
}
} finally {
if (true) {
indentLevel--;
}
}
}
示例5: dumpNull
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
private String dumpNull(ASN1Null asn1Null) {
StringBuilder sb = new StringBuilder();
sb.append(indentSequence.toString(indentLevel));
sb.append("NULL");
sb.append(NEWLINE);
return sb.toString();
}
示例6: testParseWithNull
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
private void testParseWithNull(byte[] data)
throws IOException
{
ASN1StreamParser aIn = new ASN1StreamParser(data);
ASN1SequenceParser seq = (ASN1SequenceParser)aIn.readObject();
Object o;
int count = 0;
assertNotNull("null sequence returned", seq);
while ((o = seq.readObject()) != null)
{
switch (count)
{
case 0:
assertTrue(o instanceof ASN1Null);
break;
case 1:
assertTrue(o instanceof DERInteger);
break;
case 2:
assertTrue(o instanceof DERObjectIdentifier);
break;
}
count++;
}
assertEquals("wrong number of objects in sequence", 3, count);
}
示例7: isImplicitlyCA
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
public boolean isImplicitlyCA()
{
return (params instanceof ASN1Null);
}
示例8: PKIConfirmContent
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
private PKIConfirmContent(ASN1Null val)
{
this.val = val;
}
示例9: isNull
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
private boolean isNull(ASN1Encodable obj)
{
return obj == null || obj instanceof ASN1Null;
}
示例10: X962Parameters
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
public X962Parameters(
ASN1Null obj)
{
this.params = obj;
}
示例11: createContentCipher
import org.bouncycastle.asn1.ASN1Null; //导入依赖的package包/类
public Cipher createContentCipher(final Key sKey, final AlgorithmIdentifier encryptionAlgID)
throws CMSException
{
return (Cipher)execute(new JCECallback()
{
public Object doInJCE()
throws CMSException, InvalidAlgorithmParameterException,
InvalidKeyException, InvalidParameterSpecException, NoSuchAlgorithmException,
NoSuchPaddingException, NoSuchProviderException
{
Cipher cipher = createCipher(encryptionAlgID.getAlgorithm());
ASN1Encodable sParams = encryptionAlgID.getParameters();
String encAlg = encryptionAlgID.getAlgorithm().getId();
if (sParams != null && !(sParams instanceof ASN1Null))
{
try
{
AlgorithmParameters params = createAlgorithmParameters(encryptionAlgID.getAlgorithm());
CMSUtils.loadParameters(params, sParams);
cipher.init(Cipher.DECRYPT_MODE, sKey, params);
}
catch (NoSuchAlgorithmException e)
{
if (encAlg.equals(CMSAlgorithm.DES_CBC.getId())
|| encAlg.equals(CMSEnvelopedDataGenerator.DES_EDE3_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.IDEA_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.AES128_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.AES192_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.AES256_CBC))
{
cipher.init(Cipher.DECRYPT_MODE, sKey, new IvParameterSpec(
ASN1OctetString.getInstance(sParams).getOctets()));
}
else
{
throw e;
}
}
}
else
{
if (encAlg.equals(CMSAlgorithm.DES_CBC.getId())
|| encAlg.equals(CMSEnvelopedDataGenerator.DES_EDE3_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.IDEA_CBC)
|| encAlg.equals(CMSEnvelopedDataGenerator.CAST5_CBC))
{
cipher.init(Cipher.DECRYPT_MODE, sKey, new IvParameterSpec(new byte[8]));
}
else
{
cipher.init(Cipher.DECRYPT_MODE, sKey);
}
}
return cipher;
}
});
}