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

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

Introduction

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

Prototype

public BigInteger getAmount() 

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 ww  w  . j a  v a2 s  .co 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();
}