public void set ( String name , Object val ) throws CertificateException , IOException { X509AttributeName attrName = new X509AttributeName ( name ) ; int attr = attributeMap ( attrName . getPrefix ( ) ) ; if ( attr == 0 ) { throw new CertificateException ( "Attribute name not recognized: " + name ) ; } // set rawCertInfo to null, so that we are forced to re-encode rawCertInfo = null ; String suffix = attrName . getSuffix ( ) ; switch ( attr ) { case ATTR_VERSION : if ( suffix == null ) { setVersion ( val ) ; } else { version . set ( suffix , val ) ; } break ; case ATTR_SERIAL : if ( suffix == null ) { setSerialNumber ( val ) ; } else { serialNum . set ( suffix , val ) ; } break ; case ATTR_ALGORITHM : if ( suffix == null ) { setAlgorithmId ( val ) ; } else { algId . set ( suffix , val ) ; } break ; case ATTR_ISSUER : setIssuer ( val ) ; break ; case ATTR_VALIDITY : if ( suffix == null ) { setValidity ( val ) ; } else { interval . set ( suffix , val ) ; } break ; case ATTR_SUBJECT : setSubject ( val ) ; break ; case ATTR_KEY : if ( suffix == null ) { setKey ( val ) ; } else { pubKey . set ( suffix , val ) ; } break ; case ATTR_ISSUER_ID : setIssuerUniqueId ( val ) ; break ; case ATTR_SUBJECT_ID : setSubjectUniqueId ( val ) ; break ; case ATTR_EXTENSIONS : if ( suffix == null ) { setExtensions ( val ) ; } else { if ( extensions == null ) extensions = new CertificateExtensions ( ) ; extensions . set ( suffix , val ) ; } break ; } }
Set the certificate attribute .