androidcertificatebouncycastlex509spongycastle

Does SpongyCastle support DERObject class?


I'm attempting to use the equivalent of the following class in an Android application, where I'm using Spongy Castle 1.54:

org.bouncycastle.asn1.DERObject

I cannot import org.spongycastle.asn1.DERObject, nor does the BouncyCastle API reference list DERObject under the deprecated classes list.

Does Spongy Castle simply not support this class?


Solution

  • In newer versions of BouncyCastle and SpongyCastle, the DERObject class no longer exists.

    In SpongyCastle it was replaced by org.spongycastle.asn1.ASN1Primitive (note that the package name was also changed), and in BouncyCastle it was replaced by org.bouncycastle.asn1.ASN1Primitive

    You can check what changed from older versions in this link, specially in the "ASN.1 Changes" section:

    Old Class            New Class
    ASN1Object           ASN1Primitive
    ASN1Encodable        ASN1Object
    DEREncodable         ASN1Encodable
    DERObject            ASN1Primitive
    DERString            ASN1String
    DERObjectIdentifier  ASN1ObjectIdentifier
    X509Name             X500Name
    DERInteger           ASN1Integer
    DEREnumerated        ASN1Enumerated
    X509Attributes       X509AttributeIdentifiers
    X509Extension        Extension