Search in sources :

Example 41 with TableEntry

use of org.jcryptool.crypto.keystore.ui.dialogs.TableEntry in project core by jcryptool.

the class CMSSPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        CMSSKeyFactory keyFactory = new CMSSKeyFactory();
        CMSSPrivateKeySpec keySpec = (CMSSPrivateKeySpec) keyFactory.getKeySpec(key, CMSSPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_activesubtree, "" + keySpec.getActiveSubtree()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_heightoftrees, "" + keySpec.getHeightOfTrees()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_indexmain, "" + keySpec.getIndexMain()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_indexsub, "" + keySpec.getIndexSub()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
        paramElements.add(new TableEntry(Messages.ContentProvider_maintreeotskey, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getMaintreeOTSVerificationKey())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_masks, "" + keySpec.getMasks()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_seeds, "" + keySpec.getSeeds()));
        paramElements.add(new TableEntry(Messages.ContentProvider_subtreerootsig, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getSubtreeRootSig())));
        paramElements.add(new TableEntry(Messages.ContentProvider_authpaths, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getAuthPaths())));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) CMSSKeyFactory(de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory) CMSSPrivateKeySpec(de.flexiprovider.pqc.hbc.cmss.CMSSPrivateKeySpec)

Example 42 with TableEntry

use of org.jcryptool.crypto.keystore.ui.dialogs.TableEntry in project core by jcryptool.

the class CMSSPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        CMSSKeyFactory keyFactory = new CMSSKeyFactory();
        CMSSPublicKeySpec keySpec = (CMSSPublicKeySpec) keyFactory.getKeySpec(key, CMSSPublicKeySpec.class);
        if (keySpec == null)
            return null;
        paramElements.add(new TableEntry(Messages.ContentProvider_pubkeybytes, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getPubKeyBytes())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_masks, "" + keySpec.getMasks()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) CMSSPublicKeySpec(de.flexiprovider.pqc.hbc.cmss.CMSSPublicKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) CMSSKeyFactory(de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory)

Example 43 with TableEntry

use of org.jcryptool.crypto.keystore.ui.dialogs.TableEntry in project core by jcryptool.

the class DSAPublicKeyContentProvider method getParameters.

private List<TableEntry> getParameters(DSAKey key) {
    DSAParams params = (DSAParams) key.getParams();
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_baseg, "" + params.getBaseG()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_primep, "" + params.getPrimeP()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_primeq, "" + params.getPrimeQ()));
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) DSAParams(de.flexiprovider.core.dsa.interfaces.DSAParams)

Example 44 with TableEntry

use of org.jcryptool.crypto.keystore.ui.dialogs.TableEntry in project core by jcryptool.

the class DSAPublicKeyContentProvider method getAlgorithmElements.

@Override
protected List<TableEntry> getAlgorithmElements(Object inputElement) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        DSAPublicKey key = (DSAPublicKey) inputElement;
        if (key == null)
            return null;
        paramElements.add(new TableEntry(Messages.ContentProvider_valuey, key.getValueY().toString()));
        paramElements.addAll(getParameters(key));
    } catch (ClassCastException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) DSAPublicKey(de.flexiprovider.core.dsa.DSAPublicKey)

Example 45 with TableEntry

use of org.jcryptool.crypto.keystore.ui.dialogs.TableEntry in project core by jcryptool.

the class ECPrivateKeyContentProvider method getParameters.

private List<TableEntry> getParameters(ECPrivateKey key) {
    CurveParams params = (CurveParams) key.getParams();
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_k, "" + params.getK()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_r, "" + params.getR()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + params.getOID()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_ellipticcurve, "" + params.getE()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_g, "" + params.getG()));
    // $NON-NLS-2$
    paramElements.add(new TableEntry(Messages.ContentProvider_q, "" + params.getQ()));
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) CurveParams(de.flexiprovider.ec.parameters.CurveParams) ArrayList(java.util.ArrayList)

Aggregations

TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)61 ArrayList (java.util.ArrayList)60 InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)26 Key (de.flexiprovider.api.keys.Key)3 ECSecretKey (de.flexiprovider.ec.keys.ECSecretKey)3 InvalidKeyException (de.flexiprovider.api.exceptions.InvalidKeyException)2 DSAParams (de.flexiprovider.core.dsa.interfaces.DSAParams)2 SSVElGamalKeyFactory (de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalKeyFactory)2 CurveParams (de.flexiprovider.ec.parameters.CurveParams)2 IQDSAKeyFactory (de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory)2 IQDSAParameterSpec (de.flexiprovider.nf.iq.iqdsa.IQDSAParameterSpec)2 IQGQKeyFactory (de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory)2 IQGQParameterSpec (de.flexiprovider.nf.iq.iqgq.IQGQParameterSpec)2 IQRDSAKeyFactory (de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)2 IQRDSAParameterSpec (de.flexiprovider.nf.iq.iqrdsa.IQRDSAParameterSpec)2 McElieceCCA2KeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory)2 McElieceKeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceKeyFactory)2 NiederreiterKeyFactory (de.flexiprovider.pqc.ecc.niederreiter.NiederreiterKeyFactory)2 CMSSKeyFactory (de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory)2 GMSSKeyFactory (de.flexiprovider.pqc.hbc.gmss.GMSSKeyFactory)2