From ccf94c8203b1dfdea3e7fc810b5dea983e57d292 Mon Sep 17 00:00:00 2001 From: Scott Ruoti Date: Wed, 31 May 2017 17:36:58 -0400 Subject: [PATCH] Initial commit of the PACE library. --- .gitignore | 27 + DEPENDENCIES | 20 + ENCRYPTION.md | 226 +++++ EXAMPLES.md | 151 ++++ KEY_MANAGEMENT.md | 39 + LICENSE | 212 +++++ NOTICE | 2 + README.md | 177 ++++ SIGNATURE.md | 173 ++++ contrib/Eclipse-Accumulo-Codestyle.xml | 306 +++++++ contrib/Eclipse-Accumulo-Template.xml | 107 +++ contrib/README.findbugs | 23 + core/.gitignore | 27 + core/pom.xml | 132 +++ core/src/main/findbugs/exclude-filter.xml | 46 + .../main/java/edu/mit/ll/pace/EntryField.java | 81 ++ .../ll/pace/IllegalKeyRequestException.java | 68 ++ .../mit/ll/pace/ItemProcessingIterator.java | 40 + .../ll/pace/encryption/AESValueEncryptor.java | 138 +++ .../DeterministicSIVValueEncryptor.java | 64 ++ .../encryption/EncryptedBatchScanner.java | 289 ++++++ .../pace/encryption/EncryptedBatchWriter.java | 141 +++ .../encryption/EncryptedScannerIterator.java | 175 ++++ .../ll/pace/encryption/EncryptionConfig.java | 94 ++ .../encryption/EncryptionConfigBuilder.java | 88 ++ .../pace/encryption/EncryptionException.java | 68 ++ .../encryption/EncryptionKeyContainer.java | 151 ++++ .../ll/pace/encryption/EntryEncryptor.java | 554 ++++++++++++ .../ll/pace/encryption/FieldEncryptor.java | 484 ++++++++++ .../pace/encryption/FieldEncryptorConfig.java | 158 ++++ .../FieldEncryptorConfigBuilder.java | 177 ++++ .../ll/pace/encryption/ValueEncryptor.java | 169 ++++ .../pace/encryption/ValueEncryptorBase.java | 55 ++ .../mit/ll/pace/internal/MutableEntry.java | 187 ++++ .../java/edu/mit/ll/pace/internal/Utils.java | 63 ++ .../mit/ll/pace/signature/EntrySigner.java | 381 ++++++++ .../ll/pace/signature/SignatureConfig.java | 200 +++++ .../signature/SignatureConfigBuilder.java | 128 +++ .../ll/pace/signature/SignatureException.java | 68 ++ .../pace/signature/SignatureKeyContainer.java | 100 +++ .../ll/pace/signature/SignedBatchScanner.java | 265 ++++++ .../ll/pace/signature/SignedBatchWriter.java | 160 ++++ .../SignedExternalScannerIterator.java | 142 +++ .../SignedInlineScannerIterator.java | 88 ++ .../mit/ll/pace/signature/SignedScanner.java | 323 +++++++ .../mit/ll/pace/signature/ValueSigner.java | 123 +++ .../mit/ll/pace/encryption/encrypt-entry.ini | 29 + .../mit/ll/pace/encryption/encrypt-value.ini | 17 + .../edu/mit/ll/pace/encryption/searchable.ini | 29 + .../edu/mit/ll/pace/signature/dsa.ini | 16 + .../edu/mit/ll/pace/signature/ecdsa.ini | 16 + .../edu/mit/ll/pace/signature/rsa.ini | 16 + .../java/edu/mit/ll/pace/EntryFieldTest.java | 60 ++ .../encryption/AESValueEncryptorTest.java | 112 +++ .../DeterministicSIVValueEncryptorTest.java | 73 ++ .../encryption/EncryptedBatchScannerTest.java | 524 +++++++++++ .../encryption/EncryptedBatchWriterTest.java | 248 ++++++ .../EncryptedScannerIteratorTest.java | 238 +++++ .../pace/encryption/EncryptionConfigTest.java | 201 +++++ .../pace/encryption/EntryEncryptorTest.java | 422 +++++++++ .../encryption/FieldEncryptorConfigTest.java | 175 ++++ .../pace/encryption/FieldEncryptorTest.java | 395 +++++++++ .../ll/pace/encryption/IdentityEncryptor.java | 94 ++ .../MockEncryptionKeyContainer.java | 173 ++++ .../pace/encryption/ValueEncryptorTest.java | 146 +++ .../ll/pace/internal/MutableEntryTest.java | 164 ++++ .../edu/mit/ll/pace/internal/UtilsTest.java | 74 ++ .../ll/pace/signature/EntrySignerTest.java | 280 ++++++ .../signature/MockSignatureKeyContainer.java | 175 ++++ .../SignatureConfigDestinationTest.java | 59 ++ .../pace/signature/SignatureConfigTest.java | 208 +++++ .../signature/SignedBatchScannerTest.java | 552 ++++++++++++ .../pace/signature/SignedBatchWriterTest.java | 507 +++++++++++ .../ll/pace/signature/SignedIteratorTest.java | 352 ++++++++ .../ll/pace/signature/SignedScannerTest.java | 662 ++++++++++++++ .../ll/pace/signature/ValueSignerTest.java | 143 +++ .../java/edu/mit/ll/pace/test/Matchers.java | 141 +++ .../java/edu/mit/ll/pace/test/TestUtils.java | 64 ++ .../EncryptedBatchScannerTest/encrypt-key.ini | 22 + .../partially-searchable.ini | 30 + .../searchable-row.ini | 22 + .../deterministic.ini | 18 + .../EncryptedScannerIteratorTest/config.ini | 16 + .../EncryptionConfigTest/config1.ini | 35 + .../EncryptionConfigTest/emptyConfig.ini | 14 + .../EntryEncryptorTest/deterministic.ini | 18 + .../EntryEncryptorTest/filterable.ini | 23 + .../EntryEncryptorTest/filterable1.ini | 18 + .../EntryEncryptorTest/filterable2.ini | 23 + .../EntryEncryptorTest/filterable3.ini | 23 + .../EntryEncryptorTest/filterable4.ini | 23 + .../EntryEncryptorTest/filterable5.ini | 23 + .../EntryEncryptorTest/searchable2.ini | 18 + .../EntryEncryptorTest/searchable3.ini | 29 + .../encryption/EntryEncryptorTest/zeroed1.ini | 18 + .../encryption/EntryEncryptorTest/zeroed2.ini | 23 + .../encryption/EntryEncryptorTest/zeroed3.ini | 18 + .../encryption/EntryEncryptorTest/zeroed4.ini | 23 + .../encryption/EntryEncryptorTest/zeroed5.ini | 18 + .../FieldEncryptorConfigTest/config1.ini | 21 + .../FieldEncryptorConfigTest/config2.ini | 21 + .../config2WithoutDefaults.ini | 19 + .../FieldEncryptorConfigTest/config3.ini | 16 + .../encryption/FieldEncryptorTest/all.ini | 18 + .../encryption/FieldEncryptorTest/gcm.ini | 18 + .../FieldEncryptorTest/gcmCEABAC.ini | 20 + .../FieldEncryptorTest/identity1.ini | 18 + .../FieldEncryptorTest/identity2.ini | 18 + .../FieldEncryptorTest/identityAll.ini | 18 + .../encryption/FieldEncryptorTest/siv.ini | 18 + .../config1WithoutDefault.ini | 17 + .../edu/mit/ll/pace/signature/config1.ini | 18 + .../edu/mit/ll/pace/signature/config2.ini | 18 + .../edu/mit/ll/pace/signature/config3.ini | 18 + core/src/test/resources/log4j.properties | 20 + examples/simple/.gitignore | 27 + examples/simple/pom.xml | 66 ++ .../src/main/findbugs/exclude-filter.xml | 17 + .../pace/examples/simple/ConverterOpts.java | 39 + .../ll/pace/examples/simple/Converters.java | 111 +++ .../simple/EncryptedConverterExample.java | 104 +++ .../simple/EncryptedReadWriteExample.java | 134 +++ .../simple/GenerateEncryptionKeys.java | 205 +++++ .../simple/GenerateSignatureKeys.java | 238 +++++ .../pace/examples/simple/ReadWriteOpts.java | 51 ++ .../simple/SignedConverterExample.java | 113 +++ .../simple/SignedReadWriteExample.java | 143 +++ keymanagement/common/.gitignore | 27 + keymanagement/common/pom.xml | 89 ++ .../src/main/findbugs/exclude-filter.xml | 17 + .../LocalEncryptionKeyContainer.java | 330 +++++++ .../LocalSignatureKeyContainer.java | 255 ++++++ .../LocalEncryptionKeyContainerTest.java | 58 ++ .../LocalSignatureKeyContainerTest.java | 82 ++ performance/.gitignore | 27 + performance/pom.xml | 221 +++++ .../src/main/findbugs/exclude-filter.xml | 22 + .../ll/pace/performance/BenchmarkBase.java | 282 ++++++ .../performance/EncryptionReadBenchmark.java | 61 ++ .../performance/EncryptionWriteBenchmark.java | 61 ++ .../performance/SignatureReadBenchmark.java | 63 ++ .../performance/SignatureWriteBenchmark.java | 63 ++ .../edu/mit/ll/pace/harness/accumulo.json | 7 + .../edu/mit/ll/pace/harness/keys.json | 43 + .../keys/AccumuloUser/DSA-signing.keys | 15 + .../keys/AccumuloUser/ECDSA-signing.keys | 15 + .../keys/AccumuloUser/RSA-signing.keys | 15 + .../harness/keys/AccumuloUser/encryption.keys | 515 +++++++++++ .../edu/mit/ll/pace/harness/users.json | 21 + .../encryption/encrypt-baseline.ini | 17 + .../performance/encryption/encrypt-entry.ini | 30 + .../performance/encryption/encrypt-value.ini | 18 + .../performance/encryption/obfuscate-key.ini | 19 + .../performance/encryption/searchable.ini | 30 + .../mit/ll/pace/performance/signature/dsa.ini | 16 + .../ll/pace/performance/signature/ecdsa.ini | 16 + .../performance/signature/read/column.ini | 18 + .../pace/performance/signature/read/table.ini | 18 + .../pace/performance/signature/read/value.ini | 16 + .../pace/performance/signature/rsa-pkcs1.ini | 16 + .../ll/pace/performance/signature/rsa-pss.ini | 16 + .../performance/signature/write/column.ini | 18 + .../performance/signature/write/table.ini | 18 + .../performance/signature/write/value.ini | 16 + .../src/main/resources/log4j.properties | 21 + performance/src/main/scripts/plotter.py | 169 ++++ pom.xml | 837 ++++++++++++++++++ test/.gitignore | 27 + test/pom.xml | 133 +++ test/src/main/findbugs/exclude-filter.xml | 17 + .../mit/ll/pace/harness/AccumuloInstance.java | 228 +++++ .../mit/ll/pace/harness/AccumuloRunner.java | 66 ++ .../java/edu/mit/ll/pace/harness/User.java | 157 ++++ .../java/edu/mit/ll/pace/test/Matchers.java | 161 ++++ .../java/edu/mit/ll/pace/test/TestUtils.java | 56 ++ .../test/encryption/BatchWriteReadIT.java | 159 ++++ .../ll/pace/test/encryption/FilteringIT.java | 427 +++++++++ .../ll/pace/test/encryption/VersioningIT.java | 141 +++ .../pace/test/signature/BatchWriteReadIT.java | 175 ++++ .../ll/pace/test/signature/VersioningIT.java | 151 ++++ .../GenerateEncryptionVersioningFiles.java | 142 +++ .../mit/ll/pace/test/utils/GenerateKeys.java | 268 ++++++ .../test/utils/GenerateRandomEntries.java | 90 ++ .../GenerateSignatureVersioningFiles.java | 148 ++++ .../edu/mit/ll/pace/harness/accumulo.json | 7 + .../edu/mit/ll/pace/harness/keys.json | 117 +++ .../pace/harness/keys/Alice/DSA-signing.keys | 25 + .../harness/keys/Alice/ECDSA-signing.keys | 25 + .../pace/harness/keys/Alice/RSA-signing.keys | 25 + .../pace/harness/keys/Alice/encryption.keys | 365 ++++++++ .../ll/pace/harness/keys/Bob/DSA-signing.keys | 25 + .../pace/harness/keys/Bob/ECDSA-signing.keys | 25 + .../ll/pace/harness/keys/Bob/RSA-signing.keys | 25 + .../ll/pace/harness/keys/Bob/encryption.keys | 455 ++++++++++ .../harness/keys/Charlie/DSA-signing.keys | 25 + .../harness/keys/Charlie/ECDSA-signing.keys | 25 + .../harness/keys/Charlie/RSA-signing.keys | 25 + .../pace/harness/keys/Charlie/encryption.keys | 515 +++++++++++ .../ll/pace/harness/keys/Eve/DSA-signing.keys | 15 + .../pace/harness/keys/Eve/ECDSA-signing.keys | 15 + .../ll/pace/harness/keys/Eve/RSA-signing.keys | 15 + .../ll/pace/harness/keys/Eve/encryption.keys | 4 + .../edu/mit/ll/pace/harness/users.json | 69 ++ .../pace/test/encryption/FilteringIT/all.ini | 25 + .../encryption/FilteringIT/fetchColumn1.ini | 21 + .../encryption/FilteringIT/fetchColumn2.ini | 21 + .../encryption/FilteringIT/fetchColumn3.ini | 17 + .../encryption/FilteringIT/fetchColumn4.ini | 17 + .../encryption/FilteringIT/fetchColumn5.ini | 17 + .../encryption/FilteringIT/fetchColumn6.ini | 17 + .../FilteringIT/fetchColumnFamily1.ini | 18 + .../FilteringIT/fetchColumnFamily2.ini | 17 + .../encryption/FilteringIT/setRanges1.ini | 21 + .../encryption/FilteringIT/setRanges2.ini | 21 + .../encryption/FilteringIT/setRanges3.ini | 21 + .../encryption/VersioningIT/1.0/config.json | 30 + .../VersioningIT/1.0/data/.data.rf.crc | Bin 0 -> 1392 bytes .../1.0/data/.encrypt-entry.rf.crc | Bin 0 -> 4512 bytes .../1.0/data/.encrypt-value.rf.crc | Bin 0 -> 2016 bytes .../1.0/data/.obfuscate-key.rf.crc | Bin 0 -> 1816 bytes .../VersioningIT/1.0/data/.searchable.rf.crc | Bin 0 -> 2568 bytes .../encryption/VersioningIT/1.0/data/data.rf | Bin 0 -> 177099 bytes .../VersioningIT/1.0/data/encrypt-entry.rf | Bin 0 -> 576076 bytes .../VersioningIT/1.0/data/encrypt-value.rf | Bin 0 -> 256924 bytes .../1.0/data/keys/encryption.keys | 265 ++++++ .../VersioningIT/1.0/data/obfuscate-key.rf | Bin 0 -> 231240 bytes .../VersioningIT/1.0/data/searchable.rf | Bin 0 -> 327512 bytes .../VersioningIT/1.0/encrypt-entry.ini | 29 + .../VersioningIT/1.0/encrypt-value.ini | 17 + .../encryption/VersioningIT/1.0/keys.json | 31 + .../VersioningIT/1.0/obfuscate-key.ini | 18 + .../VersioningIT/1.0/searchable.ini | 29 + .../test/encryption/VersioningIT/config.json | 5 + .../ll/pace/test/encryption/encrypt-value.ini | 17 + .../ll/pace/test/encryption/obfuscate-key.ini | 18 + .../ll/pace/test/encryption/searchable.ini | 29 + .../test/signature/VersioningIT/1.0/DSA.ini | 16 + .../test/signature/VersioningIT/1.0/ECDSA.ini | 16 + .../signature/VersioningIT/1.0/RSA-PKCS1.ini | 16 + .../VersioningIT/1.0/RSA-PSS-colVis.ini | 18 + .../1.0/RSA-PSS-separateTable.ini | 18 + .../signature/VersioningIT/1.0/RSA-PSS.ini | 16 + .../signature/VersioningIT/1.0/config.json | 40 + .../VersioningIT/1.0/data/.DSA.rf.crc | Bin 0 -> 1728 bytes .../VersioningIT/1.0/data/.ECDSA.rf.crc | Bin 0 -> 1920 bytes .../VersioningIT/1.0/data/.RSA-PKSC1.rf.crc | Bin 0 -> 2404 bytes .../1.0/data/.RSA-PSS-colVis.rf.crc | Bin 0 -> 2436 bytes .../1.0/data/.RSA-PSS-separateTable.rf.crc | Bin 0 -> 2152 bytes .../VersioningIT/1.0/data/.RSA-PSS.rf.crc | Bin 0 -> 2404 bytes .../VersioningIT/1.0/data/.data.rf.crc | Bin 0 -> 1392 bytes .../signature/VersioningIT/1.0/data/DSA.rf | Bin 0 -> 219917 bytes .../signature/VersioningIT/1.0/data/ECDSA.rf | Bin 0 -> 244418 bytes .../VersioningIT/1.0/data/RSA-PKSC1.rf | Bin 0 -> 306192 bytes .../VersioningIT/1.0/data/RSA-PSS-colVis.rf | Bin 0 -> 310596 bytes .../1.0/data/RSA-PSS-separateTable.rf | Bin 0 -> 273962 bytes .../VersioningIT/1.0/data/RSA-PSS.rf | Bin 0 -> 306190 bytes .../signature/VersioningIT/1.0/data/data.rf | Bin 0 -> 177065 bytes .../1.0/data/keys/DSA-signing.keys | 15 + .../1.0/data/keys/ECDSA-signing.keys | 15 + .../1.0/data/keys/RSA-signing.keys | 15 + .../test/signature/VersioningIT/1.0/keys.json | 11 + .../test/signature/VersioningIT/config.json | 5 + .../mit/ll/pace/test/signature/config1.ini | 16 + .../mit/ll/pace/test/signature/config2.ini | 18 + .../mit/ll/pace/test/signature/config3.ini | 18 + test/src/main/resources/log4j.properties | 20 + 266 files changed, 24194 insertions(+) create mode 100644 .gitignore create mode 100644 DEPENDENCIES create mode 100644 ENCRYPTION.md create mode 100644 EXAMPLES.md create mode 100644 KEY_MANAGEMENT.md create mode 100644 LICENSE create mode 100644 NOTICE create mode 100644 README.md create mode 100644 SIGNATURE.md create mode 100644 contrib/Eclipse-Accumulo-Codestyle.xml create mode 100644 contrib/Eclipse-Accumulo-Template.xml create mode 100644 contrib/README.findbugs create mode 100644 core/.gitignore create mode 100644 core/pom.xml create mode 100644 core/src/main/findbugs/exclude-filter.xml create mode 100644 core/src/main/java/edu/mit/ll/pace/EntryField.java create mode 100644 core/src/main/java/edu/mit/ll/pace/IllegalKeyRequestException.java create mode 100644 core/src/main/java/edu/mit/ll/pace/ItemProcessingIterator.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/AESValueEncryptor.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/DeterministicSIVValueEncryptor.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptedBatchScanner.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptedBatchWriter.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptedScannerIterator.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptionConfig.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptionConfigBuilder.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptionException.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EncryptionKeyContainer.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/EntryEncryptor.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/FieldEncryptor.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/FieldEncryptorConfig.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/FieldEncryptorConfigBuilder.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/ValueEncryptor.java create mode 100644 core/src/main/java/edu/mit/ll/pace/encryption/ValueEncryptorBase.java create mode 100644 core/src/main/java/edu/mit/ll/pace/internal/MutableEntry.java create mode 100644 core/src/main/java/edu/mit/ll/pace/internal/Utils.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/EntrySigner.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignatureConfig.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignatureConfigBuilder.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignatureException.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignatureKeyContainer.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignedBatchScanner.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignedBatchWriter.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignedExternalScannerIterator.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignedInlineScannerIterator.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/SignedScanner.java create mode 100644 core/src/main/java/edu/mit/ll/pace/signature/ValueSigner.java create mode 100644 core/src/main/resources/edu/mit/ll/pace/encryption/encrypt-entry.ini create mode 100644 core/src/main/resources/edu/mit/ll/pace/encryption/encrypt-value.ini create mode 100644 core/src/main/resources/edu/mit/ll/pace/encryption/searchable.ini create mode 100644 core/src/main/resources/edu/mit/ll/pace/signature/dsa.ini create mode 100644 core/src/main/resources/edu/mit/ll/pace/signature/ecdsa.ini create mode 100644 core/src/main/resources/edu/mit/ll/pace/signature/rsa.ini create mode 100644 core/src/test/java/edu/mit/ll/pace/EntryFieldTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/AESValueEncryptorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/DeterministicSIVValueEncryptorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/EncryptedBatchScannerTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/EncryptedBatchWriterTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/EncryptedScannerIteratorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/EncryptionConfigTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/EntryEncryptorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/FieldEncryptorConfigTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/FieldEncryptorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/IdentityEncryptor.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/MockEncryptionKeyContainer.java create mode 100644 core/src/test/java/edu/mit/ll/pace/encryption/ValueEncryptorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/internal/MutableEntryTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/internal/UtilsTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/EntrySignerTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/MockSignatureKeyContainer.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignatureConfigDestinationTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignatureConfigTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignedBatchScannerTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignedBatchWriterTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignedIteratorTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/SignedScannerTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/signature/ValueSignerTest.java create mode 100644 core/src/test/java/edu/mit/ll/pace/test/Matchers.java create mode 100644 core/src/test/java/edu/mit/ll/pace/test/TestUtils.java create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptedBatchScannerTest/encrypt-key.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptedBatchScannerTest/partially-searchable.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptedBatchScannerTest/searchable-row.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptedBatchWriterTest/deterministic.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptedScannerIteratorTest/config.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptionConfigTest/config1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EncryptionConfigTest/emptyConfig.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/deterministic.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable3.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable4.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/filterable5.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/searchable2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/searchable3.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/zeroed1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/zeroed2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/zeroed3.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/zeroed4.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/EntryEncryptorTest/zeroed5.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorConfigTest/config1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorConfigTest/config2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorConfigTest/config2WithoutDefaults.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorConfigTest/config3.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/all.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/gcm.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/gcmCEABAC.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/identity1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/identity2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/identityAll.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/encryption/FieldEncryptorTest/siv.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/signature/SignatureConfigTest/config1WithoutDefault.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/signature/config1.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/signature/config2.ini create mode 100644 core/src/test/resources/edu/mit/ll/pace/signature/config3.ini create mode 100644 core/src/test/resources/log4j.properties create mode 100644 examples/simple/.gitignore create mode 100644 examples/simple/pom.xml create mode 100644 examples/simple/src/main/findbugs/exclude-filter.xml create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/ConverterOpts.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/Converters.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/EncryptedConverterExample.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/EncryptedReadWriteExample.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/GenerateEncryptionKeys.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/GenerateSignatureKeys.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/ReadWriteOpts.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/SignedConverterExample.java create mode 100644 examples/simple/src/main/java/edu/mit/ll/pace/examples/simple/SignedReadWriteExample.java create mode 100644 keymanagement/common/.gitignore create mode 100644 keymanagement/common/pom.xml create mode 100644 keymanagement/common/src/main/findbugs/exclude-filter.xml create mode 100644 keymanagement/common/src/main/java/edu/mit/ll/pace/keymanagement/LocalEncryptionKeyContainer.java create mode 100644 keymanagement/common/src/main/java/edu/mit/ll/pace/keymanagement/LocalSignatureKeyContainer.java create mode 100644 keymanagement/common/src/test/java/edu/mit/ll/pace/keymanagement/LocalEncryptionKeyContainerTest.java create mode 100644 keymanagement/common/src/test/java/edu/mit/ll/pace/keymanagement/LocalSignatureKeyContainerTest.java create mode 100644 performance/.gitignore create mode 100644 performance/pom.xml create mode 100644 performance/src/main/findbugs/exclude-filter.xml create mode 100644 performance/src/main/java/edu/mit/ll/pace/performance/BenchmarkBase.java create mode 100644 performance/src/main/java/edu/mit/ll/pace/performance/EncryptionReadBenchmark.java create mode 100644 performance/src/main/java/edu/mit/ll/pace/performance/EncryptionWriteBenchmark.java create mode 100644 performance/src/main/java/edu/mit/ll/pace/performance/SignatureReadBenchmark.java create mode 100644 performance/src/main/java/edu/mit/ll/pace/performance/SignatureWriteBenchmark.java create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/accumulo.json create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/keys.json create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/keys/AccumuloUser/DSA-signing.keys create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/keys/AccumuloUser/ECDSA-signing.keys create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/keys/AccumuloUser/RSA-signing.keys create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/keys/AccumuloUser/encryption.keys create mode 100644 performance/src/main/resources/edu/mit/ll/pace/harness/users.json create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/encryption/encrypt-baseline.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/encryption/encrypt-entry.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/encryption/encrypt-value.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/encryption/obfuscate-key.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/encryption/searchable.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/dsa.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/ecdsa.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/read/column.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/read/table.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/read/value.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/rsa-pkcs1.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/rsa-pss.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/write/column.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/write/table.ini create mode 100644 performance/src/main/resources/edu/mit/ll/pace/performance/signature/write/value.ini create mode 100644 performance/src/main/resources/log4j.properties create mode 100644 performance/src/main/scripts/plotter.py create mode 100644 pom.xml create mode 100644 test/.gitignore create mode 100644 test/pom.xml create mode 100644 test/src/main/findbugs/exclude-filter.xml create mode 100644 test/src/main/java/edu/mit/ll/pace/harness/AccumuloInstance.java create mode 100644 test/src/main/java/edu/mit/ll/pace/harness/AccumuloRunner.java create mode 100644 test/src/main/java/edu/mit/ll/pace/harness/User.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/Matchers.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/TestUtils.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/encryption/BatchWriteReadIT.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/encryption/FilteringIT.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/encryption/VersioningIT.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/signature/BatchWriteReadIT.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/signature/VersioningIT.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/utils/GenerateEncryptionVersioningFiles.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/utils/GenerateKeys.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/utils/GenerateRandomEntries.java create mode 100644 test/src/main/java/edu/mit/ll/pace/test/utils/GenerateSignatureVersioningFiles.java create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/accumulo.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Alice/DSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Alice/ECDSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Alice/RSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Alice/encryption.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Bob/DSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Bob/ECDSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Bob/RSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Bob/encryption.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Charlie/DSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Charlie/ECDSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Charlie/RSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Charlie/encryption.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Eve/DSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Eve/ECDSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Eve/RSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/keys/Eve/encryption.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/harness/users.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/all.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn1.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn2.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn3.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn4.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn5.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumn6.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumnFamily1.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/fetchColumnFamily2.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/setRanges1.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/setRanges2.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/FilteringIT/setRanges3.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/config.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/.data.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/.encrypt-entry.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/.encrypt-value.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/.obfuscate-key.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/.searchable.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/data.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/encrypt-entry.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/encrypt-value.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/keys/encryption.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/obfuscate-key.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/data/searchable.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/encrypt-entry.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/encrypt-value.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/keys.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/obfuscate-key.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/1.0/searchable.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/VersioningIT/config.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/encrypt-value.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/obfuscate-key.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/encryption/searchable.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/DSA.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/ECDSA.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/RSA-PKCS1.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/RSA-PSS-colVis.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/RSA-PSS-separateTable.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/RSA-PSS.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/config.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.DSA.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.ECDSA.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.RSA-PKSC1.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.RSA-PSS-colVis.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.RSA-PSS-separateTable.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.RSA-PSS.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/.data.rf.crc create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/DSA.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/ECDSA.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/RSA-PKSC1.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/RSA-PSS-colVis.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/RSA-PSS-separateTable.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/RSA-PSS.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/data.rf create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/keys/DSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/keys/ECDSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/data/keys/RSA-signing.keys create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/1.0/keys.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/VersioningIT/config.json create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/config1.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/config2.ini create mode 100644 test/src/main/resources/edu/mit/ll/pace/test/signature/config3.ini create mode 100644 test/src/main/resources/log4j.properties diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..940dc27 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +# Copyright 2016 MIT Lincoln Laboratory +# +# Licensed under the Apache License, Version 2.0 (the "License")# +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Maven ignores +/target/ + +# IDE ignores +/.settings/ +/.project +/.classpath +/.pydevproject +/.idea +/*.iml +/nbproject/ +/nbactions.xml +/nb-configuration.xml diff --git a/DEPENDENCIES b/DEPENDENCIES new file mode 100644 index 0000000..d973e02 --- /dev/null +++ b/DEPENDENCIES @@ -0,0 +1,20 @@ + + +PACE depends on artifacts which can be found in Maven Central. + +Each module has its own dependencies. Please refer to the individual +modules' pom.xml files for a comprehensive listing. diff --git a/ENCRYPTION.md b/ENCRYPTION.md new file mode 100644 index 0000000..ec0bfaf --- /dev/null +++ b/ENCRYPTION.md @@ -0,0 +1,226 @@ + + +Confidentiality +--------------- + +The encryption code allows clients to encrypt data before storing it at the +server. This prevents that data from being read by the server administrator. +Additionally, it can be used to cryptographically enforce visibility labels. + +The encryption code is designed as a drop-in replacement for Accumulo's +BatchWriter and BatchScanner classes. It can be configured programmatically +or through the use of configuration files (preferred). Cryptographic keys +are provided by the developer (see [key management][key-management]). + +API +--- + +Classes for encryption functionality are found in `edu.mit.ll.pace.encryption`. + +#### `EncryptedBatchWriter` + +The encrypted batch writer is created similarly to a `BatchWriter`. After +creation, it is used identically to the Accumulo `BatchWriter`. + +```java +BatchWriter writer = new EncryptedBatchWriter( + instance.getConnector(), + TABLE_NAME, + batchWriterConfig, + encryptionConfig, + encryptionKeys); +``` + +#### `EncryptedBatchScanner` + +The encrypted batch scanner is created similarly to a `BatchScanner`. After +creation, it is used identically to the Accumulo `BatchScanner`. + +```java +BatchScanner scanner = new EncryptedBatchScanner( + instance.getConnector(), + TABLE_NAME, + authorizations, + numThreads, + encryptionConfig, + encryptionKeys); +``` + +Configuration +------------- + +The encryption configuration defines which fields will be encrypted, and with +which modes of operation. The encryption configuration of each field can be set +separately from the other fields. This configuration is given by an +`EncryptionConfig` object. These configuration objects can be created +programmatically or loaded from a configuration file. + +The configuration file is split into sections, one for each field that will +store encrypted data. The layout of these sections is as follows: + +```ini +[{row, columnFamily, columnQualifier, value}] +cipher = {AES_CTR, AES_CFB, AES_CBC, AES_OFB, AES_GCM, AES_SIV_DETERMINISTIC} +provider = {SunJCE,BC,...} +useVisibility = {true,false} +keyId = {keyId} +keyLength = {16, 24, 32, ...} +sources = {row, columnFamily, columnQualifier, columnVisibility, value} +``` + +##### Section Header +The section header defines which field will store the encrypted data. + +##### cipher +Dictates the algorithm, mode, and padding to use for encryption. The various +modes fall into the following +three categories: + +1. Semantically secure encryption—Encrypted data reveals no partial information +about the plaintext data (other than length). In particular, encryption does not +reveal equalities of plaintexts; for a given key, encrypting the same value +repeatedly will produce different ciphertexts. This prevents a server +administrator from detecting patterns in the data. +2. Authenticated encryption—In addition to providing confidentiality with +semantic security, authenticated encryption provides integrity and authenticity, +meaning that any unauthorized changes to the data will be detected. +3. Deterministic encryption—For a given key, encrypting the same value +repeatedly will always produce the same ciphertext. This allows for encrypted +data to be searched for server-side but also allows the server administrator to +detect patterns in the data (see https://cs.brown.edu/~seny/pubs/edb.pdf). +**For this reason, care should be taken when using this type of encryption**, +and it should only be used when the performance gains are more important than +the loss of security. + +The following ciphers are available for use in encryption. + +* **AES_CTR**—Semantically secure—Encrypts data using AES in CTR mode with no +padding. +* **AES_CFB**—Semantically secure—Encrypts data using AES in CFB mode with no +padding. +* **AES_CBC**—Semantically secure—Encrypts data using AES in CBC mode with PKCS5 + padding. +* **AES_OFB**—Semantically secure—Encrypts data using AES in OFB mode with no +padding. +* **AES_GCM**—Authenticated—Encrypts data using AES in GCM mode with no padding. +* **AES_SIV_DETERMINISTIC**—Deterministic—Encrypts data using AES in SIV mode +with no padding. + +If unsure, we recommend the use of AES_GCM. It is very important to note that +the GCM encryption key must be refreshed to limit the number of GCM encryptions +with a given key in order to prevent IV reuse; similarly for CTR mode. The NIST +recommendation (SP 800-38 D) is to limit the number of invocations of encryption +with GCM for any given key to 2^32. + +##### provider (Optional) +The Java cryptographic provider to use. If not set, will let the system decide +the appropriate cryptographic provider. + +##### useVisibility (Optional, default=false) +Whether to use encryption to enforce the column visibility field. If this is set +to true, only users that have encryption keys corresponding to the appropriate +labels in the column visibility field will be able to decrypt the data. For +example, if the visibility is `doctor | (nurse & admin)`, a user with only the +doctor attribute key will be able to decrypt the row, but a user with only the +nurse key (and neither the doctor key nor the admin key) will not be able to +decrypt. + +When writing data, there is currently a limitation that requires the client to +have keys for all labels in the visibility field. In the above example, the +user would need to have the doctor, nurse, **and** admin attribute keys to +encrypt the row. We are looking to address this limitation in future versions of +the code base. + +##### keyId (Optional, default=cipher) +An identifier for the keys used to encrypt the field. This value is passed to +the key management interface to specify which key to retrieve. If not set, will +use the value given in the cipher field. + +##### keyLength (Optional, default=16|32) +The length of the key to use for encryption, in bytes. This is one of {16, 24, +32} for non-deterministic encryption ciphers, and {32, 48, 64} for deterministic + encryption ciphers. If not set, will use the smallest appropriate key length. + +##### sources (Optional, default=section header) +The source of the data that should be encrypted into the field. If not set, the +encrypted data will be drawn from the same field as the encrypted. + +Example configurations +---------------------- + +Within the core library's jar resources there are three example configurations +(`edu/mit/ll/place/encryption`). +These demonstrate some configurations that should support a large number of use +cases. + +* **encrypt-value**—Encrypts the value using AES in GCM mode, with the +encryption cryptographically enforcing the column visibility. +* **encrypt-entry**—Encrypts each field in the entry (row, columnFamily, +columnQualifier, value) individually using AES in GCM mode, with the encryption +cryptographically enforcing the column visibility. +* **searchable**—Encrypts each field in the entry key (row, columnFamily, +columnQualifier) individually using AES in SIV mode (deterministic encryption), +with the encryption not being used to enforce column visibility. The value is +encrypted using AES in GCM mode, with the encryption cryptographically enforcing +the column visibility. Since the key is encrypted deterministically, the system +can still search for records server-side. + +Limitations +----------- + +1. If any field in the key is encrypted with non-deterministic encryption, +Accumulo versioning on the table will be broken. +1. If any field in the key is encrypted with non-deterministic encryption, it is +not possible for the `EncryptedBatchWriter` to delete values. Instead it is +necessary to delete keys using an `ItemProcessingIterator`: + ```java + EncryptedBatchScanner encryptedBatchScanner = ...; + BatchWriter writer = ...; + ItemProcessingIterator> iterator = encryptedBatchScanner.iterator(); + + while (iterator.hasNext()) { + if (isKeyToDelete(iterator.next())) { + Entry unprocessed = iterator.unprocessed(); + Mutation delete = new Mutation(unprocessed.getKey().getRow()); + delete.putDelete(unprocessed.getKey().getColumnFamily(), unprocessed.getKey().getColumnQualifier(), unprocessed.getKey().getColumnVisibilityParsed(), + unprocessed.getKey().getTimestamp()); + } + } + writer.close(); + ``` +1. If the entry key is encrypted deterministically and one of the encryption +keys is revoked—resulting in a new version of the encryption key—then entries +created with the new key will not version correctly with entries created with +the old key. Both sets of entries will show up in the scanner. +1. When attempting to filter results returned by `EncryptedBatchScanner`, if +possible, the filtering will happen server side. In several situations it is +necessary to still filter some of the data client side: + 1. If any of the search fields (e.g., row, column family) are encrypted + non-deterministially, than those field must be filtered client side. + 2. If a contents of a search field are encrypted into another field (e.g., + row encrypts both the row and column family, leaving the column family + zeroed out), then the field can only be filtered server side if the + encrypted field containing it is also part of the search (e.g., searching + using a range will work, but not searching using `fetchColumnFamily`). + 3. For a deterministically encrypted field, the search must be a single + value and not a range of values. Similarly, fields preceding the encrypted + field must be a single value and not a range of values. Fields after the + encrypted field can be searched over a range. (e.g., if the column family is + encrypted, you can only create ranges that have the same row and column + family, but the column qualifier can be multiple values.) + +[key-management]: KEY_MANAGEMENT.md diff --git a/EXAMPLES.md b/EXAMPLES.md new file mode 100644 index 0000000..a9d036f --- /dev/null +++ b/EXAMPLES.md @@ -0,0 +1,151 @@ + + +Examples +-------- +In the `examples/simple` module we have included several examples that show +how to use the PACE library for encryption and signatures: + +* Encryption + * GenerateEncryptionKeys—Demonstrates how encryption keys can be managed from + the command line. + * EncryptedReadWriteExample—Modified + `org.apache.accumulo.examples.simple.client.ReadWriteExample`; demonstrates + how to write, then read, encrypted data. + * EncryptedConverterExample—Converts an existing unencrypted table into an + encrypted table. +* Signature + * GenerateSignatureKeys—Demonstrates how signature keys can be managed from + the command line. + * SignedReadWriteExample—Modified + `org.apache.accumulo.examples.simple.client.ReadWriteExample`; demonstrates + how to write, then, read, signed data. + * SignedConverterExample—Converts an existing unsigned table into a signed + table. + +We describe below how to use these samples to generate keys, convert an existing +table to one that is signed/encrypted, and read data from that table. + +To prepare to run the following examples, first set up the environment as +follows: + +```bash +cd examples/simple +mvn clean compile +mkdir -p target/keys +``` + +Encryption +---------- + +### Key generation + +First we will generate three encryption keys and put them into a key store for +later use: + +1. An encryption key for AES_GCM. +2. An encryption key for AES_GCM when the visibility label is `secret`. +3. An encryption key for AES_GCM when the visibility label is `default`. + +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.GenerateEncryptionKeys -Dexec.args="--master-key-file target/keys/master.keys --write-master-key --key AES_GCM --key AES_GCM|secret --key AES_GCM|default --store target/keys/enc.keys" +``` + +The master secret file stores a randomly generated master secret that is used +in the generation of all encryption keys. The master secret file is needed in +order to generate more keys later. For example, the following command creates a +second encryption key store that has keys 1 and 3 from the first key store, but +not key 2. + +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.GenerateEncryptionKeys -Dexec.args="--master-key-file target/keys/master.keys --read-master-key --key AES_GCM --key AES_GCM|default --store target/keys/enc3.keys" +``` + +### Converting Data +First we will use an example from Accumulo to create data in a table: + +```bash +$ACCUMULO_HOME/bin/accumulo org.apache.accumulo.examples.simple.client.ReadWriteExample -i instance -z zookeepers -u user -p password --table test --createtable --create --auths secret,default +``` + +Now we will convert that data into encrypted form: +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.EncryptedConverterExample -Dexec.args="-i instance -z zookeepers -u user -p password --source test --destination test2 --createtable --encryption-config ../../core/src/main/resources/edu/mit/ll/pace/encryption/encrypt-value.ini --encryption-keys target/keys/enc.keys --auths secret,default" +``` + +In the Accumulo shell you can view the encrypted data: +```bash +table test2 +scan +``` + +### Reading Data +Next we will read the data in its unencrypted form: + +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.EncryptedReadWriteExample -Dexec.args="-i instance -z zookeepers -u user -p password --table test2 --read --encryption-config ../../core/src/main/resources/edu/mit/ll/pace/encryption/encrypt-value.ini --encryption-keys target/keys/enc.keys --auths secret,default" +``` + + +Signatures +---------- + +### Key generation + +First we will generate an RSA signature and verification keys for two users, +Alice and Bob. + +The following command will create a key store for Alice (containing Alice's +generated private and public RSA key): + +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.GenerateSignatureKeys -Dexec.args="--key Alice|RSA|2048 --key-dir target/keys --public-key-file target/keys/public.keys" +``` + +Later Bob's key store is created (containing Bob's generated public and private +keys, and Alice's public key). Alice's key store is also updated to included +Bob's public key: +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.GenerateSignatureKeys -Dexec.args="--key Bob|RSA|2048 --key-dir target/keys --public-key-file target/keys/public.keys --update" +``` + + +### Converting Data +First we will use an example from Accumulo to create data in a table: + +```bash +$ACCUMULO_HOME/bin/accumulo org.apache.accumulo.examples.simple.client.ReadWriteExample -i instance -z zookeepers -u user -p password --table test3 --createtable --create --auths secret,default +``` + +Now we will convert that data into signed form: +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.SignatureConverterExample -Dexec.args="-i instance -z zookeepers -u user -p password --source test3 --destination test4 --createtable --signature-config ../../core/src/main/resources/edu/mit/ll/pace/signature/rsa.ini --signature-keys target/keys/Alice_RSA.keys --auths secret,default" +``` + +In the Accumulo shell you can check that the data is signed: +```bash +table test4 +scan +``` + +### Reading Data +Next we will read the data, verifying its signature. We use Bob's key store to +demonstrate that different users can verify signatures, as long as they have the +appropriate public key. + +``` +mvn exec:java -Dexec.mainClass=edu.mit.ll.pace.examples.simple.SignedReadWriteExample -Dexec.args="-i instance -z zookeepers -u user -p password --table test4 --read --signature-config ../../core/src/main/resources/edu/mit/ll/pace/signature/rsa.ini --signature-keys target/keys/Bob_RSA.keys --auths secret,default" +``` diff --git a/KEY_MANAGEMENT.md b/KEY_MANAGEMENT.md new file mode 100644 index 0000000..5c62878 --- /dev/null +++ b/KEY_MANAGEMENT.md @@ -0,0 +1,39 @@ + + +Key Management +-------------- +In PACE there are two types of keys, symmetric encryption keys (e.g., AES) and +asymmetric signature keys (e.g., RSA). While PACE defines the structure of these +keys (e.g., key length) it is left to the developers to generate, distribute, +and manage the keys. + +While we plan to provide an example key management server +and client in the future, these are not currently implemented. In the meantime, +the [examples][examples], which provide basic key management operations, can be +used as templates to define your own key management framework. These +examples make use of locally stored key containers, which can be used +by importing the following artifact: + +```xml + + edu.mit.ll.pace + pace-keymanagement-common + 1.0.0 + +``` + +[examples]: EXAMPLES.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7d98e70 --- /dev/null +++ b/LICENSE @@ -0,0 +1,212 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016 MIT Lincoln Laboratory + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +********** + +PACE SUBCOMPONENTS: + +The PACE project contains subcomponents with separate copyright +notices and license terms. Your use of the source code for the these +subcomponents is subject to the terms and conditions of the following licenses. + +********** diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..f8d2258 --- /dev/null +++ b/NOTICE @@ -0,0 +1,2 @@ +MIT Lincoln Laboratory +Copyright 2016 MIT Lincoln Laboratory diff --git a/README.md b/README.md new file mode 100644 index 0000000..7a34ba4 --- /dev/null +++ b/README.md @@ -0,0 +1,177 @@ + + +[Proactively-secure Accumulo with Cryptographic Enforcement (PACE)][pace] +-- + +The [PACE][pace] library adds cryptographic protections to +[Apache Accumulo][accumulo], with the goal of protecting data from a potentially + malicious Accumulo server administrator. These include encrypting data + ([encryption]) and signing data ([signature]) stored in Accumulo. + +Installation +------------ + +To use PACE, include the core library as a maven dependency: + +```xml + + edu.mit.ll.pace + pace-core + 1.0.0 + +``` + +Documentation +------------- + +There are three main components to PACE: + +1. [Encryption][encryption]—Ensuring that data can be read by authorized +parties. +2. [Signatures][signature]—Ensuring that data can only be modified by authorized +parties. +3. [Key management][key-management]—Managing the cryptographic keys necessary +for encryption and signatures to function properly. + +Currently, developers can choose to either encrypt **or** sign data. In the +future, we plan to allow users to do both simultaneously. + +API +--- + +The public PACE API is composed of all public types in the following packages: + + * edu.mit.ll.pace + * edu.mit.ll.pace.encryption + * edu.mit.ll.pace.signature + * edu.mit.ll.pace.keymanagement.common + +A type is a class, interface, or enum. Anything with public or protected +acccess in an API type is in the API. This includes, but is not limited to: +methods, members, classes, interfaces, and enums. Package-private types in +the above packages are *not* considered public API. + +The PACE project maintains binary compatibility across this API within a +major release, as defined in the Java Language Specification 3rd ed. All +API changes will follow [semver 2.0][semver]. + +Examples +-------- +Example code can be found in the examples/simple project. The examples +demonstrate how to generate keys, read and write encrypted/signed data, and +migrate existing tables to use PACE. Descriptions of these examples can be found +in the [examples README][examples]. + +Building +-------- + +Accumulo uses [Maven] to compile, test, and package its source. + +In addition to the standard Maven lifecycle, the following commands are +supported: + +* **apilyzer:analyze**—Analyze the public PACE API, ensuring that it is +[well structured][apilyzer]. +* **cobertura:cobertura**–Generates test coverage report in the site directory. +* **javadoc:javadoc**–Generates JavaDoc for the PACE project. + +Future Work +----------- +* Key Management—While the [example code][examples] demonstrates how to manually +maintain cryptographic keys, it is not automated, nor does it scale well. +In the future, we plan to add a key management client and server that will +simplify the process of key management. + +Troubleshooting +--------------- +If you get an `InvalidKeyException: Illegal key size or default parameters` +message, you most likely need to install the Java Cryptography Extension +(JCE) Unlimited Strength Jurisdiction Policy Files. They can be found on +Oracle's website. + +Export Control +-------------- + +This distribution includes cryptographic software. The country in which you +currently reside may have restrictions on the import, possession, use, and/or +re-export to another country, of encryption software. BEFORE using any +encryption software, please check your country's laws, regulations and +policies concerning the import, possession, or use, and re-export of encryption +software, to see if this is permitted. See for more +information. + + + +The following provides more details on the included cryptographic software: + +PACE uses the built-in Java cryptography libraries in its +encryption implementation. See [Oracle's export-regulations doc][java-export] +for more details on Java's cryptography features. Apache Accumulo also uses +the Bouncy Castle library for some cryptographic technology as well. See +[the Bouncy Castle FAQ][bouncy-faq] for +more details on Bouncy Castle's cryptography features. + +Distribution Statement +---------------------- + +DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited. + +This material is based upon work supported by the Department of Defense under Air Force Contract No. FA8721-05-C-0002 and/or FA8702-15-D-0001. Any opinions, findings, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Department of Defense. + +© 2017 Massachusetts Institute of Technology. + +The software/firmware is provided to you on an As-Is basis + +Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. + +License +------- +Copyright 2017 MIT Lincoln Laboratory + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +[pace]: https://github.com/mit-ll/pace +[accumulo]: https://accumulo.apache.org +[encryption]: ENCRYPTION.md +[signature]: SIGNATURE.md +[examples]: EXAMPLES.md +[key-management]: KEY_MANAGEMENT.md +[Maven]: https://maven.apache.org +[semver]: http://semver.org/spec/v2.0.0 +[java-export]: http://www.oracle.com/us/products/export/export-regulations-345813.html +[bouncy-faq]: http://www.bouncycastle.org/wiki/display/JA1/Frequently+Asked+Questions +[apache]: http://www.apache.org/licenses/ +[apilyzer]: https://github.com/revelc/apilyzer-maven-plugin diff --git a/SIGNATURE.md b/SIGNATURE.md new file mode 100644 index 0000000..5ac3851 --- /dev/null +++ b/SIGNATURE.md @@ -0,0 +1,173 @@ + + +Integrity +--------- + +The signature code allows clients to sign data before storing it at the server. +This prevents data from being modified by the server administrator. + +The signature code is designed as a drop-in replacement for Accumulo's +BatchWriter, BatchScanner, and Scanner classes. It can be configured +programmatically or through the use of configuration files (preferred). +Cryptographic keys are provided by the developer (see +[key management][key-management]). + +API +--- + +Classes for signature functionality are found in +`edu.mit.ll.pace.signature`. + +#### `SignedBatchWriter` + +The signed batch writer is created similarly to a `BatchWriter`. After creation, +it is used identically to the Accumulo `BatchWriter`. + +```java +BatchWriter writer = new SignedBatchWriter( + instance.getConnector(), + TABLE_NAME, + batchWriterConfig, + signatureConfig, + signatureKey); +``` + +#### `SignedBatchScanner` + +The signed batch scanner is created similarly to a `BatchScanner`. After +creation, it is used identically to the Accumulo `BatchScanner`. + +```java +BatchScanner scanner = new SignedBatchScanner( + instance.getConnector(), + TABLE_NAME, + authorizations, + numThreads, + signatureConfig, + verificationKeys); +``` + +#### `SignedScanner` + +The signed batch scanner is created similarly to a `Scanner`. After creation, +it is used identically to the Accumulo `Scanner`. + +```java +Scanner scanner = new SignedScanner( + instance.getConnector(), + TABLE_NAME, + authorizations, + signatureConfig, + verificationKeys); +``` + +Configuration +------------- + +The configuration for the signature code is given by a `SignatureConfig` object. +This configuration object can be created programmatically or loaded from a +configuration file. + +The configuration files specify the signature algorithm that will be used to +sign entries. + +```ini +[Signature] +algorithm = {RSA-PKCS1,RSA-PSS,DSA,ECDSA} +provider = {SunJCE,BC,...} +``` + +Example config files can be found in the resources folder +(`edu.mit.ll.pace.signature`). + +#### algorithm +Dictates the algorithm to use for signing and verifying records. The following +algorithms are available for signing and verifying data. + +* **RSA-PKCS1**–RSA signature using the old PKCS #1 v1.5 padding. +* **RSA-PSS**–RSA signature using the more modern PSS padding scheme. +* **DSA**—DSA signature. +* **ECDSA**—ECDSA signature. + +All algorithms sign the SHA256 hash of the data. BouncyCastle is required for +using RSA-PSS and DSA. + +##### provider (Optional) +The Java cryptographic provider to use. If not set, will let the system decide +the appropriate cryptographic provider. + +Compatibility Options (Use with Care) +------------------------------------- + +By default, the signature is stored in the value field. When using the PACE +classes, this signature is verified and stripped before the value is returned. +In some cases, it may be necessary to sign data, while still allowing older, +non-PACE aware clients to continue accessing the data. In this case, we have +provided two alternative locations to store the signature. + +##### Storing signatures in the columnVisibility field +The signature can be stored in the column visibility field by adding it as a +disjunctive clause (i.e., `(originalVisibility)|encodedSignature`). This is +done by adding the following two lines to the configuration file: + +```ini +[Signature] +destination = colVis +defaultVisibility = ... +``` + +As with the default behavior, PACE clients will strip the signature from the +column visibility field before returning the data. Non-PACE aware clients will +see the signature, but will ignore it as it will be a visibility label for which +no user will have access. + +The `defaultVisibility` option specifies what the default visibility field is +for the table where signatures will be stored. This is used when the entry being + signed has an empty visibility field. + +**Limitations:** + +1. Storing signatures in the column visibility field breaks versioning. As such, +it should only be used with tables that do not rely on Accumulo to version +entries. +2. The `SignedBatchWriter` is unable to delete entries when the signature is +stored in the column visibility field. + +##### Storing signatures in a separate table +The signature can also be stored in a separate table. This is done by adding the +following two lines to the configuration file: + +```ini +destination = table +table = ... +``` + +In this case, signatures are stored in a second, duplicate table, where the +values are replaced with signatures. The name of this second table is given in +the configuration. + +**Limitations:** + +1. This approach is much slower. First, it requires two tables to be scanned. +Second, if the data in the two tables is retrieved out of order +(i.e., batch scanning), an internal copy of all signatures that have not yet +been matched must be kept, increasing the memory requirements. +2. This option requires that both tables are versioned, and cannot be used if +versioning is disabled. + + +[key-management]: KEY_MANAGEMENT.md diff --git a/contrib/Eclipse-Accumulo-Codestyle.xml b/contrib/Eclipse-Accumulo-Codestyle.xml new file mode 100644 index 0000000..d91dfe6 --- /dev/null +++ b/contrib/Eclipse-Accumulo-Codestyle.xml @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/Eclipse-Accumulo-Template.xml b/contrib/Eclipse-Accumulo-Template.xml new file mode 100644 index 0000000..aafaab8 --- /dev/null +++ b/contrib/Eclipse-Accumulo-Template.xml @@ -0,0 +1,107 @@ + + + + + + + + +