public PrivateKeyUsageExtension(Boolean critical,Object value) throws CertificateException, IOException {
  this.extensionId=PKIXExtensions.PrivateKeyUsage_Id;
  this.critical=critical.booleanValue();
  this.extensionValue=(byte[])value;
  DerInputStream str=new DerInputStream(this.extensionValue);
  DerValue[] seq=str.getSequence(2);
  for (int i=0; i < seq.length; i++) {
    DerValue opt=seq[i];
    if (opt.isContextSpecific(TAG_BEFORE) && !opt.isConstructed()) {
      if (notBefore != null) {
        throw new CertificateParsingException("Duplicate notBefore in PrivateKeyUsage.");
      }
      opt.resetTag(DerValue.tag_GeneralizedTime);
      str=new DerInputStream(opt.toByteArray());
      notBefore=str.getGeneralizedTime();
    }
 else     if (opt.isContextSpecific(TAG_AFTER) && !opt.isConstructed()) {
      if (notAfter != null) {
        throw new CertificateParsingException("Duplicate notAfter in PrivateKeyUsage.");
      }
      opt.resetTag(DerValue.tag_GeneralizedTime);
      str=new DerInputStream(opt.toByteArray());
      notAfter=str.getGeneralizedTime();
    }
 else     throw new IOException("Invalid encoding of " + "PrivateKeyUsageExtension");
  }
}

public PrivateKeyUsageExtension ( Boolean critical , Object value ) throws CertificateException , IOException { this . extensionId = PKIXExtensions . PrivateKeyUsage_Id ; this . critical = critical . booleanValue ( ) ; this . extensionValue = ( byte [ ] ) value ; DerInputStream str = new DerInputStream ( this . extensionValue ) ; DerValue [ ] seq = str . getSequence ( 2 ) ; for ( int i = 0 ; i < seq . length ; i ++ ) { DerValue opt = seq [ i ] ; if ( opt . isContextSpecific ( TAG_BEFORE ) && ! opt . isConstructed ( ) ) { if ( notBefore != null ) { throw new CertificateParsingException ( "Duplicate notBefore in PrivateKeyUsage." ) ; } opt . resetTag ( DerValue . tag_GeneralizedTime ) ; str = new DerInputStream ( opt . toByteArray ( ) ) ; notBefore = str . getGeneralizedTime ( ) ; } else if ( opt . isContextSpecific ( TAG_AFTER ) && ! opt . isConstructed ( ) ) { if ( notAfter != null ) { throw new CertificateParsingException ( "Duplicate notAfter in PrivateKeyUsage." ) ; } opt . resetTag ( DerValue . tag_GeneralizedTime ) ; str = new DerInputStream ( opt . toByteArray ( ) ) ; notAfter = str . getGeneralizedTime ( ) ; } else throw new IOException ( "Invalid encoding of " + "PrivateKeyUsageExtension" ) ; } }
create the extension from the passed der encoded value .
