List of usage examples for org.bouncycastle.asn1.cms EncryptedContentInfo getContentType
public ASN1ObjectIdentifier getContentType()
From source file:es.gob.afirma.applet.CMSInformation.java
License:Open Source License
/** * Obtiene los datos de cifrado usados./* w w w . j a va2 s . co m*/ * * @param datos informacion de los datos cifrados sin formatear. * @return informacion de los datos cifrados. */ private static String getEncryptedContentInfo(final EncryptedContentInfo datos) { String info = ""; //$NON-NLS-1$ //especificamos el tipo de contenido if (datos.getContentType().equals(PKCSObjectIdentifiers.encryptedData)) { info = info + TB + AppletMessages.getString("CMSInformation.0") + SP + ENCRYPTED_DATA + CR; //$NON-NLS-1$ } else { info = info + TB + AppletMessages.getString("CMSInformation.0") + SP + datos.getContentType() + CR; //$NON-NLS-1$ } // el algoritmo de cifrado de los datos final AlgorithmIdentifier ai = datos.getContentEncryptionAlgorithm(); AOCipherAlgorithm algorithm = null; final AOCipherAlgorithm[] algos = AOCipherAlgorithm.values(); // obtenemos el algoritmo usado para cifrar la pass for (final AOCipherAlgorithm algo : algos) { if (algo.getOid().equals(ai.getAlgorithm().toString())) { algorithm = algo; } } if (algorithm != null) { info = info + TB + AppletMessages.getString("CMSInformation.17") + SP + algorithm.getName() + CR; //$NON-NLS-1$ } else { info = info + TB + AppletMessages.getString("CMSInformation.18") + SP + ai.getAlgorithm().toString() //$NON-NLS-1$ + CR; } return info; }