CertGenerationStatesEnum.TARGETDN_STATE, UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<CertGenerationContainer>( "Set Cert Generation target Dn value" )
{
public void action( CertGenerationContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String targetDN = Strings.utf8ToString( value.getData() );
if ( IS_DEBUG )
{
LOG.debug( "Target Dn = " + targetDN );
}
if ( ( targetDN != null ) && ( targetDN.trim().length() > 0 ) )
{
if ( !Dn.isValid( targetDN ) )
{
String msg = I18n.err( I18n.ERR_04032, targetDN );
LOG.error( msg );
throw new DecoderException( msg );
}
container.getCertGenerationObject().setTargetDN( targetDN );
}
else
{
String msg = I18n.err( I18n.ERR_04033, Strings.dumpBytes( value.getData() ) );
LOG.error( msg );
throw new DecoderException( msg );
}
}
} );
/**
* Transition from targetDN state to issuerDN
*
* CertGenerationObject ::= SEQUENCE {
* ...
* issuerDN IA5String,
* ...
*
* Set the issuerDN value into the CertGenerationObject instance.
*/
super.transitions[CertGenerationStatesEnum.TARGETDN_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
new GrammarTransition<CertGenerationContainer>( CertGenerationStatesEnum.TARGETDN_STATE,
CertGenerationStatesEnum.ISSUER_STATE, UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<CertGenerationContainer>( "Set Cert Generation issuer Dn value" )
{
public void action( CertGenerationContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String issuerDN = Strings.utf8ToString( value.getData() );
if ( IS_DEBUG )
{
LOG.debug( "Issuer Dn = " + issuerDN );
}
if ( ( issuerDN != null ) && ( issuerDN.trim().length() > 0 ) )
{
if ( !Dn.isValid( issuerDN ) )
{
String msg = I18n.err( I18n.ERR_04034, issuerDN );
LOG.error( msg );
throw new DecoderException( msg );
}
container.getCertGenerationObject().setIssuerDN( issuerDN );
}
}
} );
/**
* Transition from issuerDN state to subjectDN
*
* CertGenerationObject ::= SEQUENCE {
* ...
* subjectDN IA5String,
* ...
*
* Set the subjectDN value into the CertGenerationObject instance.
*/
super.transitions[CertGenerationStatesEnum.ISSUER_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
new GrammarTransition<CertGenerationContainer>( CertGenerationStatesEnum.ISSUER_STATE,
CertGenerationStatesEnum.SUBJECT_STATE, UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<CertGenerationContainer>( "Set Cert Generation subject Dn value" )
{
public void action( CertGenerationContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String subjectDN = Strings.utf8ToString( value.getData() );
if ( IS_DEBUG )
{
LOG.debug( "subject Dn = " + subjectDN );
}
if ( ( subjectDN != null ) && ( subjectDN.trim().length() > 0 ) )
{
if ( !Dn.isValid( subjectDN ) )
{
String msg = I18n.err( I18n.ERR_04035, subjectDN );
LOG.error( msg );
throw new DecoderException( msg );
}
container.getCertGenerationObject().setSubjectDN( subjectDN );
}
else
{
String msg = I18n.err( I18n.ERR_04033, Strings.dumpBytes( value.getData() ) );
LOG.error( msg );
throw new DecoderException( msg );
}
}
} );
/**
* Transition from subjectDN state to keyAlgo
*
* CertGenerationObject ::= SEQUENCE {
* ...
* keyAlgorithm IA5String
*
* Set the key algorithm value into the CertGenerationObject instance.
*/
super.transitions[CertGenerationStatesEnum.SUBJECT_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
new GrammarTransition<CertGenerationContainer>( CertGenerationStatesEnum.SUBJECT_STATE,
CertGenerationStatesEnum.KEY_ALGORITHM_STATE,
UniversalTag.OCTET_STRING.getValue(),
new GrammarAction<CertGenerationContainer>( "Set Cert Generation key algorithm value" )
{
public void action( CertGenerationContainer container ) throws DecoderException
{
Value value = container.getCurrentTLV().getValue();
String keyAlgorithm = Strings.utf8ToString( value.getData() );
if ( IS_DEBUG )
{
LOG.debug( "key algorithm = " + keyAlgorithm );
}