Example usage for org.bouncycastle.asn1.isismtt.x509 MonetaryLimit getExponent

List of usage examples for org.bouncycastle.asn1.isismtt.x509 MonetaryLimit getExponent

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.isismtt.x509 MonetaryLimit getExponent.

Prototype

public BigInteger getExponent() 

Source Link

Usage

From source file:net.sf.keystore_explorer.crypto.x509.X509Ext.java

License:Open Source License

private String getMonetaryLimitStringValue(byte[] octets) {

    // @formatter:off

    /*//from  w w w  . j  a  v a 2  s.c o  m
       MonetaryLimitSyntax ::= SEQUENCE
       {
    currency PrintableString (SIZE(3)),
    amount INTEGER,
    exponent INTEGER
       }
     */

    // @formatter:on

    StringBuilder sb = new StringBuilder();

    MonetaryLimit monetaryLimit = MonetaryLimit.getInstance(octets);
    String currency = monetaryLimit.getCurrency();
    BigInteger amount = monetaryLimit.getAmount();
    BigInteger exponent = monetaryLimit.getExponent();

    if (currency != null) {
        sb.append(MessageFormat.format(res.getString("MonetaryLimit.Currency"), currency));
        sb.append(NEWLINE);
    }

    if (amount != null) {
        sb.append(MessageFormat.format(res.getString("MonetaryLimit.Amount"), amount.toString()));
        sb.append(NEWLINE);
    }

    if (exponent != null) {
        sb.append(MessageFormat.format(res.getString("MonetaryLimit.Exponent"), exponent.toString()));
        sb.append(NEWLINE);
    }

    return sb.toString();
}