Class KJUR.asn1.DERBitString
Extends
KJUR.asn1.ASN1Object.
class for ASN.1 DER encoded BitString primitive
Defined in: asn1-1.0.js.
Constructor Attributes | Constructor Name and Description |
---|---|
class for ASN.1 DER encoded BitString primitive
As for argument 'params' for constructor, you can specify one of following properties:
|
- Fields borrowed from class KJUR.asn1.ASN1Object:
- hL, hT, hTLV, hV, isModified, params
Method Attributes | Method Name and Description |
---|---|
<static> |
KJUR.asn1.DERBitString.newFalseArray(nLength)
generate an array of falses with specified length
This static method may be useful to initialize boolean array. |
setByBinaryString(binaryString)
set ASN.1 DER BitString by binary string
Its unused bits will be calculated automatically by length of 'binaryValue'. |
|
setByBooleanArray(booleanArray)
set ASN.1 TLV value(V) by an array of boolean
NOTE: Trailing falses will be ignored in the ASN.1 DER Object. |
|
setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits)
set ASN.1 value(V) by a hexadecimal string including unused bits
|
|
setUnusedBitsAndHexValue(unusedBits, hValue)
set ASN.1 value(V) by unused bit and hexadecimal string of value
|
- Methods borrowed from class KJUR.asn1.ASN1Object:
- getEncodedHex, getLengthHexFromValue, getValueHex, tohex
Class Detail
KJUR.asn1.DERBitString()
class for ASN.1 DER encoded BitString primitive
As for argument 'params' for constructor, you can specify one of following properties:
NOTE2: 'obj' parameter have been supported since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
As for argument 'params' for constructor, you can specify one of following properties:
- bin - specify binary string (ex. '10111')
- array - specify array of boolean (ex. [true,false,true,true])
- hex - specify hexadecimal string of ASN.1 value(V) including unused bits
- obj - specify KJUR.asn1.ASN1Util.newObject argument for "BitString encapsulates" structure.
NOTE2: 'obj' parameter have been supported since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
// default constructor o = new KJUR.asn1.DERBitString(); // initialize with binary string o = new KJUR.asn1.DERBitString({bin: "1011"}); // initialize with boolean array o = new KJUR.asn1.DERBitString({array: [true,false,true,true]}); // initialize with hexadecimal string (04 is unused bits) o = new KJUR.asn1.DERBitString({hex: "04bac0"}); // initialize with ASN1Util.newObject argument for encapsulated o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}}); // above generates a ASN.1 data like this: // BIT STRING, encapsulates { // SEQUENCE { // INTEGER 3 // PrintableString 'aaa' // } // }
Method Detail
<static>
{array}
KJUR.asn1.DERBitString.newFalseArray(nLength)
generate an array of falses with specified length
This static method may be useful to initialize boolean array.
This static method may be useful to initialize boolean array.
o = new KJUR.asn1.DERBitString(); o.newFalseArray(3) → [false, false, false]
- Parameters:
- {Integer} nLength
- length of array to generate
- Returns:
- {array} array of boolean falses
setByBinaryString(binaryString)
set ASN.1 DER BitString by binary string
Its unused bits will be calculated automatically by length of 'binaryValue'.
NOTE: Leading zeros '0' will be ignored.
Its unused bits will be calculated automatically by length of 'binaryValue'.
NOTE: Leading zeros '0' will be ignored.
o = new KJUR.asn1.DERBitString(); o.setByBinaryString("1011"); o.setByBinaryString("001"); // leading zeros ignored
- Parameters:
- {String} binaryString
- binary value string (i.e. '10111')
setByBooleanArray(booleanArray)
set ASN.1 TLV value(V) by an array of boolean
NOTE: Trailing falses will be ignored in the ASN.1 DER Object.
NOTE: Trailing falses will be ignored in the ASN.1 DER Object.
o = new KJUR.asn1.DERBitString(); o.setByBooleanArray([false, true, false, true, true]);
- Parameters:
- {array} booleanArray
- array of boolean (ex. [true, false, true])
setHexValueIncludingUnusedBits(newHexStringIncludingUnusedBits)
set ASN.1 value(V) by a hexadecimal string including unused bits
- Parameters:
- {String} newHexStringIncludingUnusedBits
setUnusedBitsAndHexValue(unusedBits, hValue)
set ASN.1 value(V) by unused bit and hexadecimal string of value
- Parameters:
- {Integer} unusedBits
- {String} hValue