summaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as
diff options
context:
space:
mode:
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as112
1 files changed, 0 insertions, 112 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as b/vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as
deleted file mode 100644
index 932acd7b..00000000
--- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * ObjectIdentifier
- *
- * An ASN1 type for an ObjectIdentifier
- * We store the oid in an Array.
- * Copyright (c) 2007 Henri Torgemane
- *
- * See LICENSE.txt for full license information.
- */
-package com.hurlant.util.der
-{
- import flash.utils.ByteArray;
-
- public class ObjectIdentifier implements IAsn1Type
- {
- private var type:uint;
- private var len:uint;
- private var oid:Array;
-
- public function ObjectIdentifier(type:uint, length:uint, b:*) {
- this.type = type;
- this.len = length;
- if (b is ByteArray) {
- parse(b as ByteArray);
- } else if (b is String) {
- generate(b as String);
- } else {
- throw new Error("Invalid call to new ObjectIdentifier");
- }
- }
-
- private function generate(s:String):void {
- oid = s.split(".");
- }
-
- private function parse(b:ByteArray):void {
- // parse stuff
- // first byte = 40*value1 + value2
- var o:uint = b.readUnsignedByte();
- var a:Array = []
- a.push(uint(o/40));
- a.push(uint(o%40));
- var v:uint = 0;
- while (b.bytesAvailable>0) {
- o = b.readUnsignedByte();
- var last:Boolean = (o&0x80)==0;
- o &= 0x7f;
- v = v*128 + o;
- if (last) {
- a.push(v);
- v = 0;
- }
- }
- oid = a;
- }
-
- public function getLength():uint
- {
- return len;
- }
-
- public function getType():uint
- {
- return type;
- }
-
- public function toDER():ByteArray {
- var tmp:Array = [];
- tmp[0] = oid[0]*40 + oid[1];
- for (var i:int=2;i<oid.length;i++) {
- var v:int = parseInt(oid[i]);
- if (v<128) {
- tmp.push(v);
- } else if (v<128*128) {
- tmp.push( (v>>7)|0x80 );
- tmp.push( v&0x7f );
- } else if (v<128*128*128) {
- tmp.push( (v>>14)|0x80 );
- tmp.push( (v>>7)&0x7f | 0x80 );
- tmp.push( v&0x7f);
- } else if (v<128*128*128*128) {
- tmp.push( (v>>21)|0x80 );
- tmp.push( (v>>14) & 0x7f | 0x80 );
- tmp.push( (v>>7) & 0x7f | 0x80 );
- tmp.push( v & 0x7f );
- } else {
- throw new Error("OID element bigger than we thought. :(");
- }
- }
- len = tmp.length;
- if (type==0) {
- type = 6;
- }
- tmp.unshift(len); // assume length is small enough to fit here.
- tmp.unshift(type);
- var b:ByteArray = new ByteArray;
- for (i=0;i<tmp.length;i++) {
- b[i] = tmp[i];
- }
- return b;
- }
-
- public function toString():String {
- return DER.indent+oid.join(".");
- }
-
- public function dump():String {
- return "OID["+type+"]["+len+"]["+toString()+"]";
- }
-
- }
-} \ No newline at end of file