Search in sources :

Example 26 with TableEntry

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

the class PFlashPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        PFlashKeyFactory keyFactory = new PFlashKeyFactory();
        PFlashPublicKeySpec keySpec = (PFlashPublicKeySpec) keyFactory.getKeySpec(key, PFlashPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
    } 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) PFlashPublicKeySpec(de.flexiprovider.pqc.pflash.PFlashPublicKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) PFlashKeyFactory(de.flexiprovider.pqc.pflash.PFlashKeyFactory)

Example 27 with TableEntry

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

the class RSAPublicKeyContentProvider method getAlgorithmElements.

@Override
protected List<TableEntry> getAlgorithmElements(Object inputElement) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        RSAPublicKey key = (RSAPublicKey) inputElement;
        if (key == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_e, "" + key.getE()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_n, "" + key.getN()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_modulus, "" + key.getModulus()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_publicexponent, "" + key.getPublicExponent()));
    } catch (ClassCastException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) RSAPublicKey(de.flexiprovider.core.rsa.interfaces.RSAPublicKey) ArrayList(java.util.ArrayList)

Example 28 with TableEntry

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

the class RainbowPublicKeyContentProvider method getKeySpecElements.

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

Example 29 with TableEntry

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

the class SSVElGamalPrivateKeyContentProvider method getAlgorithmElements.

@Override
protected List<TableEntry> getAlgorithmElements(Object inputElement) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        SSVElGamalPrivateKey key = (SSVElGamalPrivateKey) inputElement;
        if (key == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_a, "" + key.getA()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_generator, "" + key.getGenerator()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_modulusp, "" + key.getModulusP()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_modulusq, "" + key.getModulusQ()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_publica, "" + key.getPublicA()));
    } catch (ClassCastException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) SSVElGamalPrivateKey(de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalPrivateKey)

Example 30 with TableEntry

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

the class AbstractKeyNodeContentProvider method getElements.

@Override
public Object[] getElements(Object inputElement) {
    Object[] elements = super.getElements(inputElement);
    Key key = getKey(inputElement);
    List<TableEntry> aliasElements = getAliasElements(inputElement);
    List<TableEntry> keyElements = getKeyElements(key);
    List<TableEntry> keySpecElements = getKeySpecElements(key);
    List<TableEntry> cipherElements = getCipherElements(key);
    List<TableEntry> algorithmElements = getAlgorithmElements(key);
    List<Object> abstractKeyNodeElements = new ArrayList<Object>();
    if (elements != null)
        abstractKeyNodeElements.addAll(Arrays.asList(elements));
    if (aliasElements != null)
        abstractKeyNodeElements.addAll(aliasElements);
    if (keyElements != null)
        abstractKeyNodeElements.addAll(keyElements);
    if (cipherElements != null)
        abstractKeyNodeElements.addAll(cipherElements);
    if (algorithmElements != null)
        abstractKeyNodeElements.addAll(algorithmElements);
    if (keySpecElements != null)
        abstractKeyNodeElements.addAll(keySpecElements);
    return abstractKeyNodeElements.toArray();
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) Key(de.flexiprovider.api.keys.Key)

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