this.storage = _storage;
}
@Override
public IRequestMessage processRequestMessage(IRequestMessage req, String certificateProfileName) throws HandlerException {
final X509Name dn = req.getRequestX509Name();
if (LOG.isDebugEnabled()) {
LOG.debug(">processRequestMessage:'"+dn+"' and '"+certificateProfileName+"'");
}
final String unidPrefix = getPrefixFromCertProfileName(certificateProfileName);
if ( unidPrefix==null ) {
return req;
}
final Vector<String> v = dn.getValues();
final Vector<Object> o = dn.getOIDs();
if( v.size()!=o.size() ) {
throw new HandlerException("the BC X509Name object is corrupt.");
}
for ( int i=0; i<v.size(); i++ ) {
if ( o.get(i).equals(X509Name.SERIALNUMBER) ) {
final String newSerial = storeUnidFrnAndGetNewSerialNr(v.get(i), unidPrefix);
if ( newSerial!=null ) {
v.set(i, newSerial);
return new RequestMessageSubjectDnAdapter( req, new X509Name(o,v) );
}
}
}
return req;
}