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

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

Introduction

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

Prototype

public String getCurrency() 

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

    /*/* w w w.j ava2 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();
}