Example usage for javax.crypto.spec PSource.PSpecified PSource.PSpecified

List of usage examples for javax.crypto.spec PSource.PSpecified PSource.PSpecified

Introduction

In this page you can find the example usage for javax.crypto.spec PSource.PSpecified PSource.PSpecified.

Prototype

public PSpecified(byte[] p) 

Source Link

Document

Constructs the source explicitly with the specified value p as the encoding input P.

Usage

From source file:it.scoppelletti.programmerpower.security.spi.PSpecifiedFactory.java

public PSource newInstance(Properties props, String prefix) {
    String name, value;/*  w  w  w .  jav  a2 s.  com*/
    byte[] p;
    PSource pSrc;

    name = Strings.concat(prefix, PSpecifiedFactory.PROP_P);
    value = props.getProperty(name);
    if (Strings.isNullOrEmpty(value)) {
        throw new ArgumentNullException(name);
    }

    try {
        p = Hex.decodeHex(value.toCharArray());
    } catch (DecoderException ex) {
        throw SecurityUtils.toSecurityException(ex);
    }

    pSrc = new PSource.PSpecified(p);

    return pSrc;
}