/core/src/main/java/org/bitcoinj/wallet/Protos.java

https://code.google.com/ · Java · 12763 lines · 8241 code · 597 blank · 3925 comment · 1364 complexity · b3df529ded99ef4f09f75f868c89ba96 MD5 · raw file

Large files are truncated click here to view the full file

  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: bitcoin.proto
  3. package org.bitcoinj.wallet;
  4. public final class Protos {
  5. private Protos() {}
  6. public static void registerAllExtensions(
  7. com.google.protobuf.ExtensionRegistry registry) {
  8. }
  9. public interface PeerAddressOrBuilder
  10. extends com.google.protobuf.MessageOrBuilder {
  11. // required bytes ip_address = 1;
  12. /**
  13. * <code>required bytes ip_address = 1;</code>
  14. */
  15. boolean hasIpAddress();
  16. /**
  17. * <code>required bytes ip_address = 1;</code>
  18. */
  19. com.google.protobuf.ByteString getIpAddress();
  20. // required uint32 port = 2;
  21. /**
  22. * <code>required uint32 port = 2;</code>
  23. */
  24. boolean hasPort();
  25. /**
  26. * <code>required uint32 port = 2;</code>
  27. */
  28. int getPort();
  29. // required uint64 services = 3;
  30. /**
  31. * <code>required uint64 services = 3;</code>
  32. */
  33. boolean hasServices();
  34. /**
  35. * <code>required uint64 services = 3;</code>
  36. */
  37. long getServices();
  38. }
  39. /**
  40. * Protobuf type {@code wallet.PeerAddress}
  41. */
  42. public static final class PeerAddress extends
  43. com.google.protobuf.GeneratedMessage
  44. implements PeerAddressOrBuilder {
  45. // Use PeerAddress.newBuilder() to construct.
  46. private PeerAddress(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
  47. super(builder);
  48. this.unknownFields = builder.getUnknownFields();
  49. }
  50. private PeerAddress(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
  51. private static final PeerAddress defaultInstance;
  52. public static PeerAddress getDefaultInstance() {
  53. return defaultInstance;
  54. }
  55. public PeerAddress getDefaultInstanceForType() {
  56. return defaultInstance;
  57. }
  58. private final com.google.protobuf.UnknownFieldSet unknownFields;
  59. @java.lang.Override
  60. public final com.google.protobuf.UnknownFieldSet
  61. getUnknownFields() {
  62. return this.unknownFields;
  63. }
  64. private PeerAddress(
  65. com.google.protobuf.CodedInputStream input,
  66. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  67. throws com.google.protobuf.InvalidProtocolBufferException {
  68. initFields();
  69. int mutable_bitField0_ = 0;
  70. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  71. com.google.protobuf.UnknownFieldSet.newBuilder();
  72. try {
  73. boolean done = false;
  74. while (!done) {
  75. int tag = input.readTag();
  76. switch (tag) {
  77. case 0:
  78. done = true;
  79. break;
  80. default: {
  81. if (!parseUnknownField(input, unknownFields,
  82. extensionRegistry, tag)) {
  83. done = true;
  84. }
  85. break;
  86. }
  87. case 10: {
  88. bitField0_ |= 0x00000001;
  89. ipAddress_ = input.readBytes();
  90. break;
  91. }
  92. case 16: {
  93. bitField0_ |= 0x00000002;
  94. port_ = input.readUInt32();
  95. break;
  96. }
  97. case 24: {
  98. bitField0_ |= 0x00000004;
  99. services_ = input.readUInt64();
  100. break;
  101. }
  102. }
  103. }
  104. } catch (com.google.protobuf.InvalidProtocolBufferException e) {
  105. throw e.setUnfinishedMessage(this);
  106. } catch (java.io.IOException e) {
  107. throw new com.google.protobuf.InvalidProtocolBufferException(
  108. e.getMessage()).setUnfinishedMessage(this);
  109. } finally {
  110. this.unknownFields = unknownFields.build();
  111. makeExtensionsImmutable();
  112. }
  113. }
  114. public static final com.google.protobuf.Descriptors.Descriptor
  115. getDescriptor() {
  116. return org.bitcoinj.wallet.Protos.internal_static_wallet_PeerAddress_descriptor;
  117. }
  118. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  119. internalGetFieldAccessorTable() {
  120. return org.bitcoinj.wallet.Protos.internal_static_wallet_PeerAddress_fieldAccessorTable
  121. .ensureFieldAccessorsInitialized(
  122. org.bitcoinj.wallet.Protos.PeerAddress.class, org.bitcoinj.wallet.Protos.PeerAddress.Builder.class);
  123. }
  124. public static com.google.protobuf.Parser<PeerAddress> PARSER =
  125. new com.google.protobuf.AbstractParser<PeerAddress>() {
  126. public PeerAddress parsePartialFrom(
  127. com.google.protobuf.CodedInputStream input,
  128. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  129. throws com.google.protobuf.InvalidProtocolBufferException {
  130. return new PeerAddress(input, extensionRegistry);
  131. }
  132. };
  133. @java.lang.Override
  134. public com.google.protobuf.Parser<PeerAddress> getParserForType() {
  135. return PARSER;
  136. }
  137. private int bitField0_;
  138. // required bytes ip_address = 1;
  139. public static final int IP_ADDRESS_FIELD_NUMBER = 1;
  140. private com.google.protobuf.ByteString ipAddress_;
  141. /**
  142. * <code>required bytes ip_address = 1;</code>
  143. */
  144. public boolean hasIpAddress() {
  145. return ((bitField0_ & 0x00000001) == 0x00000001);
  146. }
  147. /**
  148. * <code>required bytes ip_address = 1;</code>
  149. */
  150. public com.google.protobuf.ByteString getIpAddress() {
  151. return ipAddress_;
  152. }
  153. // required uint32 port = 2;
  154. public static final int PORT_FIELD_NUMBER = 2;
  155. private int port_;
  156. /**
  157. * <code>required uint32 port = 2;</code>
  158. */
  159. public boolean hasPort() {
  160. return ((bitField0_ & 0x00000002) == 0x00000002);
  161. }
  162. /**
  163. * <code>required uint32 port = 2;</code>
  164. */
  165. public int getPort() {
  166. return port_;
  167. }
  168. // required uint64 services = 3;
  169. public static final int SERVICES_FIELD_NUMBER = 3;
  170. private long services_;
  171. /**
  172. * <code>required uint64 services = 3;</code>
  173. */
  174. public boolean hasServices() {
  175. return ((bitField0_ & 0x00000004) == 0x00000004);
  176. }
  177. /**
  178. * <code>required uint64 services = 3;</code>
  179. */
  180. public long getServices() {
  181. return services_;
  182. }
  183. private void initFields() {
  184. ipAddress_ = com.google.protobuf.ByteString.EMPTY;
  185. port_ = 0;
  186. services_ = 0L;
  187. }
  188. private byte memoizedIsInitialized = -1;
  189. public final boolean isInitialized() {
  190. byte isInitialized = memoizedIsInitialized;
  191. if (isInitialized != -1) return isInitialized == 1;
  192. if (!hasIpAddress()) {
  193. memoizedIsInitialized = 0;
  194. return false;
  195. }
  196. if (!hasPort()) {
  197. memoizedIsInitialized = 0;
  198. return false;
  199. }
  200. if (!hasServices()) {
  201. memoizedIsInitialized = 0;
  202. return false;
  203. }
  204. memoizedIsInitialized = 1;
  205. return true;
  206. }
  207. public void writeTo(com.google.protobuf.CodedOutputStream output)
  208. throws java.io.IOException {
  209. getSerializedSize();
  210. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  211. output.writeBytes(1, ipAddress_);
  212. }
  213. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  214. output.writeUInt32(2, port_);
  215. }
  216. if (((bitField0_ & 0x00000004) == 0x00000004)) {
  217. output.writeUInt64(3, services_);
  218. }
  219. getUnknownFields().writeTo(output);
  220. }
  221. private int memoizedSerializedSize = -1;
  222. public int getSerializedSize() {
  223. int size = memoizedSerializedSize;
  224. if (size != -1) return size;
  225. size = 0;
  226. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  227. size += com.google.protobuf.CodedOutputStream
  228. .computeBytesSize(1, ipAddress_);
  229. }
  230. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  231. size += com.google.protobuf.CodedOutputStream
  232. .computeUInt32Size(2, port_);
  233. }
  234. if (((bitField0_ & 0x00000004) == 0x00000004)) {
  235. size += com.google.protobuf.CodedOutputStream
  236. .computeUInt64Size(3, services_);
  237. }
  238. size += getUnknownFields().getSerializedSize();
  239. memoizedSerializedSize = size;
  240. return size;
  241. }
  242. private static final long serialVersionUID = 0L;
  243. @java.lang.Override
  244. protected java.lang.Object writeReplace()
  245. throws java.io.ObjectStreamException {
  246. return super.writeReplace();
  247. }
  248. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  249. com.google.protobuf.ByteString data)
  250. throws com.google.protobuf.InvalidProtocolBufferException {
  251. return PARSER.parseFrom(data);
  252. }
  253. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  254. com.google.protobuf.ByteString data,
  255. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  256. throws com.google.protobuf.InvalidProtocolBufferException {
  257. return PARSER.parseFrom(data, extensionRegistry);
  258. }
  259. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(byte[] data)
  260. throws com.google.protobuf.InvalidProtocolBufferException {
  261. return PARSER.parseFrom(data);
  262. }
  263. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  264. byte[] data,
  265. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  266. throws com.google.protobuf.InvalidProtocolBufferException {
  267. return PARSER.parseFrom(data, extensionRegistry);
  268. }
  269. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(java.io.InputStream input)
  270. throws java.io.IOException {
  271. return PARSER.parseFrom(input);
  272. }
  273. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  274. java.io.InputStream input,
  275. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  276. throws java.io.IOException {
  277. return PARSER.parseFrom(input, extensionRegistry);
  278. }
  279. public static org.bitcoinj.wallet.Protos.PeerAddress parseDelimitedFrom(java.io.InputStream input)
  280. throws java.io.IOException {
  281. return PARSER.parseDelimitedFrom(input);
  282. }
  283. public static org.bitcoinj.wallet.Protos.PeerAddress parseDelimitedFrom(
  284. java.io.InputStream input,
  285. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  286. throws java.io.IOException {
  287. return PARSER.parseDelimitedFrom(input, extensionRegistry);
  288. }
  289. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  290. com.google.protobuf.CodedInputStream input)
  291. throws java.io.IOException {
  292. return PARSER.parseFrom(input);
  293. }
  294. public static org.bitcoinj.wallet.Protos.PeerAddress parseFrom(
  295. com.google.protobuf.CodedInputStream input,
  296. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  297. throws java.io.IOException {
  298. return PARSER.parseFrom(input, extensionRegistry);
  299. }
  300. public static Builder newBuilder() { return Builder.create(); }
  301. public Builder newBuilderForType() { return newBuilder(); }
  302. public static Builder newBuilder(org.bitcoinj.wallet.Protos.PeerAddress prototype) {
  303. return newBuilder().mergeFrom(prototype);
  304. }
  305. public Builder toBuilder() { return newBuilder(this); }
  306. @java.lang.Override
  307. protected Builder newBuilderForType(
  308. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  309. Builder builder = new Builder(parent);
  310. return builder;
  311. }
  312. /**
  313. * Protobuf type {@code wallet.PeerAddress}
  314. */
  315. public static final class Builder extends
  316. com.google.protobuf.GeneratedMessage.Builder<Builder>
  317. implements org.bitcoinj.wallet.Protos.PeerAddressOrBuilder {
  318. public static final com.google.protobuf.Descriptors.Descriptor
  319. getDescriptor() {
  320. return org.bitcoinj.wallet.Protos.internal_static_wallet_PeerAddress_descriptor;
  321. }
  322. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  323. internalGetFieldAccessorTable() {
  324. return org.bitcoinj.wallet.Protos.internal_static_wallet_PeerAddress_fieldAccessorTable
  325. .ensureFieldAccessorsInitialized(
  326. org.bitcoinj.wallet.Protos.PeerAddress.class, org.bitcoinj.wallet.Protos.PeerAddress.Builder.class);
  327. }
  328. // Construct using org.bitcoinj.wallet.Protos.PeerAddress.newBuilder()
  329. private Builder() {
  330. maybeForceBuilderInitialization();
  331. }
  332. private Builder(
  333. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  334. super(parent);
  335. maybeForceBuilderInitialization();
  336. }
  337. private void maybeForceBuilderInitialization() {
  338. if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
  339. }
  340. }
  341. private static Builder create() {
  342. return new Builder();
  343. }
  344. public Builder clear() {
  345. super.clear();
  346. ipAddress_ = com.google.protobuf.ByteString.EMPTY;
  347. bitField0_ = (bitField0_ & ~0x00000001);
  348. port_ = 0;
  349. bitField0_ = (bitField0_ & ~0x00000002);
  350. services_ = 0L;
  351. bitField0_ = (bitField0_ & ~0x00000004);
  352. return this;
  353. }
  354. public Builder clone() {
  355. return create().mergeFrom(buildPartial());
  356. }
  357. public com.google.protobuf.Descriptors.Descriptor
  358. getDescriptorForType() {
  359. return org.bitcoinj.wallet.Protos.internal_static_wallet_PeerAddress_descriptor;
  360. }
  361. public org.bitcoinj.wallet.Protos.PeerAddress getDefaultInstanceForType() {
  362. return org.bitcoinj.wallet.Protos.PeerAddress.getDefaultInstance();
  363. }
  364. public org.bitcoinj.wallet.Protos.PeerAddress build() {
  365. org.bitcoinj.wallet.Protos.PeerAddress result = buildPartial();
  366. if (!result.isInitialized()) {
  367. throw newUninitializedMessageException(result);
  368. }
  369. return result;
  370. }
  371. public org.bitcoinj.wallet.Protos.PeerAddress buildPartial() {
  372. org.bitcoinj.wallet.Protos.PeerAddress result = new org.bitcoinj.wallet.Protos.PeerAddress(this);
  373. int from_bitField0_ = bitField0_;
  374. int to_bitField0_ = 0;
  375. if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
  376. to_bitField0_ |= 0x00000001;
  377. }
  378. result.ipAddress_ = ipAddress_;
  379. if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
  380. to_bitField0_ |= 0x00000002;
  381. }
  382. result.port_ = port_;
  383. if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
  384. to_bitField0_ |= 0x00000004;
  385. }
  386. result.services_ = services_;
  387. result.bitField0_ = to_bitField0_;
  388. onBuilt();
  389. return result;
  390. }
  391. public Builder mergeFrom(com.google.protobuf.Message other) {
  392. if (other instanceof org.bitcoinj.wallet.Protos.PeerAddress) {
  393. return mergeFrom((org.bitcoinj.wallet.Protos.PeerAddress)other);
  394. } else {
  395. super.mergeFrom(other);
  396. return this;
  397. }
  398. }
  399. public Builder mergeFrom(org.bitcoinj.wallet.Protos.PeerAddress other) {
  400. if (other == org.bitcoinj.wallet.Protos.PeerAddress.getDefaultInstance()) return this;
  401. if (other.hasIpAddress()) {
  402. setIpAddress(other.getIpAddress());
  403. }
  404. if (other.hasPort()) {
  405. setPort(other.getPort());
  406. }
  407. if (other.hasServices()) {
  408. setServices(other.getServices());
  409. }
  410. this.mergeUnknownFields(other.getUnknownFields());
  411. return this;
  412. }
  413. public final boolean isInitialized() {
  414. if (!hasIpAddress()) {
  415. return false;
  416. }
  417. if (!hasPort()) {
  418. return false;
  419. }
  420. if (!hasServices()) {
  421. return false;
  422. }
  423. return true;
  424. }
  425. public Builder mergeFrom(
  426. com.google.protobuf.CodedInputStream input,
  427. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  428. throws java.io.IOException {
  429. org.bitcoinj.wallet.Protos.PeerAddress parsedMessage = null;
  430. try {
  431. parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
  432. } catch (com.google.protobuf.InvalidProtocolBufferException e) {
  433. parsedMessage = (org.bitcoinj.wallet.Protos.PeerAddress) e.getUnfinishedMessage();
  434. throw e;
  435. } finally {
  436. if (parsedMessage != null) {
  437. mergeFrom(parsedMessage);
  438. }
  439. }
  440. return this;
  441. }
  442. private int bitField0_;
  443. // required bytes ip_address = 1;
  444. private com.google.protobuf.ByteString ipAddress_ = com.google.protobuf.ByteString.EMPTY;
  445. /**
  446. * <code>required bytes ip_address = 1;</code>
  447. */
  448. public boolean hasIpAddress() {
  449. return ((bitField0_ & 0x00000001) == 0x00000001);
  450. }
  451. /**
  452. * <code>required bytes ip_address = 1;</code>
  453. */
  454. public com.google.protobuf.ByteString getIpAddress() {
  455. return ipAddress_;
  456. }
  457. /**
  458. * <code>required bytes ip_address = 1;</code>
  459. */
  460. public Builder setIpAddress(com.google.protobuf.ByteString value) {
  461. if (value == null) {
  462. throw new NullPointerException();
  463. }
  464. bitField0_ |= 0x00000001;
  465. ipAddress_ = value;
  466. onChanged();
  467. return this;
  468. }
  469. /**
  470. * <code>required bytes ip_address = 1;</code>
  471. */
  472. public Builder clearIpAddress() {
  473. bitField0_ = (bitField0_ & ~0x00000001);
  474. ipAddress_ = getDefaultInstance().getIpAddress();
  475. onChanged();
  476. return this;
  477. }
  478. // required uint32 port = 2;
  479. private int port_ ;
  480. /**
  481. * <code>required uint32 port = 2;</code>
  482. */
  483. public boolean hasPort() {
  484. return ((bitField0_ & 0x00000002) == 0x00000002);
  485. }
  486. /**
  487. * <code>required uint32 port = 2;</code>
  488. */
  489. public int getPort() {
  490. return port_;
  491. }
  492. /**
  493. * <code>required uint32 port = 2;</code>
  494. */
  495. public Builder setPort(int value) {
  496. bitField0_ |= 0x00000002;
  497. port_ = value;
  498. onChanged();
  499. return this;
  500. }
  501. /**
  502. * <code>required uint32 port = 2;</code>
  503. */
  504. public Builder clearPort() {
  505. bitField0_ = (bitField0_ & ~0x00000002);
  506. port_ = 0;
  507. onChanged();
  508. return this;
  509. }
  510. // required uint64 services = 3;
  511. private long services_ ;
  512. /**
  513. * <code>required uint64 services = 3;</code>
  514. */
  515. public boolean hasServices() {
  516. return ((bitField0_ & 0x00000004) == 0x00000004);
  517. }
  518. /**
  519. * <code>required uint64 services = 3;</code>
  520. */
  521. public long getServices() {
  522. return services_;
  523. }
  524. /**
  525. * <code>required uint64 services = 3;</code>
  526. */
  527. public Builder setServices(long value) {
  528. bitField0_ |= 0x00000004;
  529. services_ = value;
  530. onChanged();
  531. return this;
  532. }
  533. /**
  534. * <code>required uint64 services = 3;</code>
  535. */
  536. public Builder clearServices() {
  537. bitField0_ = (bitField0_ & ~0x00000004);
  538. services_ = 0L;
  539. onChanged();
  540. return this;
  541. }
  542. // @@protoc_insertion_point(builder_scope:wallet.PeerAddress)
  543. }
  544. static {
  545. defaultInstance = new PeerAddress(true);
  546. defaultInstance.initFields();
  547. }
  548. // @@protoc_insertion_point(class_scope:wallet.PeerAddress)
  549. }
  550. public interface EncryptedPrivateKeyOrBuilder
  551. extends com.google.protobuf.MessageOrBuilder {
  552. // required bytes initialisation_vector = 1;
  553. /**
  554. * <code>required bytes initialisation_vector = 1;</code>
  555. *
  556. * <pre>
  557. * The initialisation vector for the AES encryption (16 bytes)
  558. * </pre>
  559. */
  560. boolean hasInitialisationVector();
  561. /**
  562. * <code>required bytes initialisation_vector = 1;</code>
  563. *
  564. * <pre>
  565. * The initialisation vector for the AES encryption (16 bytes)
  566. * </pre>
  567. */
  568. com.google.protobuf.ByteString getInitialisationVector();
  569. // required bytes encrypted_private_key = 2;
  570. /**
  571. * <code>required bytes encrypted_private_key = 2;</code>
  572. *
  573. * <pre>
  574. * The encrypted private key
  575. * </pre>
  576. */
  577. boolean hasEncryptedPrivateKey();
  578. /**
  579. * <code>required bytes encrypted_private_key = 2;</code>
  580. *
  581. * <pre>
  582. * The encrypted private key
  583. * </pre>
  584. */
  585. com.google.protobuf.ByteString getEncryptedPrivateKey();
  586. }
  587. /**
  588. * Protobuf type {@code wallet.EncryptedPrivateKey}
  589. *
  590. * <pre>
  591. **
  592. * The data to store a private key encrypted with Scrypt and AES
  593. * </pre>
  594. */
  595. public static final class EncryptedPrivateKey extends
  596. com.google.protobuf.GeneratedMessage
  597. implements EncryptedPrivateKeyOrBuilder {
  598. // Use EncryptedPrivateKey.newBuilder() to construct.
  599. private EncryptedPrivateKey(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
  600. super(builder);
  601. this.unknownFields = builder.getUnknownFields();
  602. }
  603. private EncryptedPrivateKey(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
  604. private static final EncryptedPrivateKey defaultInstance;
  605. public static EncryptedPrivateKey getDefaultInstance() {
  606. return defaultInstance;
  607. }
  608. public EncryptedPrivateKey getDefaultInstanceForType() {
  609. return defaultInstance;
  610. }
  611. private final com.google.protobuf.UnknownFieldSet unknownFields;
  612. @java.lang.Override
  613. public final com.google.protobuf.UnknownFieldSet
  614. getUnknownFields() {
  615. return this.unknownFields;
  616. }
  617. private EncryptedPrivateKey(
  618. com.google.protobuf.CodedInputStream input,
  619. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  620. throws com.google.protobuf.InvalidProtocolBufferException {
  621. initFields();
  622. int mutable_bitField0_ = 0;
  623. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  624. com.google.protobuf.UnknownFieldSet.newBuilder();
  625. try {
  626. boolean done = false;
  627. while (!done) {
  628. int tag = input.readTag();
  629. switch (tag) {
  630. case 0:
  631. done = true;
  632. break;
  633. default: {
  634. if (!parseUnknownField(input, unknownFields,
  635. extensionRegistry, tag)) {
  636. done = true;
  637. }
  638. break;
  639. }
  640. case 10: {
  641. bitField0_ |= 0x00000001;
  642. initialisationVector_ = input.readBytes();
  643. break;
  644. }
  645. case 18: {
  646. bitField0_ |= 0x00000002;
  647. encryptedPrivateKey_ = input.readBytes();
  648. break;
  649. }
  650. }
  651. }
  652. } catch (com.google.protobuf.InvalidProtocolBufferException e) {
  653. throw e.setUnfinishedMessage(this);
  654. } catch (java.io.IOException e) {
  655. throw new com.google.protobuf.InvalidProtocolBufferException(
  656. e.getMessage()).setUnfinishedMessage(this);
  657. } finally {
  658. this.unknownFields = unknownFields.build();
  659. makeExtensionsImmutable();
  660. }
  661. }
  662. public static final com.google.protobuf.Descriptors.Descriptor
  663. getDescriptor() {
  664. return org.bitcoinj.wallet.Protos.internal_static_wallet_EncryptedPrivateKey_descriptor;
  665. }
  666. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  667. internalGetFieldAccessorTable() {
  668. return org.bitcoinj.wallet.Protos.internal_static_wallet_EncryptedPrivateKey_fieldAccessorTable
  669. .ensureFieldAccessorsInitialized(
  670. org.bitcoinj.wallet.Protos.EncryptedPrivateKey.class, org.bitcoinj.wallet.Protos.EncryptedPrivateKey.Builder.class);
  671. }
  672. public static com.google.protobuf.Parser<EncryptedPrivateKey> PARSER =
  673. new com.google.protobuf.AbstractParser<EncryptedPrivateKey>() {
  674. public EncryptedPrivateKey parsePartialFrom(
  675. com.google.protobuf.CodedInputStream input,
  676. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  677. throws com.google.protobuf.InvalidProtocolBufferException {
  678. return new EncryptedPrivateKey(input, extensionRegistry);
  679. }
  680. };
  681. @java.lang.Override
  682. public com.google.protobuf.Parser<EncryptedPrivateKey> getParserForType() {
  683. return PARSER;
  684. }
  685. private int bitField0_;
  686. // required bytes initialisation_vector = 1;
  687. public static final int INITIALISATION_VECTOR_FIELD_NUMBER = 1;
  688. private com.google.protobuf.ByteString initialisationVector_;
  689. /**
  690. * <code>required bytes initialisation_vector = 1;</code>
  691. *
  692. * <pre>
  693. * The initialisation vector for the AES encryption (16 bytes)
  694. * </pre>
  695. */
  696. public boolean hasInitialisationVector() {
  697. return ((bitField0_ & 0x00000001) == 0x00000001);
  698. }
  699. /**
  700. * <code>required bytes initialisation_vector = 1;</code>
  701. *
  702. * <pre>
  703. * The initialisation vector for the AES encryption (16 bytes)
  704. * </pre>
  705. */
  706. public com.google.protobuf.ByteString getInitialisationVector() {
  707. return initialisationVector_;
  708. }
  709. // required bytes encrypted_private_key = 2;
  710. public static final int ENCRYPTED_PRIVATE_KEY_FIELD_NUMBER = 2;
  711. private com.google.protobuf.ByteString encryptedPrivateKey_;
  712. /**
  713. * <code>required bytes encrypted_private_key = 2;</code>
  714. *
  715. * <pre>
  716. * The encrypted private key
  717. * </pre>
  718. */
  719. public boolean hasEncryptedPrivateKey() {
  720. return ((bitField0_ & 0x00000002) == 0x00000002);
  721. }
  722. /**
  723. * <code>required bytes encrypted_private_key = 2;</code>
  724. *
  725. * <pre>
  726. * The encrypted private key
  727. * </pre>
  728. */
  729. public com.google.protobuf.ByteString getEncryptedPrivateKey() {
  730. return encryptedPrivateKey_;
  731. }
  732. private void initFields() {
  733. initialisationVector_ = com.google.protobuf.ByteString.EMPTY;
  734. encryptedPrivateKey_ = com.google.protobuf.ByteString.EMPTY;
  735. }
  736. private byte memoizedIsInitialized = -1;
  737. public final boolean isInitialized() {
  738. byte isInitialized = memoizedIsInitialized;
  739. if (isInitialized != -1) return isInitialized == 1;
  740. if (!hasInitialisationVector()) {
  741. memoizedIsInitialized = 0;
  742. return false;
  743. }
  744. if (!hasEncryptedPrivateKey()) {
  745. memoizedIsInitialized = 0;
  746. return false;
  747. }
  748. memoizedIsInitialized = 1;
  749. return true;
  750. }
  751. public void writeTo(com.google.protobuf.CodedOutputStream output)
  752. throws java.io.IOException {
  753. getSerializedSize();
  754. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  755. output.writeBytes(1, initialisationVector_);
  756. }
  757. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  758. output.writeBytes(2, encryptedPrivateKey_);
  759. }
  760. getUnknownFields().writeTo(output);
  761. }
  762. private int memoizedSerializedSize = -1;
  763. public int getSerializedSize() {
  764. int size = memoizedSerializedSize;
  765. if (size != -1) return size;
  766. size = 0;
  767. if (((bitField0_ & 0x00000001) == 0x00000001)) {
  768. size += com.google.protobuf.CodedOutputStream
  769. .computeBytesSize(1, initialisationVector_);
  770. }
  771. if (((bitField0_ & 0x00000002) == 0x00000002)) {
  772. size += com.google.protobuf.CodedOutputStream
  773. .computeBytesSize(2, encryptedPrivateKey_);
  774. }
  775. size += getUnknownFields().getSerializedSize();
  776. memoizedSerializedSize = size;
  777. return size;
  778. }
  779. private static final long serialVersionUID = 0L;
  780. @java.lang.Override
  781. protected java.lang.Object writeReplace()
  782. throws java.io.ObjectStreamException {
  783. return super.writeReplace();
  784. }
  785. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  786. com.google.protobuf.ByteString data)
  787. throws com.google.protobuf.InvalidProtocolBufferException {
  788. return PARSER.parseFrom(data);
  789. }
  790. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  791. com.google.protobuf.ByteString data,
  792. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  793. throws com.google.protobuf.InvalidProtocolBufferException {
  794. return PARSER.parseFrom(data, extensionRegistry);
  795. }
  796. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(byte[] data)
  797. throws com.google.protobuf.InvalidProtocolBufferException {
  798. return PARSER.parseFrom(data);
  799. }
  800. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  801. byte[] data,
  802. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  803. throws com.google.protobuf.InvalidProtocolBufferException {
  804. return PARSER.parseFrom(data, extensionRegistry);
  805. }
  806. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(java.io.InputStream input)
  807. throws java.io.IOException {
  808. return PARSER.parseFrom(input);
  809. }
  810. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  811. java.io.InputStream input,
  812. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  813. throws java.io.IOException {
  814. return PARSER.parseFrom(input, extensionRegistry);
  815. }
  816. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseDelimitedFrom(java.io.InputStream input)
  817. throws java.io.IOException {
  818. return PARSER.parseDelimitedFrom(input);
  819. }
  820. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseDelimitedFrom(
  821. java.io.InputStream input,
  822. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  823. throws java.io.IOException {
  824. return PARSER.parseDelimitedFrom(input, extensionRegistry);
  825. }
  826. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  827. com.google.protobuf.CodedInputStream input)
  828. throws java.io.IOException {
  829. return PARSER.parseFrom(input);
  830. }
  831. public static org.bitcoinj.wallet.Protos.EncryptedPrivateKey parseFrom(
  832. com.google.protobuf.CodedInputStream input,
  833. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  834. throws java.io.IOException {
  835. return PARSER.parseFrom(input, extensionRegistry);
  836. }
  837. public static Builder newBuilder() { return Builder.create(); }
  838. public Builder newBuilderForType() { return newBuilder(); }
  839. public static Builder newBuilder(org.bitcoinj.wallet.Protos.EncryptedPrivateKey prototype) {
  840. return newBuilder().mergeFrom(prototype);
  841. }
  842. public Builder toBuilder() { return newBuilder(this); }
  843. @java.lang.Override
  844. protected Builder newBuilderForType(
  845. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  846. Builder builder = new Builder(parent);
  847. return builder;
  848. }
  849. /**
  850. * Protobuf type {@code wallet.EncryptedPrivateKey}
  851. *
  852. * <pre>
  853. **
  854. * The data to store a private key encrypted with Scrypt and AES
  855. * </pre>
  856. */
  857. public static final class Builder extends
  858. com.google.protobuf.GeneratedMessage.Builder<Builder>
  859. implements org.bitcoinj.wallet.Protos.EncryptedPrivateKeyOrBuilder {
  860. public static final com.google.protobuf.Descriptors.Descriptor
  861. getDescriptor() {
  862. return org.bitcoinj.wallet.Protos.internal_static_wallet_EncryptedPrivateKey_descriptor;
  863. }
  864. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  865. internalGetFieldAccessorTable() {
  866. return org.bitcoinj.wallet.Protos.internal_static_wallet_EncryptedPrivateKey_fieldAccessorTable
  867. .ensureFieldAccessorsInitialized(
  868. org.bitcoinj.wallet.Protos.EncryptedPrivateKey.class, org.bitcoinj.wallet.Protos.EncryptedPrivateKey.Builder.class);
  869. }
  870. // Construct using org.bitcoinj.wallet.Protos.EncryptedPrivateKey.newBuilder()
  871. private Builder() {
  872. maybeForceBuilderInitialization();
  873. }
  874. private Builder(
  875. com.google.protobuf.GeneratedMessage.BuilderParent parent) {
  876. super(parent);
  877. maybeForceBuilderInitialization();
  878. }
  879. private void maybeForceBuilderInitialization() {
  880. if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
  881. }
  882. }
  883. private static Builder create() {
  884. return new Builder();
  885. }
  886. public Builder clear() {
  887. super.clear();
  888. initialisationVector_ = com.google.protobuf.ByteString.EMPTY;
  889. bitField0_ = (bitField0_ & ~0x00000001);
  890. encryptedPrivateKey_ = com.google.protobuf.ByteString.EMPTY;
  891. bitField0_ = (bitField0_ & ~0x00000002);
  892. return this;
  893. }
  894. public Builder clone() {
  895. return create().mergeFrom(buildPartial());
  896. }
  897. public com.google.protobuf.Descriptors.Descriptor
  898. getDescriptorForType() {
  899. return org.bitcoinj.wallet.Protos.internal_static_wallet_EncryptedPrivateKey_descriptor;
  900. }
  901. public org.bitcoinj.wallet.Protos.EncryptedPrivateKey getDefaultInstanceForType() {
  902. return org.bitcoinj.wallet.Protos.EncryptedPrivateKey.getDefaultInstance();
  903. }
  904. public org.bitcoinj.wallet.Protos.EncryptedPrivateKey build() {
  905. org.bitcoinj.wallet.Protos.EncryptedPrivateKey result = buildPartial();
  906. if (!result.isInitialized()) {
  907. throw newUninitializedMessageException(result);
  908. }
  909. return result;
  910. }
  911. public org.bitcoinj.wallet.Protos.EncryptedPrivateKey buildPartial() {
  912. org.bitcoinj.wallet.Protos.EncryptedPrivateKey result = new org.bitcoinj.wallet.Protos.EncryptedPrivateKey(this);
  913. int from_bitField0_ = bitField0_;
  914. int to_bitField0_ = 0;
  915. if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
  916. to_bitField0_ |= 0x00000001;
  917. }
  918. result.initialisationVector_ = initialisationVector_;
  919. if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
  920. to_bitField0_ |= 0x00000002;
  921. }
  922. result.encryptedPrivateKey_ = encryptedPrivateKey_;
  923. result.bitField0_ = to_bitField0_;
  924. onBuilt();
  925. return result;
  926. }
  927. public Builder mergeFrom(com.google.protobuf.Message other) {
  928. if (other instanceof org.bitcoinj.wallet.Protos.EncryptedPrivateKey) {
  929. return mergeFrom((org.bitcoinj.wallet.Protos.EncryptedPrivateKey)other);
  930. } else {
  931. super.mergeFrom(other);
  932. return this;
  933. }
  934. }
  935. public Builder mergeFrom(org.bitcoinj.wallet.Protos.EncryptedPrivateKey other) {
  936. if (other == org.bitcoinj.wallet.Protos.EncryptedPrivateKey.getDefaultInstance()) return this;
  937. if (other.hasInitialisationVector()) {
  938. setInitialisationVector(other.getInitialisationVector());
  939. }
  940. if (other.hasEncryptedPrivateKey()) {
  941. setEncryptedPrivateKey(other.getEncryptedPrivateKey());
  942. }
  943. this.mergeUnknownFields(other.getUnknownFields());
  944. return this;
  945. }
  946. public final boolean isInitialized() {
  947. if (!hasInitialisationVector()) {
  948. return false;
  949. }
  950. if (!hasEncryptedPrivateKey()) {
  951. return false;
  952. }
  953. return true;
  954. }
  955. public Builder mergeFrom(
  956. com.google.protobuf.CodedInputStream input,
  957. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  958. throws java.io.IOException {
  959. org.bitcoinj.wallet.Protos.EncryptedPrivateKey parsedMessage = null;
  960. try {
  961. parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
  962. } catch (com.google.protobuf.InvalidProtocolBufferException e) {
  963. parsedMessage = (org.bitcoinj.wallet.Protos.EncryptedPrivateKey) e.getUnfinishedMessage();
  964. throw e;
  965. } finally {
  966. if (parsedMessage != null) {
  967. mergeFrom(parsedMessage);
  968. }
  969. }
  970. return this;
  971. }
  972. private int bitField0_;
  973. // required bytes initialisation_vector = 1;
  974. private com.google.protobuf.ByteString initialisationVector_ = com.google.protobuf.ByteString.EMPTY;
  975. /**
  976. * <code>required bytes initialisation_vector = 1;</code>
  977. *
  978. * <pre>
  979. * The initialisation vector for the AES encryption (16 bytes)
  980. * </pre>
  981. */
  982. public boolean hasInitialisationVector() {
  983. return ((bitField0_ & 0x00000001) == 0x00000001);
  984. }
  985. /**
  986. * <code>required bytes initialisation_vector = 1;</code>
  987. *
  988. * <pre>
  989. * The initialisation vector for the AES encryption (16 bytes)
  990. * </pre>
  991. */
  992. public com.google.protobuf.ByteString getInitialisationVector() {
  993. return initialisationVector_;
  994. }
  995. /**
  996. * <code>required bytes initialisation_vector = 1;</code>
  997. *
  998. * <pre>
  999. * The initialisation vector for the AES encryption (16 bytes)
  1000. * </pre>
  1001. */
  1002. public Builder setInitialisationVector(com.google.protobuf.ByteString value) {
  1003. if (value == null) {
  1004. throw new NullPointerException();
  1005. }
  1006. bitField0_ |= 0x00000001;
  1007. initialisationVector_ = value;
  1008. onChanged();
  1009. return this;
  1010. }
  1011. /**
  1012. * <code>required bytes initialisation_vector = 1;</code>
  1013. *
  1014. * <pre>
  1015. * The initialisation vector for the AES encryption (16 bytes)
  1016. * </pre>
  1017. */
  1018. public Builder clearInitialisationVector() {
  1019. bitField0_ = (bitField0_ & ~0x00000001);
  1020. initialisationVector_ = getDefaultInstance().getInitialisationVector();
  1021. onChanged();
  1022. return this;
  1023. }
  1024. // required bytes encrypted_private_key = 2;
  1025. private com.google.protobuf.ByteString encryptedPrivateKey_ = com.google.protobuf.ByteString.EMPTY;
  1026. /**
  1027. * <code>required bytes encrypted_private_key = 2;</code>
  1028. *
  1029. * <pre>
  1030. * The encrypted private key
  1031. * </pre>
  1032. */
  1033. public boolean hasEncryptedPrivateKey() {
  1034. return ((bitField0_ & 0x00000002) == 0x00000002);
  1035. }
  1036. /**
  1037. * <code>required bytes encrypted_private_key = 2;</code>
  1038. *
  1039. * <pre>
  1040. * The encrypted private key
  1041. * </pre>
  1042. */
  1043. public com.google.protobuf.ByteString getEncryptedPrivateKey() {
  1044. return encryptedPrivateKey_;
  1045. }
  1046. /**
  1047. * <code>required bytes encrypted_private_key = 2;</code>
  1048. *
  1049. * <pre>
  1050. * The encrypted private key
  1051. * </pre>
  1052. */
  1053. public Builder setEncryptedPrivateKey(com.google.protobuf.ByteString value) {
  1054. if (value == null) {
  1055. throw new NullPointerException();
  1056. }
  1057. bitField0_ |= 0x00000002;
  1058. encryptedPrivateKey_ = value;
  1059. onChanged();
  1060. return this;
  1061. }
  1062. /**
  1063. * <code>required bytes encrypted_private_key = 2;</code>
  1064. *
  1065. * <pre>
  1066. * The encrypted private key
  1067. * </pre>
  1068. */
  1069. public Builder clearEncryptedPrivateKey() {
  1070. bitField0_ = (bitField0_ & ~0x00000002);
  1071. encryptedPrivateKey_ = getDefaultInstance().getEncryptedPrivateKey();
  1072. onChanged();
  1073. return this;
  1074. }
  1075. // @@protoc_insertion_point(builder_scope:wallet.EncryptedPrivateKey)
  1076. }
  1077. static {
  1078. defaultInstance = new EncryptedPrivateKey(true);
  1079. defaultInstance.initFields();
  1080. }
  1081. // @@protoc_insertion_point(class_scope:wallet.EncryptedPrivateKey)
  1082. }
  1083. public interface KeyOrBuilder
  1084. extends com.google.protobuf.MessageOrBuilder {
  1085. // required .wallet.Key.Type type = 1;
  1086. /**
  1087. * <code>required .wallet.Key.Type type = 1;</code>
  1088. */
  1089. boolean hasType();
  1090. /**
  1091. * <code>required .wallet.Key.Type type = 1;</code>
  1092. */
  1093. org.bitcoinj.wallet.Protos.Key.Type getType();
  1094. // optional bytes private_key = 2;
  1095. /**
  1096. * <code>optional bytes private_key = 2;</code>
  1097. *
  1098. * <pre>
  1099. * The private EC key bytes without any ASN.1 wrapping.
  1100. * </pre>
  1101. */
  1102. boolean hasPrivateKey();
  1103. /**
  1104. * <code>optional bytes private_key = 2;</code>
  1105. *
  1106. * <pre>
  1107. * The private EC key bytes without any ASN.1 wrapping.
  1108. * </pre>
  1109. */
  1110. com.google.protobuf.ByteString getPrivateKey();
  1111. // optional .wallet.EncryptedPrivateKey encrypted_private_key = 6;
  1112. /**
  1113. * <code>optional .wallet.EncryptedPrivateKey encrypted_private_key = 6;</code>
  1114. *
  1115. * <pre>
  1116. * The message containing the encrypted private EC key information.
  1117. * When an EncryptedPrivateKey is present then the (unencrypted) private_key will be a zero length byte array or contain all zeroes.
  1118. * This is for security of the private key information.
  1119. * </pre>
  1120. */
  1121. boolean hasEncryptedPrivateKey();
  1122. /**
  1123. * <code>optional .wallet.EncryptedPrivateKey encrypted_private_key = 6;</code>
  1124. *
  1125. * <pre>
  1126. * The message containing the encrypted private EC key information.
  1127. * When an EncryptedPrivateKey is present then the (unencrypted) private_key will be a zero length byte array or contain all zeroes.
  1128. * This is for security of the private key information.
  1129. * </pre>
  1130. */
  1131. org.bitcoinj.wallet.Protos.EncryptedPrivateKey getEncryptedPrivateKey();
  1132. /**
  1133. * <code>optional .wallet.EncryptedPrivateKey encrypted_private_key = 6;</code>
  1134. *
  1135. * <pre>
  1136. * The message containing the encrypted private EC key information.
  1137. * When an EncryptedPrivateKey is present then the (unencrypted) private_key will be a zero length byte array or contain all zeroes.
  1138. * This is for security of the private key information.
  1139. * </pre>
  1140. */
  1141. org.bitcoinj.wallet.Protos.EncryptedPrivateKeyOrBuilder getEncryptedPrivateKeyOrBuilder();
  1142. // optional bytes public_key = 3;
  1143. /**
  1144. * <code>optional bytes public_key = 3;</code>
  1145. *
  1146. * <pre>
  1147. * The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to
  1148. * do lots of slow EC math on startup.
  1149. * </pre>
  1150. */
  1151. boolean hasPublicKey();
  1152. /**
  1153. * <code>optional bytes public_key = 3;</code>
  1154. *
  1155. * <pre>
  1156. * The public EC key derived from the private key. We allow both to be stored to avoid mobile clients having to
  1157. * do lots of slow EC math on startup.
  1158. * </pre>
  1159. */
  1160. com.google.protobuf.ByteString getPublicKey();
  1161. // optional string label = 4;
  1162. /**
  1163. * <code>optional string label = 4;</code>
  1164. *
  1165. * <pre>
  1166. * User-provided label associated with the key.
  1167. * </pre>
  1168. */
  1169. boolean hasLabel();
  1170. /**
  1171. * <code>optional string label = 4;</code>
  1172. *
  1173. * <pre>
  1174. * User-provided label associated with the key.
  1175. * </pre>
  1176. */
  1177. java.lang.String getLabel();
  1178. /**
  1179. * <code>optional string label = 4;</code>
  1180. *
  1181. * <pre>
  1182. * User-provided label associated with the key.
  1183. * </pre>
  1184. */
  1185. com.google.protobuf.ByteString
  1186. getLabelBytes();
  1187. // optional int64 creation_timestamp = 5;
  1188. /**
  1189. * <code>optional int64 creation_timestamp = 5;</code>
  1190. *
  1191. * <pre>
  1192. * Timestamp stored as millis since epoch. Useful for skipping block bodies before this point.
  1193. * </pre>
  1194. */
  1195. boolean hasCreationTimestamp();
  1196. /**
  1197. * <code>optional int64 creation_timestamp = 5;</code>
  1198. *
  1199. * <pre>
  1200. * Timestamp stored as millis since epoch. Useful for skipping block bodies before this point.
  1201. * </pre>
  1202. */
  1203. long getCreationTimestamp();
  1204. }
  1205. /**
  1206. * Protobuf type {@code wallet.Key}
  1207. *
  1208. * <pre>
  1209. **
  1210. * A key used to control Bitcoin spending.
  1211. *
  1212. * Either the private key, the public key or both may be present. It is recommended that
  1213. * if the private key is provided that the public key is provided too because deriving it is slow.
  1214. *
  1215. * If only the public key is provided, the key can only be used to watch the blockchain and verify
  1216. * transactions, and not for spending.
  1217. * </pre>
  1218. */
  1219. public static final class Key extends
  1220. com.google.protobuf.GeneratedMessage
  1221. implements KeyOrBuilder {
  1222. // Use Key.newBuilder() to construct.
  1223. private Key(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
  1224. super(builder);
  1225. this.unknownFields = builder.getUnknownFields();
  1226. }
  1227. private Key(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
  1228. private static final Key defaultInstance;
  1229. public static Key getDefaultInstance() {
  1230. return defaultInstance;
  1231. }
  1232. public Key getDefaultInstanceForType() {
  1233. return defaultInstance;
  1234. }
  1235. private final com.google.protobuf.UnknownFieldSet unknownFields;
  1236. @java.lang.Override
  1237. public final com.google.protobuf.UnknownFieldSet
  1238. getUnknownFields() {
  1239. return this.unknownFields;
  1240. }
  1241. private Key(
  1242. com.google.protobuf.CodedInputStream input,
  1243. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  1244. throws com.google.protobuf.InvalidProtocolBufferException {
  1245. initFields();
  1246. int mutable_bitField0_ = 0;
  1247. com.google.protobuf.UnknownFieldSet.Builder unknownFields =
  1248. com.google.protobuf.UnknownFieldSet.newBuilder();
  1249. try {
  1250. boolean done = false;
  1251. while (!done) {
  1252. int tag = input.readTag();
  1253. switch (tag) {
  1254. case 0:
  1255. done = true;
  1256. break;
  1257. default: {
  1258. if (!parseUnknownField(input, unknownFields,
  1259. extensionRegistry, tag)) {
  1260. done = true;
  1261. }
  1262. break;
  1263. }
  1264. case 8: {
  1265. int rawValue = input.readEnum();
  1266. org.bitcoinj.wallet.Protos.Key.Type value = org.bitcoinj.wallet.Protos.Key.Type.valueOf(rawValue);
  1267. if (value == null) {
  1268. unknownFields.mergeVarintField(1, rawValue);
  1269. } else {
  1270. bitField0_ |= 0x00000001;
  1271. type_ = value;
  1272. }
  1273. break;
  1274. }
  1275. case 18: {
  1276. bitField0_ |= 0x00000002;
  1277. privateKey_ = input.readBytes();
  1278. break;
  1279. }
  1280. case 26: {
  1281. bitField0_ |= 0x00000008;
  1282. publicKey_ = input.readBytes();
  1283. break;
  1284. }
  1285. case 34: {
  1286. bitField0_ |= 0x00000010;
  1287. label_ = input.readBytes();
  1288. break;
  1289. }
  1290. case 40: {
  1291. bitField0_ |= 0x00000020;
  1292. creationTimestamp_ = input.readInt64();
  1293. break;
  1294. }
  1295. case 50: {
  1296. org.bitcoinj.wallet.Protos.EncryptedPrivateKey.Builder subBuilder = null;
  1297. if (((bitField0_ & 0x00000004) == 0x00000004)) {
  1298. subBuilder = encryptedPrivateKey_.toBuilder();
  1299. }
  1300. encryptedPrivateKey_ = input.readMessage(org.bitcoinj.wallet.Protos.EncryptedPrivateKey.PARSER, extensionRegistry);
  1301. if (subBuilder != null) {
  1302. subBuilder.mergeFrom(encryptedPrivateKey_);
  1303. encryptedPrivateKey_ = subBuilder.buildPartial();
  1304. }
  1305. bitField0_ |= 0x00000004;
  1306. break;
  1307. }
  1308. }
  1309. }
  1310. } catch (com.google.protobuf.InvalidProtocolBufferException e) {
  1311. throw e.setUnfinishedMessage(this);
  1312. } catch (java.io.IOException e) {
  1313. throw new com.google.protobuf.InvalidProtocolBufferException(
  1314. e.getMessage()).setUnfinishedMessage(this);
  1315. } finally {
  1316. this.unknownFields = unknownFields.build();
  1317. makeExtensionsImmutable();
  1318. }
  1319. }
  1320. public static final com.google.protobuf.Descriptors.Descriptor
  1321. getDescriptor() {
  1322. return org.bitcoinj.wallet.Protos.internal_static_wallet_Key_descriptor;
  1323. }
  1324. protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
  1325. internalGetFieldAccessorTable() {
  1326. return org.bitcoinj.wallet.Protos.internal_static_wallet_Key_fieldAccessorTable
  1327. .ensureFieldAccessorsInitialized(
  1328. org.bitcoinj.wallet.Protos.Key.class, org.bitcoinj.wallet.Protos.Key.Builder.class);
  1329. }
  1330. public static com.google.protobuf.Parser<Key> PARSER =
  1331. new com.google.protobuf.AbstractParser<Key>() {
  1332. public Key parsePartialFrom(
  1333. com.google.protobuf.CodedInputStream input,
  1334. com.google.protobuf.ExtensionRegistryLite extensionRegistry)
  1335. throws com.google.protobuf.InvalidProtocolBufferException {
  1336. return new Key(input, extensionRegistry);
  1337. }
  1338. };
  1339. @java.lang.Override
  1340. public com.google.protobuf.Parser<Key> getParserForType() {
  1341. return PARSER;
  1342. }
  1343. /**
  1344. * Protobuf enum {@code wallet.Key.Type}
  1345. */
  1346. public enum Type
  1347. implements com.google.protobuf.ProtocolMessageEnum {
  1348. /**
  1349. * <code>ORIGINAL = 1;</code>
  1350. *
  1351. * <pre>
  1352. * Unencrypted - Original bitcoin secp256k1 curve
  1353. * </pre>
  1354. */
  1355. ORIGINAL(0, 1),
  1356. /**
  1357. * <code>ENCRYPTED_SCRYPT_AES = 2;</code>
  1358. *
  1359. * <pre>
  1360. * Encrypted with Scrypt and AES - - Original bitcoin secp256k1 curve
  1361. * </pre>
  1362. */
  1363. ENCRYPTED_SCRYPT_AES(1, 2),
  1364. ;
  1365. /**
  1366. * <code>ORIGINAL = 1;</code>
  1367. *
  1368. * <pre>
  1369. * Unencrypted - Original bitcoin secp256k1 curve
  1370. * </pre>
  1371. */
  1372. public static final int ORIGINAL_VALUE = 1;
  1373. /**
  1374. * <code>ENCRYPTED_SCRYPT_AES = 2;</code>
  1375. *
  1376. * <pre>
  1377. * Encrypted with Scrypt and AES - - Original bitcoin secp256k1 curve
  1378. * </pre>
  1379. */
  1380. public static final int ENCRYPTED_SCRYPT_AES_VALUE = 2;
  1381. public final int getNumber() { return value; }
  1382. public static Type valueOf(int value) {
  1383. switch (value) {
  1384. case 1: return ORIGINAL;
  1385. case 2: return ENCRYPTED_SCRYPT_AES;
  1386. default: return null;
  1387. }
  1388. }
  1389. public static com.google.protobuf.Internal.EnumLiteMap<Type>
  1390. internalGetValueMap() {
  1391. return internalValueMap;