diff --git a/include/axolotl/account.hh b/include/axolotl/account.hh
index 54d96c35735374c3a7bf5f2529cf6c30222fb8ec..54621fd643eb0d37aa86d23ad943ed0354e2a169 100644
--- a/include/axolotl/account.hh
+++ b/include/axolotl/account.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef AXOLOTL_ACCOUNT_HH_
 #define AXOLOTL_ACCOUNT_HH_
 
diff --git a/include/axolotl/axolotl.hh b/include/axolotl/axolotl.hh
index 75c5eb5b1093f0a814f8f8378bef36ad380de8ee..4e8516ac8cb1e27f5b8d73469ebee4e6c980f663 100644
--- a/include/axolotl/axolotl.hh
+++ b/include/axolotl/axolotl.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef AXOLOTL_HH_
 #define AXOLOTL_HH_
 
diff --git a/include/axolotl/base64.hh b/include/axolotl/base64.hh
index c32264009037fe6d6258706e555b4a57fd2c8740..361a558169000054b4f71e68ef7dc5dca012c1d8 100644
--- a/include/axolotl/base64.hh
+++ b/include/axolotl/base64.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef AXOLOLT_BASE64_HH_
 #define AXOLOLT_BASE64_HH_
 
diff --git a/include/axolotl/error.hh b/include/axolotl/error.hh
index b875784000e9ed85d7523dd437907710bc7374a6..781705e8550e9e5e2ce2d1a06b9dcecf84f182d6 100644
--- a/include/axolotl/error.hh
+++ b/include/axolotl/error.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef ERROR_HH_
 #define ERROR_HH_
 
diff --git a/include/axolotl/memory.hh b/include/axolotl/memory.hh
index 8313a19a87d8b2981c83fef3323675eb78286498..68b577d55c284bc037e75cdc4076d11a8e90dfae 100644
--- a/include/axolotl/memory.hh
+++ b/include/axolotl/memory.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include <cstddef>
 #include <cstdint>
 
diff --git a/include/axolotl/pickle.hh b/include/axolotl/pickle.hh
index a2de4f0b2e3e9d3545acdee71b0d744c7bac4853..813497196a6be335acb4f302549ba1a42d4a74f6 100644
--- a/include/axolotl/pickle.hh
+++ b/include/axolotl/pickle.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef AXOLOTL_PICKLE_HH_
 #define AXOLOTL_PICKLE_HH_
 
diff --git a/include/axolotl/session.hh b/include/axolotl/session.hh
index aeaac7d767dd596637479570e3ec0d97f940552b..17f16536e5225b40b0b58e83afffab4387b1172a 100644
--- a/include/axolotl/session.hh
+++ b/include/axolotl/session.hh
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #ifndef AXOLOTL_SESSION_HH_
 #define AXOLOTL_SESSION_HH_
 
diff --git a/src/account.cpp b/src/account.cpp
index 95bafa8d530e31a4c0134cdb2777a26e8ab9404c..31243128e85e02f74b3d1bad632a6d79a474bcb7 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/account.hh"
 #include "axolotl/pickle.hh"
 
diff --git a/src/axolotl.cpp b/src/axolotl.cpp
index f03a01cda88d2992bcedad88193e0aba61d4595f..2586204f105871705d491fbb48d76d2f1a2c22a2 100644
--- a/src/axolotl.cpp
+++ b/src/axolotl.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/axolotl.hh"
 #include "axolotl/session.hh"
 #include "axolotl/account.hh"
@@ -349,7 +363,7 @@ size_t axolotl_account_identity_keys(
     AxolotlAccount * account,
     void * identity_keys, size_t identity_key_length
 ) {
-    std::size_t length = OUTPUT_KEY_LENGTH * 2 + 1;
+    std::size_t length = axolotl_account_identity_keys_length(account);
     if (identity_key_length < length) {
         from_c(account)->last_error =
             axolotl::ErrorCode::OUTPUT_BUFFER_TOO_SMALL;
diff --git a/src/base64.cpp b/src/base64.cpp
index 6428424e7f6e8f252452125ef57f84533df612d9..6fafa44f2de518ace0fd1de4e744d5aab3288645 100644
--- a/src/base64.cpp
+++ b/src/base64.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/base64.hh"
 
 
diff --git a/src/cipher.cpp b/src/cipher.cpp
index 8b496dff60c7b00249f3fd9c321bf7284ec930c3..2d700b1955771093ec1dee524f28002a7d5b5379 100644
--- a/src/cipher.cpp
+++ b/src/cipher.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/cipher.hh"
 #include "axolotl/crypto.hh"
 #include "axolotl/memory.hh"
diff --git a/src/memory.cpp b/src/memory.cpp
index 07e8de2f7524e38e507d63ba2a5513840c7a8e8d..deb30760d88840dc6cda12c01bbdfe10cb2dafc1 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/memory.hh"
 
 
diff --git a/src/pickle.cpp b/src/pickle.cpp
index 43ef49c55ae0d015cc56f98302c14456967c2f4f..15973263d4fda7abd93d3de2608edd0959ea04fe 100644
--- a/src/pickle.cpp
+++ b/src/pickle.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/pickle.hh"
 
 
diff --git a/src/session.cpp b/src/session.cpp
index 6d933269dcd4cebd806231dce8bd8b365a502061..7fb07e25448b343fe8d52d34160bdb54302e9c77 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -1,3 +1,17 @@
+/* Copyright 2015 OpenMarket Ltd
+ *
+ * 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.
+ */
 #include "axolotl/session.hh"
 #include "axolotl/cipher.hh"
 #include "axolotl/crypto.hh"