|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.demac.impl.j2me.process.base.service.webservices.asn1.ASN1AbstractType
org.demac.impl.j2me.process.base.service.webservices.asn1.ASN1TaggedType
org.demac.impl.j2me.process.base.service.webservices.asn1.ASN1Opaque
public class ASN1Opaque
Represents an opaque type. An opaque type merely decodes the tag and tag
class and stores the contents octets in an OCTET STRING. The opaque type is
represented in ASN.1 as
where
[UNIVERSAL x] IMPLICIT OCTET STRING
x
is the tag.
The opaque type is comparable to an open type
in that it
matches any type (just like the deprecated ANY type) on decoding. The
encoding can be reconstructed easily. This type is used whenever decoding of
a structure should be deferred to a later point in time. For instance an
AlgorithmIdentifier implementation can use an opaque type in order to decode
algorithm parameters. The encoding of the algorithm parameters is then done
by JCA/JCE classes later on.
One drawback of the opaque type is that special handling by the encoders and decoders is rquired to make it work properly. The main problem is that the opaque type does not store whether the underlying type is constructed or primitive. This decision must be made by the encoder.
Due to this limitation the opaque type can be used only for decoding types of class UNIVERSAL.
Constructor Summary | |
---|---|
ASN1Opaque()
Creates an instance. |
|
ASN1Opaque(byte[] code)
Creates an instance that stores the given encoding. |
|
ASN1Opaque(int tag,
int tagclass,
byte[] b)
Creates an instance with the given type, class, and inner type. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a clone. |
byte[] |
getEncoded()
This method is a convenience method in order to encode this type with DER. |
boolean |
isType(int tag,
int tagclass)
This method adopts the given tag and tag class if this instance is not yet initialized with a tag or tag class. |
void |
setInnerType(ASN1Type t)
Sets the inner type of this opaque type. |
Methods inherited from class org.demac.impl.j2me.process.base.service.webservices.asn1.ASN1TaggedType |
---|
decode, encode, getInnerType, getTag, getTagClass, getValue, isExplicit, setExplicit, setTag, setTagClass, toString |
Methods inherited from class org.demac.impl.j2me.process.base.service.webservices.asn1.ASN1AbstractType |
---|
checkConstraints, getConstraint, isOptional, readExternal, setConstraint, setOptional, writeExternal |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ASN1Opaque()
public ASN1Opaque(byte[] code) throws ASN1Exception
DERDecoder
in order to decode the identifier octets in
the given encoding.
Note: If the given encoding contains the concatenation of multiple encodings then only the first one will be stored. All others will be lost.
ASN1Exception
- if the given code cannot be decoded.public ASN1Opaque(int tag, int tagclass, byte[] b)
tag
- The ASN.1 tag of the opaque type.tagclass
- The tag class of the opaque type.b
- The DER compliant encoding of the contents octets of the
opaque type.
java.lang.NullPointerException
- if the given byte array is null
.Method Detail |
---|
public boolean isType(int tag, int tagclass)
true
is returned.
If a tag or tag class is already set then this method calls its super method.
isType
in interface ASN1Type
isType
in class ASN1AbstractType
tag
- The tag to compare with.tagclass
- The tag class to compare with.
true
if the given tag and tag class matches this
type and false
otherwise.public byte[] getEncoded() throws ASN1Exception
DEREncoder
in order to encode this type
to a byte array which is returned.
ASN1Exception
public void setInnerType(ASN1Type t)
ASN1OctetString
or a ClassCastException is
thrown.
setInnerType
in class ASN1TaggedType
t
- The type to set as the inner type.
java.lang.NullPointerException
- if the given type is null
.
java.lang.ClassCastException
- if the given type is not an ASN1OctetString.public java.lang.Object clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |