| | |
| | | static byte[] getInstanceKeyCertificateFromLocalTruststore() |
| | | throws CryptoManagerException { |
| | | // Construct the key entry DN. |
| | | final AttributeValue distinguishedValue = AttributeValues.create( |
| | | attrKeyID, ConfigConstants.ADS_CERTIFICATE_ALIAS); |
| | | final ByteString distinguishedValue = ByteString.valueOf(ConfigConstants.ADS_CERTIFICATE_ALIAS); |
| | | final DN entryDN = localTruststoreDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | // Construct the search filter. |
| | |
| | | final String instanceKeyID |
| | | = getInstanceKeyID(instanceKeyCertificate); |
| | | // Construct the key entry DN. |
| | | final AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, instanceKeyID); |
| | | final ByteString distinguishedValue = ByteString.valueOf(instanceKeyID); |
| | | final DN entryDN = instanceKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | // Construct the search filter. |
| | |
| | | // Add the key ID attribute. |
| | | final Attribute keyIDAttr = Attributes.create(attrKeyID, |
| | | distinguishedValue); |
| | | entry.addAttribute(keyIDAttr, new ArrayList<AttributeValue>(0)); |
| | | entry.addAttribute(keyIDAttr, new ArrayList<ByteString>(0)); |
| | | |
| | | // Add the public key certificate attribute. |
| | | AttributeBuilder builder = new AttributeBuilder( |
| | | attrPublicKeyCertificate); |
| | | builder.setOption("binary"); |
| | | builder.add(AttributeValues.create( |
| | | attrPublicKeyCertificate, |
| | | ByteString.wrap(instanceKeyCertificate))); |
| | | builder.add(ByteString.wrap(instanceKeyCertificate)); |
| | | final Attribute certificateAttr = builder.toAttribute(); |
| | | entry.addAttribute(certificateAttr, |
| | | new ArrayList<AttributeValue>(0)); |
| | | entry.addAttribute(certificateAttr, new ArrayList<ByteString>(0)); |
| | | |
| | | AddOperation addOperation = icc.processAdd(entry.getName(), |
| | | entry.getObjectClasses(), |
| | |
| | | String value) |
| | | { |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(Attributes.create(type, AttributeValues.create(type, value))); |
| | | attrList.add(Attributes.create(type, value)); |
| | | attrs.put(type, attrList); |
| | | } |
| | | |
| | |
| | | throws CryptoManagerException |
| | | { |
| | | // Construct the key entry DN. |
| | | AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, |
| | | keyEntry.getKeyID().getStringValue()); |
| | | ByteString distinguishedValue = |
| | | ByteString.valueOf(keyEntry.getKeyID().getStringValue()); |
| | | DN entryDN = secretKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | |
| | | String symmetricKey = cryptoManager.encodeSymmetricKeyAttribute( |
| | | mapEntry.getKey(), mapEntry.getValue(), keyEntry.getSecretKey()); |
| | | |
| | | builder.add(AttributeValues.create(attrSymmetricKey, symmetricKey)); |
| | | builder.add(symmetricKey); |
| | | } |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | |
| | | throws CryptoManagerException |
| | | { |
| | | // Construct the key entry DN. |
| | | AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, |
| | | keyEntry.getKeyID().getStringValue()); |
| | | ByteString distinguishedValue = |
| | | ByteString.valueOf(keyEntry.getKeyID().getStringValue()); |
| | | DN entryDN = secretKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | |
| | | mapEntry.getKey(), |
| | | mapEntry.getValue(), |
| | | keyEntry.getSecretKey()); |
| | | |
| | | builder.add( |
| | | AttributeValues.create(attrSymmetricKey, symmetricKey)); |
| | | builder.add(symmetricKey); |
| | | } |
| | | |
| | | attrList = new ArrayList<Attribute>(1); |