You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Les Hazlewood (JIRA)" <ji...@apache.org> on 2011/05/04 19:46:03 UTC
[jira] [Created] (SHIRO-289) Support default
AssymetricCipherService
Support default AssymetricCipherService
---------------------------------------
Key: SHIRO-289
URL: https://issues.apache.org/jira/browse/SHIRO-289
Project: Shiro
Issue Type: New Feature
Components: Cryptography & Hashing
Reporter: Les Hazlewood
Fix For: 1.2.0
Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Les Hazlewood (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13177680#comment-13177680 ]
Les Hazlewood commented on SHIRO-289:
-------------------------------------
Hi Maria,
Awesome answer - I forgot the ECB weakness applies only to block ciphers. Thanks!
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Les Hazlewood (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041955#comment-13041955 ]
Les Hazlewood commented on SHIRO-289:
-------------------------------------
Not that I'm aware of yet Maria. Please feel free to help out - we'd appreciate it!
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Les Hazlewood (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Les Hazlewood updated SHIRO-289:
--------------------------------
Fix Version/s: (was: 1.2.0)
1.3.0
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.3.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Les Hazlewood (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174568#comment-13174568 ]
Les Hazlewood commented on SHIRO-289:
-------------------------------------
Hi Maria,
Is there a particular reason for using ECB mode for the RSACipherService implementation? This is generally considered an insecure Cipher Mode of Operation. Thoughts?
Les
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Les Hazlewood (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13179158#comment-13179158 ]
Les Hazlewood commented on SHIRO-289:
-------------------------------------
After applying the patch, I noticed some significant changes, re: class hierarchies. I think we'll need to delay this issue until 1.3+ where we can look at this in detail. Applying the patch as is would break backwards compatibility, which I think we should avoid at the moment while trying to release 1.2.
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Maria Jurcovicova (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174712#comment-13174712 ]
Maria Jurcovicova commented on SHIRO-289:
-----------------------------------------
Hi Les,
as I understand it, RSA is not a block cipher. The whole input is considered to be one big block and is encrypted 'as is'. The maximum input data size depends on the key size and the used padding. RSA with default key length encrypts only messages shorter than 118 bytes. [1]
Additionally, Java does not support any other operation mode for RSA [2].
Theoretically, it was be possible to split the input into blocks and encrypt them separately, but:
* asymmetric ciphers tend to be slow,
* this approach is generally not recommended (I do not remember why).
In most cases, the data are not encrypted directly with an asymmetric cipher. Rather, the combination of symmetric and asymmetric cipher is used:
1.) generate random symmetric key,
2.) encrypt the message with symmetric key,
3.) encrypt symmetric key with asymmetric key
4.) combined encrypted symmetric key and encrypted message.
This algorithm is implemented in the class CombinedCipherService.
Notes:
[1] For PKCS#1 v1.5, the maximum input size is (k -11) bytes where k is the modulus length of the key in bytes.
[2] Test whether all operation modes except ECB fail:
@Test
public void testAllBlockModes() {
byte[] plaintext = CodecSupport.toBytes("Hello, this is a test.");
for (OperationMode mode : allModesExceptECB()) {
System.out.println("Trying operation mode: " + mode);
//create cipher
RsaCipherService cipher = new RsaCipherService();
cipher.setMode(mode);
//create key
KeyPair keyPair = cipher.generateNewKeyPair();
byte[] publicKey = keyPair.getPublic().getEncoded();
boolean wasException = false;
try {
//encrypt
cipher.encrypt(plaintext, publicKey);
} catch (CryptoException ex) {
wasException = true;
System.out.println("The mode failed: " + ex);
}
if (!wasException)
fail("This is not supposed to work.");
}
}
@SuppressWarnings("static-access")
private List<OperationMode> allModesExceptECB() {
List<OperationMode> result = new ArrayList<OperationMode>();
for (OperationMode mode : OperationMode.CBC.values()) {
//skip ECB operation mode
if (!mode.equals(OperationMode.ECB))
result.add(mode);
}
return result;
}
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Maria Jurcovicova (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041034#comment-13041034 ]
Maria Jurcovicova commented on SHIRO-289:
-----------------------------------------
Is anyone working on this? If no, I would like to.
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SHIRO-289) Support default
AssymetricCipherService
Posted by "Maria Jurcovicova (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SHIRO-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maria Jurcovicova updated SHIRO-289:
------------------------------------
Attachment: patch-asymmetric-crypto.patch
The patch adds two cipher services: RSA cipher service and combined cipher service.
RSACipherService performs RSA/ECB/PKCS1 encryption. The implementation is almost the same as implementation of Aes and Blowfish cipher services.
CombinedCipherService combines symmetric and a asymmetric ciphers. It encrypts message with randomly generated symmetric cipher key. Symmetric key is then encrypted with an asymmetric cipher key and returned together with encrypted message.
Other changes:
* added AsymmetricCipherService and SymmetricCipherService interfaces. Both are extended from CipherService (needed for combined cipher),
* cipher service hierarchy slightly changed: both AbstractAsymmetricCipherService and AbstractSymmetricCipherService extend from DefaultBlockCipherService.
* added unit tests.
> Support default AssymetricCipherService
> ---------------------------------------
>
> Key: SHIRO-289
> URL: https://issues.apache.org/jira/browse/SHIRO-289
> Project: Shiro
> Issue Type: New Feature
> Components: Cryptography & Hashing
> Reporter: Les Hazlewood
> Fix For: 1.2.0
>
> Attachments: patch-asymmetric-crypto.patch
>
>
> Currently there is no out-of-the-box implementation for assyemtric crypto (e.g. RSA). This has been low priority for the Shiro dev team since Shiro itself doesn't use it (only symmetric ciphers). This should be implemented to make life easier for end users that require assymetric cipher.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira