Java 类org.bouncycastle.asn1.ASN1Null 实例源码

项目:ipack    文件:SignaturePolicyIdentifier.java   
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;
}
项目:gwt-crypto    文件:SignaturePolicyIdentifier.java   
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;
}
项目:Aki-SSL    文件:SignaturePolicyIdentifier.java   
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;
}
项目:TinyTravelTracker    文件:SignaturePolicyIdentifier.java   
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;
}
项目:CryptMeme    文件:SignaturePolicyIdentifier.java   
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;
}
项目:irma_future_id    文件:SignaturePolicyIdentifier.java   
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;
}
项目:bc-java    文件:SignaturePolicyIdentifier.java   
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;
}
项目:ipack    文件:PKIConfirmContent.java   
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());
}
项目:gwt-crypto    文件:PKIConfirmContent.java   
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());
}
项目:Aki-SSL    文件:PKIConfirmContent.java   
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());
}
项目:Aki-SSL    文件:EnvelopedDataHelper.java   
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;
        }
    });
}
项目:keystore-explorer    文件:Asn1Dump.java   
/**
 * 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--;
        }
    }
}
项目:keystore-explorer    文件:Asn1Dump.java   
private String dumpNull(ASN1Null asn1Null) {
    StringBuilder sb = new StringBuilder();

    sb.append(indentSequence.toString(indentLevel));
    sb.append("NULL");
    sb.append(NEWLINE);

    return sb.toString();
}
项目:TinyTravelTracker    文件:PKIConfirmContent.java   
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());
}
项目:CryptMeme    文件:PKIConfirmContent.java   
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());
}
项目:irma_future_id    文件:PKIConfirmContent.java   
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());
}
项目:irma_future_id    文件:ASN1SequenceParserTest.java   
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);
}
项目:bc-java    文件:PKIConfirmContent.java   
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());
}
项目:bc-java    文件:ASN1SequenceParserTest.java   
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);
}
项目:ipack    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:ipack    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:gwt-crypto    文件:ParentCertIssuedValidation.java   
private boolean isNull(ASN1Encodable obj)
{
    return obj == null || obj instanceof ASN1Null;
}
项目:gwt-crypto    文件:X962Parameters.java   
public X962Parameters(
    ASN1Null           obj)
{
    this.params = obj;
}
项目:gwt-crypto    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:gwt-crypto    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:Aki-SSL    文件:ParentCertIssuedValidation.java   
private boolean isNull(ASN1Encodable obj)
{
    return obj == null || obj instanceof ASN1Null;
}
项目:Aki-SSL    文件:X962Parameters.java   
public X962Parameters(
    ASN1Null           obj)
{
    this.params = obj;
}
项目:Aki-SSL    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:Aki-SSL    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:Aki-SSL    文件:EnvelopedDataHelper.java   
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;
        }
    });
}
项目:TinyTravelTracker    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:TinyTravelTracker    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:CryptMeme    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:CryptMeme    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:irma_future_id    文件:ParentCertIssuedValidation.java   
private boolean isNull(ASN1Encodable obj)
{
    return obj == null || obj instanceof ASN1Null;
}
项目:irma_future_id    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:irma_future_id    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}
项目:bc-java    文件:ParentCertIssuedValidation.java   
private boolean isNull(ASN1Encodable obj)
{
    return obj == null || obj instanceof ASN1Null;
}
项目:bc-java    文件:X962Parameters.java   
public boolean isImplicitlyCA()
{
    return (params instanceof ASN1Null);
}
项目:bc-java    文件:PKIConfirmContent.java   
private PKIConfirmContent(ASN1Null val)
{
    this.val = val;
}