|
Bouncy Castle Cryptography Library 1.84 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.ASN1Primitive
org.bouncycastle.asn1.ASN1Integer
Class representing the ASN.1 INTEGER type.
| Field Summary | |
static ASN1Integer |
FIVE
|
static ASN1Integer |
FOUR
|
static ASN1Integer |
ONE
|
static ASN1Integer |
THREE
|
static ASN1Integer |
TWO
|
static ASN1Integer |
ZERO
|
| Constructor Summary | |
ASN1Integer(java.math.BigInteger value)
Construct an INTEGER from the passed in BigInteger value. |
|
ASN1Integer(byte[] bytes)
Construct an INTEGER from the passed in byte array. |
|
ASN1Integer(int value)
Construct an INTEGER from the passed in int value. |
|
ASN1Integer(long value)
Construct an INTEGER from the passed in long value. |
|
| Method Summary | |
static ASN1Integer |
getInstance(ASN1TaggedObject taggedObject,
boolean declaredExplicit)
Return an Integer from a tagged object. |
static ASN1Integer |
getInstance(java.lang.Object obj)
Return an integer from the passed in object. |
java.math.BigInteger |
getPositiveValue()
in some cases positive values get crammed into a space, that's not quite big enough[] |
static ASN1Integer |
getTagged(ASN1TaggedObject taggedObject,
boolean declaredExplicit)
|
java.math.BigInteger |
getValue()
|
int |
hashCode()
|
boolean |
hasValue(java.math.BigInteger x)
|
boolean |
hasValue(int x)
|
boolean |
hasValue(long x)
|
int |
intPositiveValueExact()
|
int |
intValueExact()
|
long |
longValueExact()
|
java.lang.String |
toString()
|
static ASN1Integer |
valueOf(int value)
|
static ASN1Integer |
valueOf(long value)
|
| Methods inherited from class org.bouncycastle.asn1.ASN1Primitive |
encodeTo, encodeTo, equals, equals, equals, fromByteArray, toASN1Primitive |
| Methods inherited from class org.bouncycastle.asn1.ASN1Object |
getEncoded, getEncoded, hasEncodedTagValue |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final ASN1Integer ZERO
public static final ASN1Integer ONE
public static final ASN1Integer TWO
public static final ASN1Integer THREE
public static final ASN1Integer FOUR
public static final ASN1Integer FIVE
| Constructor Detail |
public ASN1Integer(int value)
value - the int representing the value desired.public ASN1Integer(long value)
value - the long representing the value desired.public ASN1Integer(java.math.BigInteger value)
value - the BigInteger representing the value desired.public ASN1Integer(byte[] bytes)
NB: Strict Validation applied by default.
It has turned out that there are still a few applications that struggle with the ASN.1 BER encoding rules for an INTEGER as described in: https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf Section 8.3.2.
Users can set the 'org.bouncycastle.asn1.allow_unsafe_integer' to 'true' and a looser validation will be applied. Users must recognise that this is not ideal and may pave the way for an exploit based around a faulty encoding in the future.
bytes - the byte array representing a 2's complement encoding of a BigInteger.| Method Detail |
public static ASN1Integer getInstance(java.lang.Object obj)
obj - an ASN1Integer or an object that can be converted into one.
java.lang.IllegalArgumentException - if the object cannot be converted.
public static ASN1Integer getInstance(ASN1TaggedObject taggedObject,
boolean declaredExplicit)
taggedObject - the tagged object holding the object we wantdeclaredExplicit - true if the object is meant to be explicitly
tagged false otherwise.
java.lang.IllegalArgumentException - if the tagged object cannot
be converted.
public static ASN1Integer getTagged(ASN1TaggedObject taggedObject,
boolean declaredExplicit)
public static ASN1Integer valueOf(int value)
public static ASN1Integer valueOf(long value)
public java.math.BigInteger getPositiveValue()
public java.math.BigInteger getValue()
public boolean hasValue(int x)
public boolean hasValue(long x)
public boolean hasValue(java.math.BigInteger x)
public int intPositiveValueExact()
public int intValueExact()
public long longValueExact()
public int hashCode()
hashCode in class ASN1Primitivepublic java.lang.String toString()
|
Bouncy Castle Cryptography Library 1.84 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||