public void encode(OutputStream out) throws IOException {
  if (notBefore == null || notAfter == null) {
    throw new IOException("CertAttrSet:CertificateValidity:" + " null values to encode.\n");
  }
  DerOutputStream pair=new DerOutputStream();
  if (notBefore.getTime() < YR_2050) {
    pair.putUTCTime(notBefore);
  }
 else   pair.putGeneralizedTime(notBefore);
  if (notAfter.getTime() < YR_2050) {
    pair.putUTCTime(notAfter);
  }
 else {
    pair.putGeneralizedTime(notAfter);
  }
  DerOutputStream seq=new DerOutputStream();
  seq.write(DerValue.tag_Sequence,pair);
  out.write(seq.toByteArray());
}

public void encode ( OutputStream out ) throws IOException { if ( notBefore == null || notAfter == null ) { throw new IOException ( "CertAttrSet:CertificateValidity:" + " null values to encode.\n" ) ; } DerOutputStream pair = new DerOutputStream ( ) ; if ( notBefore . getTime ( ) < YR_2050 ) { pair . putUTCTime ( notBefore ) ; } else pair . putGeneralizedTime ( notBefore ) ; if ( notAfter . getTime ( ) < YR_2050 ) { pair . putUTCTime ( notAfter ) ; } else { pair . putGeneralizedTime ( notAfter ) ; } DerOutputStream seq = new DerOutputStream ( ) ; seq . write ( DerValue . tag_Sequence , pair ) ; out . write ( seq . toByteArray ( ) ) ; }
encode the certificatevalidity period in der form to the stream .
