public class Attribute
implements DEREncodable
{
- private DERObjectIdentifier attrType;
- private ASN1Set attrValues;
+ private DERObjectIdentifier attrType;
+ private ASN1Set attrValues;
/**
* return an Attribute object from the given object.
* @param o the object we want converted.
* @exception IllegalArgumentException if the object cannot be converted.
*/
- public static Attribute getInstance(
+ public static Attribute getInstance(
Object o)
{
- if (o == null || o instanceof Attribute)
+ if (o == null || o instanceof Attribute)
{
- return (Attribute)o;
- }
-
- if (o instanceof ASN1Sequence)
+ return (Attribute)o;
+ }
+
+ if (o instanceof ASN1Sequence)
{
- return new Attribute((ASN1Sequence)o);
- }
+ return new Attribute((ASN1Sequence)o);
+ }
throw new IllegalArgumentException("unknown object in factory");
- }
-
- public Attribute(
+ }
+
+ public Attribute(
ASN1Sequence seq)
{
- attrType = (DERObjectIdentifier)seq.getObjectAt(0);
- attrValues = (ASN1Set)seq.getObjectAt(1);
- }
+ attrType = (DERObjectIdentifier)seq.getObjectAt(0);
+ attrValues = (ASN1Set)seq.getObjectAt(1);
+ }
- public Attribute(
- DERObjectIdentifier attrType,
- ASN1Set attrValues)
+ public Attribute(
+ DERObjectIdentifier attrType,
+ ASN1Set attrValues)
{
- this.attrType = attrType;
- this.attrValues = attrValues;
- }
+ this.attrType = attrType;
+ this.attrValues = attrValues;
+ }
- public DERObjectIdentifier getAttrType()
+ public DERObjectIdentifier getAttrType()
{
- return attrType;
- }
-
- public ASN1Set getAttrValues()
+ return attrType;
+ }
+
+ public ASN1Set getAttrValues()
{
- return attrValues;
- }
+ return attrValues;
+ }
/**
* <pre>
* Attribute ::= SEQUENCE {
- * attrType OBJECT IDENTIFIER,
- * attrValues SET OF AttributeValue
+ * attrType OBJECT IDENTIFIER,
+ * attrValues SET OF AttributeValue
* }
* </pre>
*/
- public DERObject getDERObject()
+ public DERObject getDERObject()
{
- DEREncodableVector v = new DEREncodableVector();
+ DEREncodableVector v = new DEREncodableVector();
- v.add(attrType);
- v.add(attrValues);
+ v.add(attrType);
+ v.add(attrValues);
- return new DERSequence(v);
- }
+ return new DERSequence(v);
+ }
}
// other SMIME attributes
//
- //
- // id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
- // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
- //
- static String id_aa = "1.2.840.113549.1.9.16.2";
-
- /*
- * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
- *
- */
- static DERObjectIdentifier id_aa_encrypKeyPref = new DERObjectIdentifier(id_aa + ".11");
+ //
+ // id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
+ // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
+ //
+ static String id_aa = "1.2.840.113549.1.9.16.2";
+
+ /*
+ * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
+ *
+ */
+ static DERObjectIdentifier id_aa_encrypKeyPref = new DERObjectIdentifier(id_aa + ".11");
//
// pkcs-12 OBJECT IDENTIFIER ::= {
private DERObjectIdentifier objectId;
private DEREncodable parameters;
private boolean parametersDefined = false;
-
+
public static AlgorithmIdentifier getInstance(
ASN1TaggedObject obj,
boolean explicit)
throw new IllegalArgumentException("unknown object in factory");
}
-
+
public AuthorityKeyIdentifier(
ASN1Sequence seq)
{
throw new IllegalArgumentException("unknown object in factory");
}
-
+
public BasicConstraints(
ASN1Sequence seq)
{
throw new IllegalArgumentException("unknown object in factory");
}
-
+
public CRLDistPoint(
ASN1Sequence seq)
{
public class GeneralName
implements DEREncodable
{
- DEREncodable obj;
- int tag;
- boolean isInsideImplicit = false; // if we are in an implicitly tagged object
+ DEREncodable obj;
+ int tag;
+ boolean isInsideImplicit = false; // if we are in an implicitly tagged object
public GeneralName(
X509Name directoryName)
* object.
* @deprecated
*/
- public void markInsideImplicit(
- boolean isInsideImplicit)
- {
- this.isInsideImplicit = isInsideImplicit;
- }
+ public void markInsideImplicit(
+ boolean isInsideImplicit)
+ {
+ this.isInsideImplicit = isInsideImplicit;
+ }
public DERObject getDERObject()
{
public class SubjectKeyIdentifier
implements DEREncodable
{
- private byte[] keyidentifier;
+ private byte[] keyidentifier;
public static SubjectKeyIdentifier getInstance(
ASN1TaggedObject obj,
throw new IllegalArgumentException("Invalid SubjectKeyIdentifier: " + obj.getClass().getName());
}
-
+
public SubjectKeyIdentifier(
byte[] keyid)
{
public SubjectKeyIdentifier(
ASN1OctetString keyid)
{
- this.keyidentifier=keyid.getOctets();
+ this.keyidentifier=keyid.getOctets();
}
- /**
- *
- * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
- * from SubjectPublicKeyInfo as defined in RFC2459.
- *
- **/
- public SubjectKeyIdentifier(
- SubjectPublicKeyInfo spki)
- {
- Digest digest = new SHA1Digest();
- byte[] resBuf = new byte[digest.getDigestSize()];
+ /**
+ *
+ * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
+ * from SubjectPublicKeyInfo as defined in RFC2459.
+ *
+ **/
+ public SubjectKeyIdentifier(
+ SubjectPublicKeyInfo spki)
+ {
+ Digest digest = new SHA1Digest();
+ byte[] resBuf = new byte[digest.getDigestSize()];
- byte[] bytes = spki.getPublicKeyData().getBytes();
- digest.update(bytes, 0, bytes.length);
- digest.doFinal(resBuf, 0);
- this.keyidentifier=resBuf;
- }
+ byte[] bytes = spki.getPublicKeyData().getBytes();
+ digest.update(bytes, 0, bytes.length);
+ digest.doFinal(resBuf, 0);
+ this.keyidentifier=resBuf;
+ }
public byte[] getKeyIdentifier()
{
DERConstructedSequence seq = new DERConstructedSequence();
seq.addObject(userCertificate);
seq.addObject(revocationDate);
-
+
if (reason != 0)
{
CRLReason rf = new CRLReason(reason);
{
throw new IllegalArgumentException("error encoding value: " + e);
}
- byte[] value = bOut.toByteArray();
+ byte[] value = bOut.toByteArray();
DERConstructedSequence eseq = new DERConstructedSequence();
DERConstructedSequence eseq1 = new DERConstructedSequence();
eseq1.addObject(X509Extensions.ReasonCode);
eseq1.addObject(new DEROctetString(value));
- eseq.addObject(eseq1);
+ eseq.addObject(eseq1);
X509Extensions ex = new X509Extensions(eseq);
seq.addObject(ex);
}
{
return getInstance(ASN1Sequence.getInstance(obj, explicit));
}
-
+
public static X509CertificateStructure getInstance(
Object obj)
{
* note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.
*/
public static final DERObjectIdentifier EmailAddress = new DERObjectIdentifier("1.2.840.113549.1.9.1");
-
- /**
- * email address in Verisign certificates
- */
- public static final DERObjectIdentifier E = EmailAddress;
-
+
+ /**
+ * email address in Verisign certificates
+ */
+ public static final DERObjectIdentifier E = EmailAddress;
+
/*
* others...
*/
if (_orderingSize != _oxn.ordering.size())
{
- return false;
- }
-
- boolean[] _indexes = new boolean[_orderingSize];
-
- for(int i = 0; i < _orderingSize; i++)
- {
- boolean _found = false;
- String _oid = ((DERObjectIdentifier)ordering.elementAt(i)).getId();
- String _val = (String)values.elementAt(i);
-
- for(int j = 0; j < _orderingSize; j++)
- {
- if(_indexes[j] == true)
- {
- continue;
- }
-
- String _oOID = ((DERObjectIdentifier)_oxn.ordering.elementAt(j)).getId();
- String _oVal = (String)_oxn.values.elementAt(j);
+ return false;
+ }
+
+ boolean[] _indexes = new boolean[_orderingSize];
+
+ for(int i = 0; i < _orderingSize; i++)
+ {
+ boolean _found = false;
+ String _oid = ((DERObjectIdentifier)ordering.elementAt(i)).getId();
+ String _val = (String)values.elementAt(i);
+
+ for(int j = 0; j < _orderingSize; j++)
+ {
+ if(_indexes[j] == true)
+ {
+ continue;
+ }
+
+ String _oOID = ((DERObjectIdentifier)_oxn.ordering.elementAt(j)).getId();
+ String _oVal = (String)_oxn.values.elementAt(j);
// was equalsIgnoreCase but MIDP doesn't like that.
- if(_oid.equals(_oOID) && _val.toLowerCase().equals(_oVal.toLowerCase()))
- {
- _indexes[j] = true;
- _found = true;
- break;
- }
-
- }
-
- if(!_found)
- {
- return false;
- }
- }
-
- return true;
- }
-
+ if(_oid.equals(_oOID) && _val.toLowerCase().equals(_oVal.toLowerCase()))
+ {
+ _indexes[j] = true;
+ _found = true;
+ break;
+ }
+
+ }
+
+ if(!_found)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public int hashCode()
{
ASN1Sequence seq = (ASN1Sequence)this.getDERObject();
static final DERObjectIdentifier ripemd160WithRSAEncryption = new DERObjectIdentifier("1.3.36.3.3.1.2");
- static final DERObjectIdentifier id_ea_rsa = new DERObjectIdentifier("2.5.8.1.1");
+ static final DERObjectIdentifier id_ea_rsa = new DERObjectIdentifier("2.5.8.1.1");
}
*
* @return the size, in bytes, of the digest produced by this message digest.
*/
- public int getDigestSize();
+ public int getDigestSize();
/**
* update the message digest with a single byte.
*
* @param in the input byte to be entered.
*/
- public void update(byte in);
+ public void update(byte in);
/**
* update the message digest with a block of bytes.
* @param inOff the offset into the byte array where the data starts.
* @param len the length of the data.
*/
- public void update(byte[] in, int inOff, int len);
+ public void update(byte[] in, int inOff, int len);
/**
* close the digest, producing the final digest value. The doFinal
* @param out the array the digest is to be copied into.
* @param outOff the offset into the out array the digest is to start at.
*/
- public int doFinal(byte[] out, int outOff);
+ public int doFinal(byte[] out, int outOff);
/**
* reset the digest back to it's initial state.